From 4a810bb829c3d4e1d75bd6088ce1bf2b8d228238 Mon Sep 17 00:00:00 2001 From: Evgenii Grekov Date: Fri, 22 Feb 2019 15:01:26 +0500 Subject: [PATCH] set boiler wwtemp via MQTT --- README.md | 1 + doc/home_assistant/climate.yaml | 10 ++++++++++ doc/home_assistant/ui-lovelace.yaml | 3 +++ src/ems-esp.ino | 10 ++++++++++ src/my_config.h | 1 + 5 files changed, 25 insertions(+) diff --git a/README.md b/README.md index b5700850e..6ccd476f8 100644 --- a/README.md +++ b/README.md @@ -240,6 +240,7 @@ These incoming MQTT topics are also handled: | thermostat_cmd_temp | TOPIC_THERMOSTAT_CMD_TEMP | temperature as a float | sets the thermostat current setpoint | | thermostat_cmd_mode | TOPIC_THERMOSTAT_CMD_MODE | auto, day, night | sets the thermostat mode | | wwactivated | TOPIC_BOILER_WWACTIVATED | 0 or 1 | turns boiler warm water on/off (not tap) | +| boiler_cmd_wwtemp | TOPIC_BOILER_CMD_WWTEMP | temperature as a float | sets the boiler wwtemp current setpoint | If MQTT is not used use 'set mqtt_host' to remove it. diff --git a/doc/home_assistant/climate.yaml b/doc/home_assistant/climate.yaml index 9f9fc5b1b..18799bc19 100644 --- a/doc/home_assistant/climate.yaml +++ b/doc/home_assistant/climate.yaml @@ -18,3 +18,13 @@ temp_step: 0.5 + - platform: mqtt + name: boiler + min_temp: 40 + max_temp: 60 + temp_step: 1 + current_temperature_topic: "home/ems-esp/boiler_data" + temperature_state_topic: "home/ems-esp/boiler_data" + temperature_command_topic: "home/ems-esp/boiler_cmd_wwtemp" + current_temperature_template: "{{ value_json.wWCurTmp }}" + temperature_state_template: "{{ value_json.wWSelTemp }}" diff --git a/doc/home_assistant/ui-lovelace.yaml b/doc/home_assistant/ui-lovelace.yaml index 0299bd50b..59f96d36e 100644 --- a/doc/home_assistant/ui-lovelace.yaml +++ b/doc/home_assistant/ui-lovelace.yaml @@ -57,3 +57,6 @@ views: - sensor.dark_sky_temperature - type: thermostat entity: climate.thermostat + - type: thermostat + name: WarmWater + entity: climate.boiler diff --git a/src/ems-esp.ino b/src/ems-esp.ino index e7f238ddc..538fca17a 100644 --- a/src/ems-esp.ino +++ b/src/ems-esp.ino @@ -845,6 +845,7 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { myESP.mqttSubscribe(TOPIC_THERMOSTAT_CMD_TEMP); myESP.mqttSubscribe(TOPIC_THERMOSTAT_CMD_MODE); myESP.mqttSubscribe(TOPIC_BOILER_WWACTIVATED); + myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWTEMP); myESP.mqttSubscribe(TOPIC_SHOWER_TIMER); myESP.mqttSubscribe(TOPIC_SHOWER_ALERT); myESP.mqttSubscribe(TOPIC_SHOWER_COLDSHOT); @@ -896,6 +897,15 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { ems_setWarmWaterActivated(false); } } + + // boiler wwtemp changes + if (strcmp(topic, TOPIC_BOILER_CMD_WWTEMP) == 0) { + float f = strtof((char *)message, 0); + char s[10] = {0}; + myDebug("MQTT topic: boiler warm water temperature value %s", _float_to_char(s, f)); + ems_setWarmWaterTemp(f); + publishValues(true); // publish back immediately + } // shower timer if (strcmp(topic, TOPIC_SHOWER_TIMER) == 0) { diff --git a/src/my_config.h b/src/my_config.h index 4ec9cffed..5d8c93df0 100644 --- a/src/my_config.h +++ b/src/my_config.h @@ -35,6 +35,7 @@ #define TOPIC_BOILER_TAPWATER_ACTIVE "tapwater_active" // if hot tap water is running #define TOPIC_BOILER_HEATING_ACTIVE "heating_active" // if heating is on #define TOPIC_BOILER_WWACTIVATED "wwactivated" // for receiving MQTT message to change water on/off +#define TOPIC_BOILER_CMD_WWTEMP "boiler_cmd_wwtemp" // for received boiler wwtemp changes via MQTT // shower time #define TOPIC_SHOWERTIME "showertime" // for sending shower time results