add serviceCode change detect, show serviceCode in web

This commit is contained in:
MichaelDvP
2020-09-06 12:25:57 +02:00
parent 80b42a08d3
commit 40607b1fc8
2 changed files with 12 additions and 5 deletions

View File

@@ -105,6 +105,14 @@ void Boiler::register_mqtt_ha_config() {
void Boiler::device_info(JsonArray & root) {
JsonObject dataElement;
if (serviceCodeChar_[0] && Helpers::hasValue(serviceCode_)) {
dataElement = root.createNestedObject();
dataElement["name"] = F("Service Code");
char s[12];
snprintf_P(s, 12, PSTR("%s (%d)"), serviceCodeChar_, serviceCode_);
dataElement["value"] = s;
}
if (Helpers::hasValue(tap_water_active_, EMS_VALUE_BOOL)) {
dataElement = root.createNestedObject();
dataElement["name"] = F("Hot tap water");
@@ -509,8 +517,8 @@ void Boiler::process_UBAMonitorFast(std::shared_ptr<const Telegram> telegram) {
// read the service code / installation status as appears on the display
if ((telegram->message_length > 18) && (telegram->offset == 0)) {
serviceCodeChar_[0] = char(telegram->message_data[18]); // ascii character 1
serviceCodeChar_[1] = char(telegram->message_data[19]); // ascii character 2
changed_ |= telegram->read_value(serviceCodeChar_[0], 18);
changed_ |= telegram->read_value(serviceCodeChar_[1], 19);
serviceCodeChar_[2] = '\0'; // null terminate string
}
@@ -576,8 +584,8 @@ void Boiler::process_UBAMonitorFastPlus(std::shared_ptr<const Telegram> telegram
// read the service code / installation status as appears on the display
if ((telegram->message_length > 4) && (telegram->offset == 0)) {
serviceCodeChar_[0] = char(telegram->message_data[4]); // ascii character 1
serviceCodeChar_[1] = char(telegram->message_data[5]); // ascii character 2
changed_ |= telegram->read_value(serviceCodeChar_[0], 4);
changed_ |= telegram->read_value(serviceCodeChar_[1], 5);
serviceCodeChar_[2] = '\0';
}

View File

@@ -54,7 +54,6 @@ class Boiler : public EMSdevice {
uint8_t last_boilerState = 0xFF; // remember last state of heating and warm water on/off
uint8_t mqtt_format_; // single, nested or ha
bool changed_ = false;
;
static constexpr uint8_t EMS_TYPE_UBAParameterWW = 0x33;
static constexpr uint8_t EMS_TYPE_UBAFunctionTest = 0x1D;