From c7e525d47f643ae83dafc4b93a4fc5819e0e08d0 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 18 Oct 2020 09:51:48 +0200 Subject: [PATCH 1/3] change back to 3-way valve --- src/devices/boiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index f11c96e54..571450fda 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -319,7 +319,7 @@ bool Boiler::export_values(JsonObject & output) { // Warm Water charging type if (Helpers::hasValue(wWChargeType_, EMS_VALUE_BOOL)) { - output["wWChargeType"] = wWChargeType_ ? F("3way valve") : F("charge pump"); + output["wWChargeType"] = wWChargeType_ ? F("3-way valve") : F("charge pump"); } // Warm Water circulation pump available bool From eedbb0fc53ee52c67ceacea3b6f65800b3fec7fa Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 18 Oct 2020 09:52:12 +0200 Subject: [PATCH 2/3] API calls show pretty json format --- src/EMSESPAPIService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EMSESPAPIService.cpp b/src/EMSESPAPIService.cpp index e8e1c8ba2..a08728342 100644 --- a/src/EMSESPAPIService.cpp +++ b/src/EMSESPAPIService.cpp @@ -111,7 +111,7 @@ void EMSESPAPIService::emsespAPIService(AsyncWebServerRequest * request) { if (output.size()) { doc.shrinkToFit(); char buffer[EMSESP_MAX_JSON_SIZE_LARGE]; - serializeJson(doc, buffer); + serializeJsonPretty(doc, buffer); request->send(200, "text/plain", buffer); } else { request->send(200, "text/plain", ok ? F("OK") : F("Invalid")); From bf746c7567fa40115d831a40b5d34182514b4baa Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 18 Oct 2020 14:18:52 +0200 Subject: [PATCH 3/3] update tapwater/heating check --- src/devices/boiler.cpp | 22 ++++++++++++++-------- src/devices/boiler.h | 1 - 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 571450fda..043d3a061 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -708,23 +708,29 @@ void Boiler::show_values(uuid::console::Shell & shell) { /* * Check if hot tap water or heating is active * If a value has changed, post it immediately to MQTT so we get real time data + * Values will always be posted first time as heatingActive_ and tapwaterActive_ will have values EMS_VALUE_BOOL_NOTSET */ void Boiler::check_active() { - if ((boilerState_ == EMS_VALUE_UINT_NOTSET) || ((boilerState_ & 0x09) != (last_boilerState & 0x09))) { + bool b; + uint8_t val; + + // check if heating is active, bits 2 and 4 must be set + b = ((boilerState_ & 0x09) == 0x09); + val = b ? EMS_VALUE_BOOL_ON : EMS_VALUE_BOOL_OFF; + if (heatingActive_ != val) { + heatingActive_ = val; char s[7]; - bool b = ((boilerState_ & 0x09) == 0x09); Mqtt::publish(F("heating_active"), Helpers::render_boolean(s, b)); - heatingActive_ = b ? EMS_VALUE_BOOL_ON : EMS_VALUE_BOOL_OFF; - last_boilerState = boilerState_; } - if ((boilerState_ == EMS_VALUE_UINT_NOTSET) || ((boilerState_ & 0x0A) != (last_boilerState & 0x0A))) { + // check if tap water is active, bits 1 and 4 must be set + b = ((boilerState_ & 0x0A) == 0x0A); + val = b ? EMS_VALUE_BOOL_ON : EMS_VALUE_BOOL_OFF; + if (tapwaterActive_ != val) { + tapwaterActive_ = val; char s[7]; - bool b = ((boilerState_ & 0x0A) == 0x0A); Mqtt::publish(F("tapwater_active"), Helpers::render_boolean(s, b)); - tapwaterActive_ = b ? EMS_VALUE_BOOL_ON : EMS_VALUE_BOOL_OFF; EMSESP::tap_water_active(b); // let EMS-ESP know, used in the Shower class - last_boilerState = boilerState_; } /* diff --git a/src/devices/boiler.h b/src/devices/boiler.h index 46b300823..2afbfe3c5 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -52,7 +52,6 @@ class Boiler : public EMSdevice { void print_value2(uuid::console::Shell & shell, const char * param, const __FlashStringHelper * name, const __FlashStringHelper * suffix, JsonObject & json); - uint8_t last_boilerState = EMS_VALUE_UINT_NOTSET; // remember last state of heating and warm water on/off bool changed_ = false; bool mqtt_ha_config_ = false; // HA MQTT Discovery