mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-10-23 06:12:23 +00:00
* fix * eslint fix * don't use temp topic when low and high temp used * fix for temp high * Add tests Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
This commit is contained in:
1 parent
676684158a
commit
54f164cc21
4 files changed
+81
-5
No files matched your search
@@ -776,6 +776,7 @@ const climate = (minTemp=7, maxTemp=30, temperatureStateProperty='occupied_heati
|
||||
object_id: 'climate',
|
||||
discovery_payload: {
|
||||
state_topic: false,
|
||||
temperature_unit: 'C',
|
||||
min_temp: `${minTemp}`,
|
||||
max_temp: `${maxTemp}`,
|
||||
mode_state_topic: true,
|
||||
@@ -783,9 +784,6 @@ const climate = (minTemp=7, maxTemp=30, temperatureStateProperty='occupied_heati
|
||||
mode_command_topic: true,
|
||||
current_temperature_topic: true,
|
||||
current_temperature_template: '{{ value_json.local_temperature }}',
|
||||
temperature_state_topic: true,
|
||||
temperature_state_template: `{{ value_json.${temperatureStateProperty} }}`,
|
||||
temperature_command_topic: temperatureStateProperty,
|
||||
temp_step: tempStep,
|
||||
action_topic: true,
|
||||
action_template:
|
||||
@@ -813,6 +811,12 @@ const climate = (minTemp=7, maxTemp=30, temperatureStateProperty='occupied_heati
|
||||
retVal.discovery_payload.fan_mode_state_template = `{{ value_json.fan_mode }}`;
|
||||
retVal.discovery_payload.fan_mode_state_topic = true;
|
||||
}
|
||||
// if no high and low temp used then use temperature_state_topic
|
||||
if (!temperatureHighStateTopic && !temperatureLowStateTopic) {
|
||||
retVal.discovery_payload.temperature_state_topic = true;
|
||||
retVal.discovery_payload.temperature_state_template = `{{ value_json.${temperatureStateProperty} }}`;
|
||||
retVal.discovery_payload.temperature_command_topic = temperatureStateProperty;
|
||||
}
|
||||
// use low target temperature
|
||||
if (temperatureLowStateTopic) {
|
||||
retVal.discovery_payload.temperature_low_state_topic = temperatureLowStateTopic;
|
||||
@@ -822,8 +826,8 @@ const climate = (minTemp=7, maxTemp=30, temperatureStateProperty='occupied_heati
|
||||
// use high target temperature
|
||||
if (temperatureHighStateTopic) {
|
||||
retVal.discovery_payload.temperature_high_state_topic = temperatureHighStateTopic;
|
||||
retVal.discovery_payload.temperature_high_state_template = `{{ value_json.occupied_heating_setpoint }}`;
|
||||
retVal.discovery_payload.temperature_high_command_topic = 'occupied_heating_setpoint';
|
||||
retVal.discovery_payload.temperature_high_state_template = `{{ value_json.occupied_cooling_setpoint }}`;
|
||||
retVal.discovery_payload.temperature_high_command_topic = 'occupied_cooling_setpoint';
|
||||
}
|
||||
return retVal;
|
||||
};
|
||||
@@ -2205,6 +2209,14 @@ class HomeAssistant extends Extension {
|
||||
payload.mode_command_topic = `${stateTopic}/set/system_mode`;
|
||||
}
|
||||
|
||||
if (payload.hold_command_topic) {
|
||||
payload.hold_command_topic = `${stateTopic}/set/preset`;
|
||||
}
|
||||
|
||||
if (payload.hold_state_topic) {
|
||||
payload.hold_state_topic = stateTopic;
|
||||
}
|
||||
|
||||
if (payload.current_temperature_topic) {
|
||||
payload.current_temperature_topic = stateTopic;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user