This commit is contained in:
Koen Kanters
2020-09-30 20:04:06 +02:00
parent 44224b4d6b
commit a0499af62d
+10 -11
View File
@@ -866,15 +866,16 @@ const climate = (minTemp=7, maxTemp=30, temperatureStateProperty='occupied_heati
if (indexOfNone > -1) holdModes.splice(indexOfNone, 1);
// HA has special behaviour for the away mode
const indexOfAway = holdModes.indexOf('away');
if (indexOfAway > -1) {
holdModes.splice(indexOfAway, 1); // HA will add "Away" to modes by itself
retVal.discovery_payload.away_mode_command_topic = true;
retVal.discovery_payload.away_mode_state_topic = true;
retVal.discovery_payload.away_mode_state_template =
'{{ value_json.away_mode }}';
}
if (holdModes.length > 0 || indexOfAway > -1) {
// https://github.com/Koenkk/zigbee2mqtt/pull/4491#issuecomment-701550476
// const indexOfAway = holdModes.indexOf('away');
// if (indexOfAway > -1) {
// holdModes.splice(indexOfAway, 1); // HA will add "Away" to modes by itself
// retVal.discovery_payload.away_mode_command_topic = true;
// retVal.discovery_payload.away_mode_state_topic = true;
// retVal.discovery_payload.away_mode_state_template =
// '{{ value_json.away_mode }}';
// }
if (holdModes.length > 0) { // || indexOfAway > -1) {
retVal.discovery_payload.hold_modes = holdModes;
retVal.discovery_payload.hold_command_topic = true;
retVal.discovery_payload.hold_state_template = `{{ value_json.preset }}`;
@@ -2081,8 +2082,6 @@ const mapping = {
'ZS190000118': [cfg.switch],
'ZG2835': [cfg.sensor_action],
'CTR.UBX': [cfg.sensor_action],
'HT-08': [],
'HT-10': [],
'WS-USC03': [cfg.switch],
'TS0601_switch_3_gang': [switchEndpoint('l1'), switchEndpoint('l2'), switchEndpoint('l3')],
'4655BC0-R': [cfg.binary_sensor_contact, cfg.binary_sensor_battery_low],