From dfa1d5e7a75ac23d0afcd40c600a6ae775f3c07d Mon Sep 17 00:00:00 2001 From: Xeyame Date: Fri, 5 Apr 2019 22:38:10 +0200 Subject: [PATCH 1/2] Fix HomeAssisant Thermostat integration Things like translations work proper with the auto/manual/off messages. Also it allows for working buttons in HA. --- doc/home_assistant/climate.yaml | 6 +++--- src/ems-esp.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/home_assistant/climate.yaml b/doc/home_assistant/climate.yaml index 18799bc19..2ddbbece1 100644 --- a/doc/home_assistant/climate.yaml +++ b/doc/home_assistant/climate.yaml @@ -1,9 +1,9 @@ - platform: mqtt name: Thermostat modes: - - low - - manual - - auto + - "auto" + - "manual" + - "off" mode_state_topic: "home/ems-esp/thermostat_data" current_temperature_topic: "home/ems-esp/thermostat_data" diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index eea686639..e87d1afcc 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -1233,9 +1233,9 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { myDebug("MQTT topic: thermostat mode value %s", message); if (strcmp((char *)message, "auto") == 0) { ems_setThermostatMode(2); - } else if (strcmp((char *)message, "day") == 0) { + } else if (strcmp((char *)message, "day") == 0 || strcmp((char *)message, "manual") == 0) { ems_setThermostatMode(1); - } else if (strcmp((char *)message, "night") == 0) { + } else if (strcmp((char *)message, "night") == 0 || strcmp((char *)message, "off") == 0) { ems_setThermostatMode(0); } } From 85b19271468847e90725835d467472fdb8b08464 Mon Sep 17 00:00:00 2001 From: Xeyame Date: Fri, 5 Apr 2019 22:39:19 +0200 Subject: [PATCH 2/2] Allow changing WW mode from HomeAssistant --- doc/home_assistant/climate.yaml | 6 ++++++ src/ems-esp.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/home_assistant/climate.yaml b/doc/home_assistant/climate.yaml index 2ddbbece1..b344c66fb 100644 --- a/doc/home_assistant/climate.yaml +++ b/doc/home_assistant/climate.yaml @@ -20,6 +20,9 @@ - platform: mqtt name: boiler + modes: + - "on" + - "off" min_temp: 40 max_temp: 60 temp_step: 1 @@ -28,3 +31,6 @@ temperature_command_topic: "home/ems-esp/boiler_cmd_wwtemp" current_temperature_template: "{{ value_json.wWCurTmp }}" temperature_state_template: "{{ value_json.wWSelTemp }}" + mode_state_template: "{{ value_json.wWActivated }}" + mode_state_topic: "home/ems-esp/boiler_data" + mode_command_topic: "home/ems-esp/wwactivated" diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index e87d1afcc..fea746cf8 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -1242,9 +1242,9 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { // wwActivated if (strcmp(topic, TOPIC_BOILER_WWACTIVATED) == 0) { - if (message[0] == '1') { + if (message[0] == '1' || message[0] == 'on') { ems_setWarmWaterActivated(true); - } else if (message[0] == '0') { + } else if (message[0] == '0' || message[0] == 'off') { ems_setWarmWaterActivated(false); } }