mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-27 21:20:03 +00:00
Add tz.tuya_thermostat_away_mode (fix for https://github.com/Koenkk/z… (#4510)
* Add tz.tuya_thermostat_away_mode (fix for https://github.com/Koenkk/zigbee2mqtt/pull/4491) * Added /* istanbul ignore else */
This commit is contained in:
@@ -820,15 +820,16 @@ const climate = (minTemp=7, maxTemp=30, temperatureStateProperty='occupied_heati
|
||||
|
||||
// HA has special behaviour for the away mode
|
||||
// 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 }}';
|
||||
// }
|
||||
const indexOfAway = holdModes.indexOf('away');
|
||||
/* istanbul ignore else */
|
||||
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;
|
||||
@@ -1814,13 +1815,13 @@ class HomeAssistant extends Extension {
|
||||
payload.hold_state_topic = stateTopic;
|
||||
}
|
||||
|
||||
// if (payload.away_mode_state_topic) {
|
||||
// payload.away_mode_state_topic = stateTopic;
|
||||
// }
|
||||
if (payload.away_mode_state_topic) {
|
||||
payload.away_mode_state_topic = stateTopic;
|
||||
}
|
||||
|
||||
// if (payload.away_mode_command_topic) {
|
||||
// payload.away_mode_command_topic = `${stateTopic}/set/away_mode`;
|
||||
// }
|
||||
if (payload.away_mode_command_topic) {
|
||||
payload.away_mode_command_topic = `${stateTopic}/set/away_mode`;
|
||||
}
|
||||
|
||||
if (payload.current_temperature_topic) {
|
||||
payload.current_temperature_topic = stateTopic;
|
||||
|
||||
Reference in New Issue
Block a user