change show_info to read of json, updates to use HA MQTT Discovery

This commit is contained in:
proddy
2020-10-03 16:34:06 +02:00
parent 7020b41f55
commit eb98caa87a
9 changed files with 744 additions and 460 deletions

View File

@@ -87,7 +87,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
void Boiler::register_mqtt_ha_config() {
// Create the Master device
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
doc["name"] = F("EMS-ESP");
doc["name"] = F("Service Code");
doc["uniq_id"] = F("boiler");
doc["ic"] = F("mdi:home-thermometer-outline");
doc["stat_t"] = F("ems-esp/boiler_data");
@@ -101,39 +101,160 @@ void Boiler::register_mqtt_ha_config() {
ids.add("ems-esp-boiler");
Mqtt::publish_retain(F("homeassistant/sensor/ems-esp/boiler/config"), doc.as<JsonObject>(), true); // publish the config payload with retain flag
Mqtt::register_mqtt_ha_binary_sensor(F("Boiler DHW"), this->device_type(), "tapwater_active");
Mqtt::register_mqtt_ha_binary_sensor(F("Boiler Heating"), this->device_type(), "heating_active");
Mqtt::register_mqtt_ha_binary_sensor(F_(tapwaterActive), this->device_type(), "tapwaterActive");
Mqtt::register_mqtt_ha_binary_sensor(F_(heatingActive), this->device_type(), "heatingActive");
Mqtt::register_mqtt_ha_sensor(F("Service Code"), this->device_type(), "serviceCode", "", "");
Mqtt::register_mqtt_ha_sensor(F("Service Code number"), this->device_type(), "serviceCodeNumber", "", "");
Mqtt::register_mqtt_ha_sensor(F("Boiler WW Selected Temp"), this->device_type(), "wWSelTemp", "°C", "mdi:coolant-temperature");
Mqtt::register_mqtt_ha_sensor(F("Selected flow temperature"), this->device_type(), "selFlowTemp", "°C", "mdi:coolant-temperature");
Mqtt::register_mqtt_ha_sensor(F("Current flow temperature"), this->device_type(), "curFlowTemp", "°C", "mdi:coolant-temperature");
Mqtt::register_mqtt_ha_sensor(F("Warm Water set temperature"), this->device_type(), "wWSetTemp", "°C", "mdi:coolant-temperature");
Mqtt::register_mqtt_ha_sensor(F("Warm Water current temperature (intern)"), this->device_type(), "wWCurTmp", "°C", "mdi:coolant-temperature");
Mqtt::register_mqtt_ha_sensor(F("Warm Water current temperature (extern)"), this->device_type(), "wWCurTmp2", "°C", "mdi:coolant-temperature");
Mqtt::register_mqtt_ha_sensor(F("Pump modulation"), this->device_type(), "pumpMod", "%", "mdi:sine-wave");
Mqtt::register_mqtt_ha_sensor(F("Heat Pump modulation"), this->device_type(), "pumpMod2", "%", "mdi:sine-wave");
Mqtt::register_mqtt_ha_sensor(F("System Pressure"), this->device_type(), "sysPress", "bar", "");
Mqtt::register_mqtt_ha_sensor(nullptr, F_(serviceCodeNumber), this->device_type(), "serviceCodeNumber", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWSelTemp), this->device_type(), "wWSelTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWSetTemp), this->device_type(), "wWSetTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWDisinfectionTemp), this->device_type(), "wWDisinfectionTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(selFlowTemp), this->device_type(), "selFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(selBurnPow), this->device_type(), "selBurnPow", F_(percent), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(curBurnPow), this->device_type(), "curBurnPow", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(pumpMod), this->device_type(), "pumpMod", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(pumpMod2), this->device_type(), "pumpMod2", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWType), this->device_type(), "wWType", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWChargeType), this->device_type(), "wWChargeType", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWCircPump), this->device_type(), "wWCircPump", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWCiPuMode), this->device_type(), "wWCiPuMode", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWCirc), this->device_type(), "wWCirc", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(outdoorTemp), this->device_type(), "outdoorTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWCurTmp), this->device_type(), "wWCurTmp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWCurTmp2), this->device_type(), "wWCurTmp2", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(wWCurFlow), this->device_type(), "wWCurFlow", F("l/min"), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(curFlowTemp), this->device_type(), "curFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(retTemp), this->device_type(), "retTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(switchTemp), this->device_type(), "switchTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(sysPress), this->device_type(), "sysPress", F_(bar), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(boilTemp), this->device_type(), "boilTemp", F_(degrees), nullptr);
// TODO add remaining values to MQTT
/*
Mqtt::register_mqtt_ha_sensor(F_(burnGas), this->device_type(), "burnGas", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(flameCurr), this->device_type(), "flameCurr", F_(uA), nullptr);
Mqtt::register_mqtt_ha_sensor(F_(heatPump), this->device_type(), "heatPump", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(fanWork), this->device_type(), "fanWork", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(ignWork), this->device_type(), "ignWork", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWHeat), this->device_type(), "wWHeat", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wwStorageTemp1), this->device_type(), "wwStorageTemp1", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wwStorageTemp2), this->device_type(), "wwStorageTemp2", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(exhaustTemp), this->device_type(), "exhaustTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWActivated), this->device_type(), "wWActivated", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWOnetime), this->device_type(), "wWOnetime", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWDisinfecting), this->device_type(), "wWDisinfecting", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWCharge), this->device_type(), "wWCharge", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWRecharge), this->device_type(), "wWRecharge", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWTempOK), this->device_type(), "wWTempOK", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWActive), this->device_type(), "wWActive", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(heatingActivated), this->device_type(), "heatingActivated", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(heatingTemp), this->device_type(), "heatingTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(pumpModMax), this->device_type(), "pumpModMax", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(pumpModMin), this->device_type(), "pumpModMin", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(pumpDelay), this->device_type(), "pumpDelay", F_(min), nullptr);
Mqtt::register_mqtt_ha_sensor(F_(burnMinPeriod), this->device_type(), "burnMinPeriod", F_(min), nullptr);
Mqtt::register_mqtt_ha_sensor(F_(burnMinPower), this->device_type(), "burnMinPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(burnMaxPower), this->device_type(), "burnMaxPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(boilHystOn), this->device_type(), "boilHystOn", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(boilHystOff), this->device_type(), "boilHystOff", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(setFlowTemp), this->device_type(), "setFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWSetPumpPower), this->device_type(), "wWSetPumpPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(wwMixTemperature), this->device_type(), "wwMixTemperature", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wwBufferBoilerTemperature), this->device_type(), "wwBufferBoilerTemperature", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWStarts), this->device_type(), "wWStarts", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWWorkM), this->device_type(), "wWWorkM", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(setBurnPow), this->device_type(), "setBurnPow", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(burnStarts), this->device_type(), "burnStarts", nullptr, nullptr);
*/
}
// send stuff to the Web UI
void Boiler::device_info_web(JsonArray & root) {
JsonObject dataElement;
render_value_json(root, "", F("Service code"), serviceCodeChar_, nullptr);
render_value_json(root, "", F("Service code number"), serviceCode_, nullptr);
render_value_json(root, "", F("Hot tap water"), tap_water_active_, nullptr, EMS_VALUE_BOOL);
render_value_json(root, "", F("Central Heating"), heating_active_, nullptr, EMS_VALUE_BOOL);
render_value_json(root, "", F("Selected flow temperature"), selFlowTemp_, F_(degrees));
render_value_json(root, "", F("Current flow temperature"), curFlowTemp_, F_(degrees), 10);
render_value_json(root, "", F("Warm Water selected temperature"), wWSelTemp_, F_(degrees));
render_value_json(root, "", F("Warm Water set temperature"), wWSetTmp_, F_(degrees));
render_value_json(root, "", F("Warm Water current temperature (intern)"), wWCurTmp_, F_(degrees), 10);
render_value_json(root, "", F("Warm Water current temperature (extern)"), wWCurTmp2_, F_(degrees), 10);
render_value_json(root, "", F("Pump modulation"), pumpMod_, F_(percent));
render_value_json(root, "", F("Heat Pump modulation"), pumpMod2_, F_(percent));
render_value_json(root, "", F("System pressure"), sysPress_, F_(bar), 10);
render_value_json(root, "", F_(serviceCode), serviceCodeChar_, nullptr);
render_value_json(root, "", F_(serviceCodeNumber), serviceCode_, nullptr);
render_value_json(root, "", F_(tapwaterActive), tap_water_active_, nullptr, EMS_VALUE_BOOL);
render_value_json(root, "", F_(heatingActive), heating_active_, nullptr, EMS_VALUE_BOOL);
render_value_json(root, "", F_(selFlowTemp), selFlowTemp_, F_(degrees));
render_value_json(root, "", F_(curFlowTemp), curFlowTemp_, F_(degrees), 10);
render_value_json(root, "", F_(wWSelTemp), wWSelTemp_, F_(degrees));
render_value_json(root, "", F_(wWSetTemp), wWSetTmp_, F_(degrees));
render_value_json(root, "", F_(wWCurTmp), wWCurTmp_, F_(degrees), 10);
render_value_json(root, "", F_(wWCurTmp2), wWCurTmp2_, F_(degrees), 10);
render_value_json(root, "", F_(pumpMod), pumpMod_, F_(percent));
render_value_json(root, "", F_(pumpMod2), pumpMod2_, F_(percent));
render_value_json(root, "", F_(sysPress), sysPress_, F_(bar), 10);
// TODO add remaining values to web
/*
Mqtt::register_mqtt_ha_sensor(F_(heatingActive), this->device_type(), "heatingActive", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(tapwaterActive), this->device_type(), "tapwaterActive", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(serviceCode), this->device_type(), "serviceCode", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(serviceCodeNumber), this->device_type(), "serviceCodeNumber", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWSelTemp), this->device_type(), "wWSelTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWSetTemp), this->device_type(), "wWSetTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWDisinfectionTemp), this->device_type(), "wWDisinfectionTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(selFlowTemp), this->device_type(), "selFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(selBurnPow), this->device_type(), "selBurnPow", F_(percent), nullptr);
Mqtt::register_mqtt_ha_sensor(F_(curBurnPow), this->device_type(), "curBurnPow", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(pumpMod), this->device_type(), "pumpMod", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(pumpMod2), this->device_type(), "pumpMod2", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(wWType), this->device_type(), "wWType", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWChargeType), this->device_type(), "wWChargeType", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWCircPump), this->device_type(), "wWCircPump", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWCiPuMode), this->device_type(), "wWCiPuMode", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWCirc), this->device_type(), "wWCirc", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(outdoorTemp), this->device_type(), "outdoorTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWCurTmp), this->device_type(), "wWCurTmp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWCurTmp2), this->device_type(), "wWCurTmp2", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWCurFlow), this->device_type(), "wWCurFlow", F("l/min"), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(curFlowTemp), this->device_type(), "curFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(retTemp), this->device_type(), "retTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(switchTemp), this->device_type(), "switchTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(sysPress), this->device_type(), "sysPress", F_(bar), nullptr);
Mqtt::register_mqtt_ha_sensor(F_(boilTemp), this->device_type(), "boilTemp", F_(degrees), nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wwStorageTemp1), this->device_type(), "wwStorageTemp1", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wwStorageTemp2), this->device_type(), "wwStorageTemp2", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(exhaustTemp), this->device_type(), "exhaustTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWActivated), this->device_type(), "wWActivated", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWOnetime), this->device_type(), "wWOnetime", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWDisinfecting), this->device_type(), "wWDisinfecting", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWCharge), this->device_type(), "wWCharge", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWRecharge), this->device_type(), "wWRecharge", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWTempOK), this->device_type(), "wWTempOK", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWActive), this->device_type(), "wWActive", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(burnGas), this->device_type(), "burnGas", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(flameCurr), this->device_type(), "flameCurr", F_(uA), nullptr);
Mqtt::register_mqtt_ha_sensor(F_(heatPump), this->device_type(), "heatPump", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(fanWork), this->device_type(), "fanWork", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(ignWork), this->device_type(), "ignWork", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWHeat), this->device_type(), "wWHeat", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(heatingActivated), this->device_type(), "heatingActivated", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(heatingTemp), this->device_type(), "heatingTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(pumpModMax), this->device_type(), "pumpModMax", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(pumpModMin), this->device_type(), "pumpModMin", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(pumpDelay), this->device_type(), "pumpDelay", F_(min), nullptr);
Mqtt::register_mqtt_ha_sensor(F_(burnMinPeriod), this->device_type(), "burnMinPeriod", F_(min), nullptr);
Mqtt::register_mqtt_ha_sensor(F_(burnMinPower), this->device_type(), "burnMinPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(burnMaxPower), this->device_type(), "burnMaxPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(boilHystOn), this->device_type(), "boilHystOn", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(boilHystOff), this->device_type(), "boilHystOff", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(setFlowTemp), this->device_type(), "setFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWSetPumpPower), this->device_type(), "wWSetPumpPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(wwMixTemperature), this->device_type(), "wwMixTemperature", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wwBufferBoilerTemperature), this->device_type(), "wwBufferBoilerTemperature", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(F_(wWStarts), this->device_type(), "wWStarts", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(wWWorkM), this->device_type(), "wWWorkM", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(F_(setBurnPow), this->device_type(), "setBurnPow", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(F_(burnStarts), this->device_type(), "burnStarts", nullptr, nullptr);
*/
}
bool Boiler::command_info(const char * value, const int8_t id, JsonObject & output) {
@@ -145,14 +266,17 @@ bool Boiler::command_info(const char * value, const int8_t id, JsonObject & outp
bool Boiler::export_values(JsonObject & output) {
char s[10]; // for formatting strings
// Hot tap water bool
if (Helpers::hasValue(heating_active_, EMS_VALUE_BOOL)) {
output["heating_active"] = Helpers::render_value(s, heating_active_, EMS_VALUE_BOOL);
output["heatingActive"] = Helpers::render_value(s, heating_active_, EMS_VALUE_BOOL);
}
// Central heating bool
if (Helpers::hasValue(tap_water_active_, EMS_VALUE_BOOL)) {
output["tap_water_active"] = Helpers::render_value(s, tap_water_active_, EMS_VALUE_BOOL);
output["tapwaterActive"] = Helpers::render_value(s, tap_water_active_, EMS_VALUE_BOOL);
}
// Warm Water comfort setting
if (Helpers::hasValue(wWComfort_)) {
if (wWComfort_ == 0x00) {
output["wWComfort"] = "Hot";
@@ -163,30 +287,47 @@ bool Boiler::export_values(JsonObject & output) {
}
}
// Warm Water selected temperature
if (Helpers::hasValue(wWSelTemp_)) {
output["wWSelTemp"] = wWSelTemp_;
}
// Warm Water set temperature
if (Helpers::hasValue(wWSetTmp_)) {
output["wWSetTemp"] = wWSetTmp_;
}
// Warm Water disinfection temperature
if (Helpers::hasValue(wWDisinfectTemp_)) {
output["wWDisinfectionTemp"] = wWDisinfectTemp_;
}
// Selected flow temperature deg
if (Helpers::hasValue(selFlowTemp_)) {
output["selFlowTemp"] = selFlowTemp_;
}
// Burner selected max power %
if (Helpers::hasValue(selBurnPow_)) {
output["selBurnPow"] = selBurnPow_;
}
// Burner current power %
if (Helpers::hasValue(curBurnPow_)) {
output["curBurnPow"] = curBurnPow_;
}
// Pump modulation %
if (Helpers::hasValue(pumpMod_)) {
output["pumpMod"] = pumpMod_;
}
// Heat Pump modulation %
if (Helpers::hasValue(pumpMod2_)) {
output["pumpMod2"] = pumpMod2_;
}
// Warm Water type
if (wWType_ == 0) { // no output if not set
output["wWType"] = F("off");
} else if (wWType_ == 1) {
@@ -198,147 +339,269 @@ bool Boiler::export_values(JsonObject & output) {
} else if (wWType_ == 4) {
output["wWType"] = F("layered buffer");
}
// Warm Water charging type
if (Helpers::hasValue(wWChargeType_, EMS_VALUE_BOOL)) {
output["wWChargeType"] = wWChargeType_ ? "valve" : "pump";
output["wWChargeType"] = wWChargeType_ ? "3-way valve" : "charge pump";
}
// Warm Water circulation pump available bool
if (Helpers::hasValue(wWCircPump_, EMS_VALUE_BOOL)) {
output["wWCircPump"] = Helpers::render_value(s, wWCircPump_, EMS_VALUE_BOOL);
}
// Warm Water circulation pump freq
if (Helpers::hasValue(wWCircPumpMode_)) {
output["wWCiPuMode"] = wWCircPumpMode_;
if (wWCircPumpMode_ == 7) {
output["wWCiPuMode"] = F("continuous");
} else {
char s[7];
char buffer[2];
buffer[0] = (wWCircPumpMode_ % 10) + '0';
buffer[1] = '\0';
strlcpy(s, buffer, 7);
strlcat(s, "x3min", 7);
output["wWCiPuMode"] = s;
}
}
// Warm Water circulation active bool
if (Helpers::hasValue(wWCirc_, EMS_VALUE_BOOL)) {
output["wWCirc"] = Helpers::render_value(s, wWCirc_, EMS_VALUE_BOOL);
}
// Outside temperature
if (Helpers::hasValue(extTemp_)) {
output["outdoorTemp"] = (float)extTemp_ / 10;
}
// Warm Water current temperature (intern)
if (Helpers::hasValue(wWCurTmp_)) {
output["wWCurTmp"] = (float)wWCurTmp_ / 10;
}
// Warm Water current temperature (extern)
if (Helpers::hasValue(wWCurTmp2_)) {
output["wWCurTmp2"] = (float)wWCurTmp2_ / 10;
}
// Warm Water current tap water flow l/min
if (Helpers::hasValue(wWCurFlow_)) {
output["wWCurFlow"] = (float)wWCurFlow_ / 10;
}
// Current flow temperature
if (Helpers::hasValue(curFlowTemp_)) {
output["curFlowTemp"] = (float)curFlowTemp_ / 10;
}
// Return temperature
if (Helpers::hasValue(retTemp_)) {
output["retTemp"] = (float)retTemp_ / 10;
}
// Mixing switch temperature
if (Helpers::hasValue(switchTemp_)) {
output["switchTemp"] = (float)switchTemp_ / 10;
}
// System pressure
if (Helpers::hasValue(sysPress_)) {
output["sysPress"] = (float)sysPress_ / 10;
}
// Max boiler temperature
if (Helpers::hasValue(boilTemp_)) {
output["boilTemp"] = (float)boilTemp_ / 10;
}
// Warm water storage temperature (intern)
if (Helpers::hasValue(wwStorageTemp1_)) {
output["wwStorageTemp1"] = (float)wwStorageTemp1_ / 10;
}
// Warm water storage temperature (extern)
if (Helpers::hasValue(wwStorageTemp2_)) {
output["wwStorageTemp2"] = (float)wwStorageTemp2_ / 10;
}
// Exhaust temperature
if (Helpers::hasValue(exhaustTemp_)) {
output["exhaustTemp"] = (float)exhaustTemp_ / 10;
}
// Warm Water activated bool
if (Helpers::hasValue(wWActivated_, EMS_VALUE_BOOL)) {
output["wWActivated"] = Helpers::render_value(s, wWActivated_, EMS_VALUE_BOOL);
}
// Warm Water one time charging bool
if (Helpers::hasValue(wWOneTime_, EMS_VALUE_BOOL)) {
output["wWOnetime"] = Helpers::render_value(s, wWOneTime_, EMS_VALUE_BOOL);
}
// Warm Water disinfecting bool
if (Helpers::hasValue(wWDisinfecting_, EMS_VALUE_BOOL)) {
output["wWDisinfecting"] = Helpers::render_value(s, wWDisinfecting_, EMS_VALUE_BOOL);
}
// Warm water charging bool
if (Helpers::hasValue(wWCharging_, EMS_VALUE_BOOL)) {
output["wWCharge"] = Helpers::render_value(s, wWCharging_, EMS_VALUE_BOOL);
}
// Warm water recharge bool
if (Helpers::hasValue(wWRecharging_, EMS_VALUE_BOOL)) {
output["wWRecharge"] = Helpers::render_value(s, wWRecharging_, EMS_VALUE_BOOL);
}
// Warm water temperature ok bool
if (Helpers::hasValue(wWTemperatureOK_, EMS_VALUE_BOOL)) {
output["wWTempOK"] = Helpers::render_value(s, wWTemperatureOK_, EMS_VALUE_BOOL);
}
// Warm water active bool
if (Helpers::hasValue(wWActive_, EMS_VALUE_BOOL)) {
output["wWActive"] = Helpers::render_value(s, wWActive_, EMS_VALUE_BOOL);
}
// Gas bool
if (Helpers::hasValue(burnGas_, EMS_VALUE_BOOL)) {
output["burnGas"] = Helpers::render_value(s, burnGas_, EMS_VALUE_BOOL);
}
// Flame current uA
if (Helpers::hasValue(flameCurr_)) {
output["flameCurr"] = (float)(int16_t)flameCurr_ / 10;
}
// Boiler pump bool
if (Helpers::hasValue(heatPmp_, EMS_VALUE_BOOL)) {
output["heatPump"] = Helpers::render_value(s, heatPmp_, EMS_VALUE_BOOL);
}
// Fan bool
if (Helpers::hasValue(fanWork_, EMS_VALUE_BOOL)) {
output["fanWork"] = Helpers::render_value(s, fanWork_, EMS_VALUE_BOOL);
}
// Ignition bool
if (Helpers::hasValue(ignWork_, EMS_VALUE_BOOL)) {
output["ignWork"] = Helpers::render_value(s, ignWork_, EMS_VALUE_BOOL);
}
// Warm Water charging bool
if (Helpers::hasValue(wWHeat_, EMS_VALUE_BOOL)) {
output["wWHeat"] = Helpers::render_value(s, wWHeat_, EMS_VALUE_BOOL);
}
// heating activated bool
if (Helpers::hasValue(heating_activated_, EMS_VALUE_BOOL)) {
output["heatingActivated"] = Helpers::render_value(s, heating_activated_, EMS_VALUE_BOOL);
}
// Heating temperature setting on the boiler
if (Helpers::hasValue(heating_temp_)) {
output["heatingTemp"] = heating_temp_;
}
// Boiler circuit pump modulation max power %
if (Helpers::hasValue(pump_mod_max_)) {
output["pumpModMax"] = pump_mod_max_;
}
// Boiler circuit pump modulation min power %
if (Helpers::hasValue(pump_mod_min_)) {
output["pumpModMin"] = pump_mod_min_;
}
// Boiler circuit pump delay time min
if (Helpers::hasValue(pumpDelay_)) {
output["pumpDelay"] = pumpDelay_;
}
// Boiler burner min period min
if (Helpers::hasValue(burnPeriod_)) {
output["burnMinPeriod"] = burnPeriod_;
}
// Boiler burner min power %
if (Helpers::hasValue(burnPowermin_)) {
output["burnMinPower"] = burnPowermin_;
}
// Boiler burner max power %
if (Helpers::hasValue(burnPowermax_)) {
output["burnMaxPower"] = burnPowermax_;
}
// Boiler temp hysteresis on degrees
if (Helpers::hasValue(boilTemp_on_)) {
output["boilHystOn"] = boilTemp_on_;
}
// Boiler temp hysteresis off degrees
if (Helpers::hasValue(boilTemp_off_)) {
output["boilHystOff"] = boilTemp_off_;
}
// Set Flow temperature
if (Helpers::hasValue(setFlowTemp_)) {
output["setFlowTemp"] = setFlowTemp_;
}
// Warm Water pump set power %
if (Helpers::hasValue(setWWPumpPow_)) {
output["wWSetPumpPower"] = setWWPumpPow_;
}
// Warm water mix temperature
if (Helpers::hasValue(wwMixTemperature_)) {
output["wwMixTemperature"] = wwMixTemperature_;
}
// Warm water buffer boiler temperature
if (Helpers::hasValue(wwBufferBoilerTemperature_)) {
output["wwBufferBoilerTemperature"] = wwBufferBoilerTemperature_;
}
// Warm Water # starts
if (Helpers::hasValue(wWStarts_)) {
output["wWStarts"] = wWStarts_;
}
// Warm Water active time
if (Helpers::hasValue(wWWorkM_)) {
output["wWWorkM"] = wWWorkM_;
}
// Total UBA working time
if (Helpers::hasValue(UBAuptime_)) {
output["UBAuptime"] = UBAuptime_;
}
// Boiler burner set power %
if (Helpers::hasValue(setBurnPow_)) {
output["setBurnPow_"] = setBurnPow_;
}
// Burner # starts
if (Helpers::hasValue(burnStarts_)) {
output["burnStarts"] = burnStarts_;
}
// Total burner operating time
if (Helpers::hasValue(burnWorkMin_)) {
output["burnWorkMin"] = burnWorkMin_;
}
// Total heat operating time
if (Helpers::hasValue(heatWorkMin_)) {
output["heatWorkMin"] = heatWorkMin_;
}
// Service Code
// Service Code Number
if (Helpers::hasValue(serviceCode_)) {
output["serviceCode"] = serviceCodeChar_;
output["serviceCodeNumber"] = serviceCode_;
@@ -372,113 +635,78 @@ bool Boiler::updated_values() {
void Boiler::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // for showing the header
print_value(shell, 2, F("Hot tap water"), tap_water_active_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 2, F("Central heating"), heating_active_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 2, F("Warm Water activated"), wWActivated_, nullptr, EMS_VALUE_BOOL);
if (wWType_ == 0) {
print_value(shell, 2, F("Warm Water type"), F("off"));
} else if (wWType_ == 1) {
print_value(shell, 2, F("Warm Water type"), F("flow"));
} else if (wWType_ == 2) {
print_value(shell, 2, F("Warm Water type"), F("buffered flow"));
} else if (wWType_ == 3) {
print_value(shell, 2, F("Warm Water type"), F("buffer"));
} else if (wWType_ == 4) {
print_value(shell, 2, F("Warm Water type"), F("layered buffer"));
// fetch the values into a JSON document
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_LARGE> doc;
JsonObject output = doc.to<JsonObject>();
if (!export_values(output)) {
return; // empty
}
if (Helpers::hasValue(wWChargeType_, EMS_VALUE_BOOL)) {
print_value(shell, 2, F("Warm Water charging type"), wWChargeType_ ? F("3-way valve") : F("charge pump"));
}
print_value_json(shell, F("heatingActive"), F_(heatingActive), nullptr, output);
print_value_json(shell, F("tapwaterActive"), F_(tapwaterActive), nullptr, output);
print_value_json(shell, F("serviceCode"), F_(serviceCode), nullptr, output);
print_value_json(shell, F("serviceCodeNumber"), F_(serviceCodeNumber), nullptr, output);
print_value_json(shell, F("wWSelTemp"), F_(wWSelTemp), F_(degrees), output);
print_value_json(shell, F("wWSetTemp"), F_(wWSetTemp), F_(degrees), output);
print_value_json(shell, F("wWDisinfectionTemp"), F_(wWDisinfectionTemp), F_(degrees), output);
print_value_json(shell, F("selFlowTemp"), F_(selFlowTemp), F_(degrees), output);
print_value_json(shell, F("selBurnPow"), F_(selBurnPow), F_(percent), output);
print_value_json(shell, F("curBurnPow"), F_(curBurnPow), F_(percent), output);
print_value_json(shell, F("pumpMod"), F_(pumpMod), F_(percent), output);
print_value_json(shell, F("pumpMod2"), F_(pumpMod2), F_(percent), output);
print_value_json(shell, F("wWType"), F_(wWType), nullptr, output);
print_value_json(shell, F("wWChargeType"), F_(wWChargeType), nullptr, output);
print_value_json(shell, F("wWCircPump"), F_(wWCircPump), nullptr, output);
print_value_json(shell, F("wWCiPuMode"), F_(wWCiPuMode), nullptr, output);
print_value_json(shell, F("wWCirc"), F_(wWCirc), nullptr, output);
print_value_json(shell, F("outdoorTemp"), F_(outdoorTemp), F_(degrees), output);
print_value_json(shell, F("wWCurTmp"), F_(wWCurTmp), F_(degrees), output);
print_value_json(shell, F("wWCurTmp2"), F_(wWCurTmp2), F_(degrees), output);
print_value_json(shell, F("wWCurFlow"), F_(wWCurFlow), F("l/min"), output);
print_value_json(shell, F("curFlowTemp"), F_(curFlowTemp), F_(degrees), output);
print_value_json(shell, F("retTemp"), F_(retTemp), F_(degrees), output);
print_value_json(shell, F("switchTemp"), F_(switchTemp), F_(degrees), output);
print_value_json(shell, F("sysPress"), F_(sysPress), nullptr, output);
print_value_json(shell, F("boilTemp"), F_(boilTemp), F_(degrees), output);
print_value_json(shell, F("wwStorageTemp1"), F_(wwStorageTemp1), F_(degrees), output);
print_value_json(shell, F("wwStorageTemp2"), F_(wwStorageTemp2), F_(degrees), output);
print_value_json(shell, F("exhaustTemp"), F_(exhaustTemp), F_(degrees), output);
print_value_json(shell, F("wWActivated"), F_(wWActivated), nullptr, output);
print_value_json(shell, F("wWOnetime"), F_(wWOnetime), nullptr, output);
print_value_json(shell, F("wWDisinfecting"), F_(wWDisinfecting), nullptr, output);
print_value_json(shell, F("wWCharge"), F_(wWCharge), nullptr, output);
print_value_json(shell, F("wWRecharge"), F_(wWRecharge), nullptr, output);
print_value_json(shell, F("wWTempOK"), F_(wWTempOK), nullptr, output);
print_value_json(shell, F("wWActive"), F_(wWActive), nullptr, output);
print_value_json(shell, F("burnGas"), F_(burnGas), nullptr, output);
print_value_json(shell, F("flameCurr"), F_(flameCurr), F_(uA), output);
print_value_json(shell, F("heatPump"), F_(heatPump), nullptr, output);
print_value_json(shell, F("fanWork"), F_(fanWork), nullptr, output);
print_value_json(shell, F("ignWork"), F_(ignWork), nullptr, output);
print_value_json(shell, F("wWHeat"), F_(wWHeat), nullptr, output);
print_value_json(shell, F("heatingActivated"), F_(heatingActivated), nullptr, output);
print_value_json(shell, F("heatingTemp"), F_(heatingTemp), F_(degrees), output);
print_value_json(shell, F("pumpModMax"), F_(pumpModMax), F_(percent), output);
print_value_json(shell, F("pumpModMin"), F_(pumpModMin), F_(percent), output);
print_value_json(shell, F("pumpDelay"), F_(pumpDelay), F_(min), output);
print_value_json(shell, F("burnMinPeriod"), F_(burnMinPeriod), F_(min), output);
print_value_json(shell, F("burnMinPower"), F_(burnMinPower), F_(percent), output);
print_value_json(shell, F("burnMaxPower"), F_(burnMaxPower), F_(percent), output);
print_value_json(shell, F("boilHystOn"), F_(boilHystOn), F_(degrees), output);
print_value_json(shell, F("boilHystOff"), F_(boilHystOff), F_(degrees), output);
print_value_json(shell, F("setFlowTemp"), F_(setFlowTemp), F_(degrees), output);
print_value_json(shell, F("wWSetPumpPower"), F_(wWSetPumpPower), F_(percent), output);
print_value_json(shell, F("wwMixTemperature"), F_(wwMixTemperature), F_(degrees), output);
print_value_json(shell, F("wwBufferBoilerTemperature"), F_(wwBufferBoilerTemperature), F_(degrees), output);
print_value_json(shell, F("wWStarts"), F_(wWStarts), nullptr, output);
print_value_json(shell, F("wWWorkM"), F_(wWWorkM), nullptr, output);
print_value_json(shell, F("setBurnPow"), F_(setBurnPow), F_(percent), output);
print_value_json(shell, F("burnStarts"), F_(burnStarts), nullptr, output);
print_value(shell, 2, F("Warm Water circulation pump available"), wWCircPump_, nullptr, EMS_VALUE_BOOL);
if (Helpers::hasValue(wWCircPumpMode_)) {
if (wWCircPumpMode_ == 7) {
print_value(shell, 2, F("Warm Water circulation pump freq"), F("continuous"));
} else {
char s[7];
char buffer[2];
buffer[0] = (wWCircPumpMode_ % 10) + '0';
buffer[1] = '\0';
strlcpy(s, buffer, 7);
strlcat(s, "x3min", 7);
print_value(shell, 2, F("Warm Water circulation pump freq"), s);
}
}
print_value(shell, 2, F("Warm Water circulation active"), wWCirc_, nullptr, EMS_VALUE_BOOL);
if (wWComfort_ == 0x00) {
print_value(shell, 2, F("Warm Water comfort setting"), F("Hot"));
} else if (wWComfort_ == 0xD8) {
print_value(shell, 2, F("Warm Water comfort setting"), F("Eco"));
} else if (wWComfort_ == 0xEC) {
print_value(shell, 2, F("Warm Water comfort setting"), F("Intelligent"));
}
print_value(shell, 2, F("Warm water mix temperature"), wwMixTemperature_, F_(degrees), 10);
print_value(shell, 2, F("Warm water buffer boiler temperature"), wwBufferBoilerTemperature_, F_(degrees), 10);
print_value(shell, 2, F("Warm Water disinfection temperature"), wWDisinfectTemp_, F_(degrees));
print_value(shell, 2, F("Warm Water selected temperature"), wWSelTemp_, F_(degrees));
print_value(shell, 2, F("Warm Water set temperature"), wWSetTmp_, F_(degrees));
print_value(shell, 2, F("Warm Water current temperature (intern)"), wWCurTmp_, F_(degrees), 10);
print_value(shell, 2, F("Warm water storage temperature (intern)"), wwStorageTemp1_, F_(degrees), 10);
print_value(shell, 2, F("Warm Water current temperature (extern)"), wWCurTmp2_, F_(degrees), 10);
print_value(shell, 2, F("Warm water storage temperature (extern)"), wwStorageTemp2_, F_(degrees), 10);
print_value(shell, 2, F("Warm Water current tap water flow"), wWCurFlow_, F("l/min"), 10);
print_value(shell, 2, F("Warm Water # starts"), wWStarts_, nullptr);
if (Helpers::hasValue(wWWorkM_)) {
shell.printfln(F(" Warm Water active time: %d days %d hours %d minutes"), wWWorkM_ / 1440, (wWWorkM_ % 1440) / 60, wWWorkM_ % 60);
}
print_value(shell, 2, F("Warm Water one time charging"), wWOneTime_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 2, F("Warm Water charging"), wWHeat_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 2, F("Warm Water disinfecting"), wWDisinfecting_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 2, F("Selected flow temperature"), selFlowTemp_, F_(degrees));
print_value(shell, 2, F("Current flow temperature"), curFlowTemp_, F_(degrees), 10);
print_value(shell, 2, F("Max boiler temperature"), boilTemp_, F_(degrees), 10);
print_value(shell, 2, F("Return temperature"), retTemp_, F_(degrees), 10);
print_value(shell, 2, F("Gas"), burnGas_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 2, F("Boiler pump"), heatPmp_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 2, F("Fan"), fanWork_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 2, F("Ignition"), ignWork_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 2, F("Burner selected max power"), selBurnPow_, F_(percent));
print_value(shell, 2, F("Burner current power"), curBurnPow_, F_(percent));
print_value(shell, 2, F("Flame current"), flameCurr_, F_(uA), 10);
print_value(shell, 2, F("System pressure"), sysPress_, F_(bar), 10);
if (Helpers::hasValue(serviceCode_)) {
shell.printfln(F(" System service code: %s (%d)"), serviceCodeChar_, serviceCode_);
} else if (serviceCodeChar_[0] != '\0') {
print_value(shell, 2, F("System service code"), serviceCodeChar_);
}
// UBAParameters
print_value(shell, 2, F("Heating activated"), heating_activated_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 2, F("Heating temperature setting on the boiler"), heating_temp_, F_(degrees));
print_value(shell, 2, F("Boiler circuit pump modulation max power"), pump_mod_max_, F_(percent));
print_value(shell, 2, F("Boiler circuit pump modulation min power"), pump_mod_min_, F_(percent));
print_value(shell, 2, F("Boiler circuit pump delay time"), pumpDelay_, F_(min));
print_value(shell, 2, F("Boiler temp hysteresis on"), boilTemp_on_, F_(degrees));
print_value(shell, 2, F("Boiler temp hysteresis off"), boilTemp_off_, F_(degrees));
print_value(shell, 2, F("Boiler burner min period"), burnPeriod_, F_(min));
print_value(shell, 2, F("Boiler burner min power"), burnPowermin_, F_(percent));
print_value(shell, 2, F("Boiler burner max power"), burnPowermax_, F_(percent));
// UBASetPoint - these may differ from the above
print_value(shell, 2, F("Set Flow temperature"), setFlowTemp_, F_(degrees));
print_value(shell, 2, F("Boiler burner set power"), setBurnPow_, F_(percent));
print_value(shell, 2, F("Warm Water pump set power"), setWWPumpPow_, F_(percent));
// UBAMonitorSlow
if (Helpers::hasValue(extTemp_)) {
print_value(shell, 2, F("Outside temperature"), extTemp_, F_(degrees), 10);
}
print_value(shell, 2, F("Exhaust temperature"), exhaustTemp_, F_(degrees), 10);
print_value(shell, 2, F("Pump modulation"), pumpMod_, F_(percent));
print_value(shell, 2, F("Heat Pump modulation"), pumpMod2_, F_(percent));
print_value(shell, 2, F("Burner # starts"), burnStarts_, nullptr);
if (Helpers::hasValue(burnWorkMin_)) {
shell.printfln(F(" Total burner operating time: %d days %d hours %d minutes"), burnWorkMin_ / 1440, (burnWorkMin_ % 1440) / 60, burnWorkMin_ % 60);
}