mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-29 10:09:11 +03:00
rename output to json, implement export_values for info command
This commit is contained in:
@@ -70,12 +70,6 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
||||
register_mqtt_cmd(F("boilhystoff"), [&](const char * value, const int8_t id) { return set_hyst_off(value, id); });
|
||||
register_mqtt_cmd(F("burnperiod"), [&](const char * value, const int8_t id) { return set_burn_period(value, id); });
|
||||
register_mqtt_cmd(F("pumpdelay"), [&](const char * value, const int8_t id) { return set_pump_delay(value, id); });
|
||||
|
||||
// API call
|
||||
// Command::add_with_json(this->device_type(), F("info"), Boiler::command_info);
|
||||
Command::add_with_json(this->device_type(), F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
||||
return command_info(value, id, object);
|
||||
});
|
||||
}
|
||||
|
||||
// create the config topics for Home Assistant MQTT Discovery
|
||||
@@ -180,142 +174,142 @@ void Boiler::register_mqtt_ha_config(bool force) {
|
||||
void Boiler::device_info_web(JsonArray & root) {
|
||||
// fetch the values into a JSON document
|
||||
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (!export_values_main(output)) {
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
if (!export_values_main(json)) {
|
||||
return; // empty
|
||||
}
|
||||
export_values_ww(output); // append ww values
|
||||
export_values_ww(json); // append ww values
|
||||
|
||||
print_value_json(root, F("heatingActive"), nullptr, F_(heatingActive), nullptr, output);
|
||||
print_value_json(root, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, output);
|
||||
print_value_json(root, F("serviceCode"), nullptr, F_(serviceCode), nullptr, output);
|
||||
print_value_json(root, F("serviceCodeNumber"), nullptr, F_(serviceCodeNumber), nullptr, output);
|
||||
print_value_json(root, F("selFlowTemp"), nullptr, F_(selFlowTemp), F_(degrees), output);
|
||||
print_value_json(root, F("selBurnPow"), nullptr, F_(selBurnPow), F_(percent), output);
|
||||
print_value_json(root, F("curBurnPow"), nullptr, F_(curBurnPow), F_(percent), output);
|
||||
print_value_json(root, F("pumpMod"), nullptr, F_(pumpMod), F_(percent), output);
|
||||
print_value_json(root, F("pumpMod2"), nullptr, F_(pumpMod2), F_(percent), output);
|
||||
print_value_json(root, F("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), output);
|
||||
print_value_json(root, F("curFlowTemp"), nullptr, F_(curFlowTemp), F_(degrees), output);
|
||||
print_value_json(root, F("retTemp"), nullptr, F_(retTemp), F_(degrees), output);
|
||||
print_value_json(root, F("switchTemp"), nullptr, F_(switchTemp), F_(degrees), output);
|
||||
print_value_json(root, F("sysPress"), nullptr, F_(sysPress), nullptr, output);
|
||||
print_value_json(root, F("boilTemp"), nullptr, F_(boilTemp), F_(degrees), output);
|
||||
print_value_json(root, F("burnGas"), nullptr, F_(burnGas), nullptr, output);
|
||||
print_value_json(root, F("flameCurr"), nullptr, F_(flameCurr), F_(uA), output);
|
||||
print_value_json(root, F("heatPump"), nullptr, F_(heatPump), nullptr, output);
|
||||
print_value_json(root, F("fanWork"), nullptr, F_(fanWork), nullptr, output);
|
||||
print_value_json(root, F("ignWork"), nullptr, F_(ignWork), nullptr, output);
|
||||
print_value_json(root, F("heatingActivated"), nullptr, F_(heatingActivated), nullptr, output);
|
||||
print_value_json(root, F("heatingTemp"), nullptr, F_(heatingTemp), F_(degrees), output);
|
||||
print_value_json(root, F("pumpModMax"), nullptr, F_(pumpModMax), F_(percent), output);
|
||||
print_value_json(root, F("pumpModMin"), nullptr, F_(pumpModMin), F_(percent), output);
|
||||
print_value_json(root, F("pumpDelay"), nullptr, F_(pumpDelay), F_(min), output);
|
||||
print_value_json(root, F("burnMinPeriod"), nullptr, F_(burnMinPeriod), F_(min), output);
|
||||
print_value_json(root, F("burnMinPower"), nullptr, F_(burnMinPower), F_(percent), output);
|
||||
print_value_json(root, F("burnMaxPower"), nullptr, F_(burnMaxPower), F_(percent), output);
|
||||
print_value_json(root, F("boilHystOn"), nullptr, F_(boilHystOn), F_(degrees), output);
|
||||
print_value_json(root, F("boilHystOff"), nullptr, F_(boilHystOff), F_(degrees), output);
|
||||
print_value_json(root, F("setFlowTemp"), nullptr, F_(setFlowTemp), F_(degrees), output);
|
||||
print_value_json(root, F("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), output);
|
||||
print_value_json(root, F("burnStarts"), nullptr, F_(burnStarts), nullptr, output);
|
||||
print_value_json(root, F("heatingActive"), nullptr, F_(heatingActive), nullptr, json);
|
||||
print_value_json(root, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, json);
|
||||
print_value_json(root, F("serviceCode"), nullptr, F_(serviceCode), nullptr, json);
|
||||
print_value_json(root, F("serviceCodeNumber"), nullptr, F_(serviceCodeNumber), nullptr, json);
|
||||
print_value_json(root, F("selFlowTemp"), nullptr, F_(selFlowTemp), F_(degrees), json);
|
||||
print_value_json(root, F("selBurnPow"), nullptr, F_(selBurnPow), F_(percent), json);
|
||||
print_value_json(root, F("curBurnPow"), nullptr, F_(curBurnPow), F_(percent), json);
|
||||
print_value_json(root, F("pumpMod"), nullptr, F_(pumpMod), F_(percent), json);
|
||||
print_value_json(root, F("pumpMod2"), nullptr, F_(pumpMod2), F_(percent), json);
|
||||
print_value_json(root, F("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), json);
|
||||
print_value_json(root, F("curFlowTemp"), nullptr, F_(curFlowTemp), F_(degrees), json);
|
||||
print_value_json(root, F("retTemp"), nullptr, F_(retTemp), F_(degrees), json);
|
||||
print_value_json(root, F("switchTemp"), nullptr, F_(switchTemp), F_(degrees), json);
|
||||
print_value_json(root, F("sysPress"), nullptr, F_(sysPress), nullptr, json);
|
||||
print_value_json(root, F("boilTemp"), nullptr, F_(boilTemp), F_(degrees), json);
|
||||
print_value_json(root, F("burnGas"), nullptr, F_(burnGas), nullptr, json);
|
||||
print_value_json(root, F("flameCurr"), nullptr, F_(flameCurr), F_(uA), json);
|
||||
print_value_json(root, F("heatPump"), nullptr, F_(heatPump), nullptr, json);
|
||||
print_value_json(root, F("fanWork"), nullptr, F_(fanWork), nullptr, json);
|
||||
print_value_json(root, F("ignWork"), nullptr, F_(ignWork), nullptr, json);
|
||||
print_value_json(root, F("heatingActivated"), nullptr, F_(heatingActivated), nullptr, json);
|
||||
print_value_json(root, F("heatingTemp"), nullptr, F_(heatingTemp), F_(degrees), json);
|
||||
print_value_json(root, F("pumpModMax"), nullptr, F_(pumpModMax), F_(percent), json);
|
||||
print_value_json(root, F("pumpModMin"), nullptr, F_(pumpModMin), F_(percent), json);
|
||||
print_value_json(root, F("pumpDelay"), nullptr, F_(pumpDelay), F_(min), json);
|
||||
print_value_json(root, F("burnMinPeriod"), nullptr, F_(burnMinPeriod), F_(min), json);
|
||||
print_value_json(root, F("burnMinPower"), nullptr, F_(burnMinPower), F_(percent), json);
|
||||
print_value_json(root, F("burnMaxPower"), nullptr, F_(burnMaxPower), F_(percent), json);
|
||||
print_value_json(root, F("boilHystOn"), nullptr, F_(boilHystOn), F_(degrees), json);
|
||||
print_value_json(root, F("boilHystOff"), nullptr, F_(boilHystOff), F_(degrees), json);
|
||||
print_value_json(root, F("setFlowTemp"), nullptr, F_(setFlowTemp), F_(degrees), json);
|
||||
print_value_json(root, F("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), json);
|
||||
print_value_json(root, F("burnStarts"), nullptr, F_(burnStarts), nullptr, json);
|
||||
|
||||
// ww
|
||||
print_value_json(root, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), output);
|
||||
print_value_json(root, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), output);
|
||||
print_value_json(root, F("wWDisinfectionTemp"), nullptr, F_(wWDisinfectionTemp), F_(degrees), output);
|
||||
print_value_json(root, F("wWType"), nullptr, F_(wWType), nullptr, output);
|
||||
print_value_json(root, F("wWChargeType"), nullptr, F_(wWChargeType), nullptr, output);
|
||||
print_value_json(root, F("wWCircPump"), nullptr, F_(wWCircPump), nullptr, output);
|
||||
print_value_json(root, F("wWCircPumpMode"), nullptr, F_(wWCircPumpMode), nullptr, output);
|
||||
print_value_json(root, F("wWCirc"), nullptr, F_(wWCirc), nullptr, output);
|
||||
print_value_json(root, F("wWCurTemp"), nullptr, F_(wWCurTemp), F_(degrees), output);
|
||||
print_value_json(root, F("wWCurTemp2"), nullptr, F_(wWCurTemp2), F_(degrees), output);
|
||||
print_value_json(root, F("wWCurFlow"), nullptr, F_(wWCurFlow), F("l/min"), output);
|
||||
print_value_json(root, F("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), output);
|
||||
print_value_json(root, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), F_(degrees), output);
|
||||
print_value_json(root, F("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), output);
|
||||
print_value_json(root, F("wWActivated"), nullptr, F_(wWActivated), nullptr, output);
|
||||
print_value_json(root, F("wWOneTime"), nullptr, F_(wWOneTime), nullptr, output);
|
||||
print_value_json(root, F("wWDisinfecting"), nullptr, F_(wWDisinfecting), nullptr, output);
|
||||
print_value_json(root, F("wWCharging"), nullptr, F_(wWCharging), nullptr, output);
|
||||
print_value_json(root, F("wWRecharging"), nullptr, F_(wWRecharging), nullptr, output);
|
||||
print_value_json(root, F("wWTempOK"), nullptr, F_(wWTempOK), nullptr, output);
|
||||
print_value_json(root, F("wWActive"), nullptr, F_(wWActive), nullptr, output);
|
||||
print_value_json(root, F("wWHeat"), nullptr, F_(wWHeat), nullptr, output);
|
||||
print_value_json(root, F("wWSetPumpPower"), nullptr, F_(wWSetPumpPower), F_(percent), output);
|
||||
print_value_json(root, F("wwMixTemperature"), nullptr, F_(wwMixTemperature), F_(degrees), output);
|
||||
print_value_json(root, F("wwBufferTemperature"), nullptr, F_(wwBufferTemperature), F_(degrees), output);
|
||||
print_value_json(root, F("wWStarts"), nullptr, F_(wWStarts), nullptr, output);
|
||||
print_value_json(root, F("wWWorkM"), nullptr, F_(wWWorkM), nullptr, output);
|
||||
print_value_json(root, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), json);
|
||||
print_value_json(root, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), json);
|
||||
print_value_json(root, F("wWDisinfectionTemp"), nullptr, F_(wWDisinfectionTemp), F_(degrees), json);
|
||||
print_value_json(root, F("wWType"), nullptr, F_(wWType), nullptr, json);
|
||||
print_value_json(root, F("wWChargeType"), nullptr, F_(wWChargeType), nullptr, json);
|
||||
print_value_json(root, F("wWCircPump"), nullptr, F_(wWCircPump), nullptr, json);
|
||||
print_value_json(root, F("wWCircPumpMode"), nullptr, F_(wWCircPumpMode), nullptr, json);
|
||||
print_value_json(root, F("wWCirc"), nullptr, F_(wWCirc), nullptr, json);
|
||||
print_value_json(root, F("wWCurTemp"), nullptr, F_(wWCurTemp), F_(degrees), json);
|
||||
print_value_json(root, F("wWCurTemp2"), nullptr, F_(wWCurTemp2), F_(degrees), json);
|
||||
print_value_json(root, F("wWCurFlow"), nullptr, F_(wWCurFlow), F("l/min"), json);
|
||||
print_value_json(root, F("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), json);
|
||||
print_value_json(root, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), F_(degrees), json);
|
||||
print_value_json(root, F("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), json);
|
||||
print_value_json(root, F("wWActivated"), nullptr, F_(wWActivated), nullptr, json);
|
||||
print_value_json(root, F("wWOneTime"), nullptr, F_(wWOneTime), nullptr, json);
|
||||
print_value_json(root, F("wWDisinfecting"), nullptr, F_(wWDisinfecting), nullptr, json);
|
||||
print_value_json(root, F("wWCharging"), nullptr, F_(wWCharging), nullptr, json);
|
||||
print_value_json(root, F("wWRecharging"), nullptr, F_(wWRecharging), nullptr, json);
|
||||
print_value_json(root, F("wWTempOK"), nullptr, F_(wWTempOK), nullptr, json);
|
||||
print_value_json(root, F("wWActive"), nullptr, F_(wWActive), nullptr, json);
|
||||
print_value_json(root, F("wWHeat"), nullptr, F_(wWHeat), nullptr, json);
|
||||
print_value_json(root, F("wWSetPumpPower"), nullptr, F_(wWSetPumpPower), F_(percent), json);
|
||||
print_value_json(root, F("wwMixTemperature"), nullptr, F_(wwMixTemperature), F_(degrees), json);
|
||||
print_value_json(root, F("wwBufferTemperature"), nullptr, F_(wwBufferTemperature), F_(degrees), json);
|
||||
print_value_json(root, F("wWStarts"), nullptr, F_(wWStarts), nullptr, json);
|
||||
print_value_json(root, F("wWWorkM"), nullptr, F_(wWWorkM), nullptr, json);
|
||||
}
|
||||
|
||||
bool Boiler::command_info(const char * value, const int8_t id, JsonObject & output) {
|
||||
if (!export_values_main(output)) {
|
||||
bool Boiler::export_values(JsonObject & json) {
|
||||
if (!export_values_main(json)) {
|
||||
return false;
|
||||
}
|
||||
export_values_ww(output); // append ww values
|
||||
export_values_ww(json); // append ww values
|
||||
return true;
|
||||
}
|
||||
|
||||
// creates JSON doc from values
|
||||
// returns false if empty
|
||||
bool Boiler::export_values_ww(JsonObject & output) {
|
||||
bool Boiler::export_values_ww(JsonObject & json) {
|
||||
char s[10]; // for formatting strings
|
||||
|
||||
// Warm Water comfort setting
|
||||
if (Helpers::hasValue(wWComfort_)) {
|
||||
if (wWComfort_ == 0x00) {
|
||||
output["wWComfort"] = F("Hot");
|
||||
json["wWComfort"] = F("Hot");
|
||||
} else if (wWComfort_ == 0xD8) {
|
||||
output["wWComfort"] = F("Eco");
|
||||
json["wWComfort"] = F("Eco");
|
||||
} else if (wWComfort_ == 0xEC) {
|
||||
output["wWComfort"] = F("Intelligent");
|
||||
json["wWComfort"] = F("Intelligent");
|
||||
}
|
||||
}
|
||||
|
||||
// Warm Water selected temperature
|
||||
if (Helpers::hasValue(wWSelTemp_)) {
|
||||
output["wWSelTemp"] = wWSelTemp_;
|
||||
json["wWSelTemp"] = wWSelTemp_;
|
||||
}
|
||||
|
||||
// Warm Water set temperature
|
||||
if (Helpers::hasValue(wWSetTemp_)) {
|
||||
output["wWSetTemp"] = wWSetTemp_;
|
||||
json["wWSetTemp"] = wWSetTemp_;
|
||||
}
|
||||
|
||||
// Warm Water disinfection temperature
|
||||
if (Helpers::hasValue(wWDisinfectionTemp_)) {
|
||||
output["wWDisinfectionTemp"] = wWDisinfectionTemp_;
|
||||
json["wWDisinfectionTemp"] = wWDisinfectionTemp_;
|
||||
}
|
||||
|
||||
// Warm Water type
|
||||
if (wWType_ == 0) { // no output if not set
|
||||
output["wWType"] = F("off");
|
||||
if (wWType_ == 0) { // no json if not set
|
||||
json["wWType"] = F("off");
|
||||
} else if (wWType_ == 1) {
|
||||
output["wWType"] = F("flow");
|
||||
json["wWType"] = F("flow");
|
||||
} else if (wWType_ == 2) {
|
||||
output["wWType"] = F("buffered flow");
|
||||
json["wWType"] = F("buffered flow");
|
||||
} else if (wWType_ == 3) {
|
||||
output["wWType"] = F("buffer");
|
||||
json["wWType"] = F("buffer");
|
||||
} else if (wWType_ == 4) {
|
||||
output["wWType"] = F("layered buffer");
|
||||
json["wWType"] = F("layered buffer");
|
||||
}
|
||||
|
||||
// Warm Water charging type
|
||||
if (Helpers::hasValue(wWChargeType_, EMS_VALUE_BOOL)) {
|
||||
output["wWChargeType"] = wWChargeType_ ? F("3-way valve") : F("charge pump");
|
||||
json["wWChargeType"] = wWChargeType_ ? F("3-way valve") : F("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);
|
||||
json["wWCircPump"] = Helpers::render_value(s, wWCircPump_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Warm Water circulation pump freq
|
||||
if (Helpers::hasValue(wWCircPumpMode_)) {
|
||||
if (wWCircPumpMode_ == 7) {
|
||||
output["wWCircPumpMode"] = F("continuous");
|
||||
json["wWCircPumpMode"] = F("continuous");
|
||||
} else {
|
||||
char s[7];
|
||||
char buffer[2];
|
||||
@@ -323,313 +317,313 @@ bool Boiler::export_values_ww(JsonObject & output) {
|
||||
buffer[1] = '\0';
|
||||
strlcpy(s, buffer, 7);
|
||||
strlcat(s, "x3min", 7);
|
||||
output["wWCircPumpMode"] = s;
|
||||
json["wWCircPumpMode"] = s;
|
||||
}
|
||||
}
|
||||
|
||||
// Warm Water circulation active bool
|
||||
if (Helpers::hasValue(wWCirc_, EMS_VALUE_BOOL)) {
|
||||
output["wWCirc"] = Helpers::render_value(s, wWCirc_, EMS_VALUE_BOOL);
|
||||
json["wWCirc"] = Helpers::render_value(s, wWCirc_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Warm Water current temperature (intern)
|
||||
if (Helpers::hasValue(wWCurTemp_)) {
|
||||
output["wWCurTemp"] = (float)wWCurTemp_ / 10;
|
||||
json["wWCurTemp"] = (float)wWCurTemp_ / 10;
|
||||
}
|
||||
|
||||
// Warm Water current temperature (extern)
|
||||
if (Helpers::hasValue(wWCurTemp2_)) {
|
||||
output["wWCurTemp2"] = (float)wWCurTemp2_ / 10;
|
||||
json["wWCurTemp2"] = (float)wWCurTemp2_ / 10;
|
||||
}
|
||||
|
||||
// Warm Water current tap water flow l/min
|
||||
if (Helpers::hasValue(wWCurFlow_)) {
|
||||
output["wWCurFlow"] = (float)wWCurFlow_ / 10;
|
||||
json["wWCurFlow"] = (float)wWCurFlow_ / 10;
|
||||
}
|
||||
|
||||
// Warm water storage temperature (intern)
|
||||
if (Helpers::hasValue(wwStorageTemp1_)) {
|
||||
output["wwStorageTemp1"] = (float)wwStorageTemp1_ / 10;
|
||||
json["wwStorageTemp1"] = (float)wwStorageTemp1_ / 10;
|
||||
}
|
||||
|
||||
// Warm water storage temperature (extern)
|
||||
if (Helpers::hasValue(wwStorageTemp2_)) {
|
||||
output["wwStorageTemp2"] = (float)wwStorageTemp2_ / 10;
|
||||
json["wwStorageTemp2"] = (float)wwStorageTemp2_ / 10;
|
||||
}
|
||||
|
||||
// Warm Water activated bool
|
||||
if (Helpers::hasValue(wWActivated_, EMS_VALUE_BOOL)) {
|
||||
output["wWActivated"] = Helpers::render_value(s, wWActivated_, EMS_VALUE_BOOL);
|
||||
json["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);
|
||||
json["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);
|
||||
json["wWDisinfecting"] = Helpers::render_value(s, wWDisinfecting_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Warm water charging bool
|
||||
if (Helpers::hasValue(wWCharging_, EMS_VALUE_BOOL)) {
|
||||
output["wWCharging"] = Helpers::render_value(s, wWCharging_, EMS_VALUE_BOOL);
|
||||
json["wWCharging"] = Helpers::render_value(s, wWCharging_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Warm water recharge bool
|
||||
if (Helpers::hasValue(wWRecharging_, EMS_VALUE_BOOL)) {
|
||||
output["wWRecharging"] = Helpers::render_value(s, wWRecharging_, EMS_VALUE_BOOL);
|
||||
json["wWRecharging"] = Helpers::render_value(s, wWRecharging_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Warm water temperature ok bool
|
||||
if (Helpers::hasValue(wWTempOK_, EMS_VALUE_BOOL)) {
|
||||
output["wWTempOK"] = Helpers::render_value(s, wWTempOK_, EMS_VALUE_BOOL);
|
||||
json["wWTempOK"] = Helpers::render_value(s, wWTempOK_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Warm water active bool
|
||||
if (Helpers::hasValue(wWActive_, EMS_VALUE_BOOL)) {
|
||||
output["wWActive"] = Helpers::render_value(s, wWActive_, EMS_VALUE_BOOL);
|
||||
json["wWActive"] = Helpers::render_value(s, wWActive_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Warm Water charging bool
|
||||
if (Helpers::hasValue(wWHeat_, EMS_VALUE_BOOL)) {
|
||||
output["wWHeat"] = Helpers::render_value(s, wWHeat_, EMS_VALUE_BOOL);
|
||||
json["wWHeat"] = Helpers::render_value(s, wWHeat_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Warm Water pump set power %
|
||||
if (Helpers::hasValue(wWSetPumpPower_)) {
|
||||
output["wWSetPumpPower"] = wWSetPumpPower_;
|
||||
json["wWSetPumpPower"] = wWSetPumpPower_;
|
||||
}
|
||||
|
||||
// Warm water mix temperature
|
||||
if (Helpers::hasValue(wwMixTemperature_)) {
|
||||
output["wwMixTemperature"] = wwMixTemperature_;
|
||||
json["wwMixTemperature"] = wwMixTemperature_;
|
||||
}
|
||||
|
||||
// Warm water buffer boiler temperature
|
||||
if (Helpers::hasValue(wwBufferTemperature_)) {
|
||||
output["wwBufferTemperature"] = wwBufferTemperature_;
|
||||
json["wwBufferTemperature"] = wwBufferTemperature_;
|
||||
}
|
||||
|
||||
// Warm Water # starts
|
||||
if (Helpers::hasValue(wWStarts_)) {
|
||||
output["wWStarts"] = wWStarts_;
|
||||
json["wWStarts"] = wWStarts_;
|
||||
}
|
||||
|
||||
// Warm Water active time
|
||||
if (Helpers::hasValue(wWWorkM_)) {
|
||||
output["wWWorkM"] = wWWorkM_;
|
||||
json["wWWorkM"] = wWWorkM_;
|
||||
}
|
||||
|
||||
return (output.size());
|
||||
return (json.size());
|
||||
}
|
||||
|
||||
// creates JSON doc from values
|
||||
// returns false if empty
|
||||
bool Boiler::export_values_main(JsonObject & output) {
|
||||
bool Boiler::export_values_main(JsonObject & json) {
|
||||
char s[10]; // for formatting strings
|
||||
|
||||
// Hot tap water bool
|
||||
if (Helpers::hasValue(heatingActive_, EMS_VALUE_BOOL)) {
|
||||
output["heatingActive"] = Helpers::render_value(s, heatingActive_, EMS_VALUE_BOOL);
|
||||
json["heatingActive"] = Helpers::render_value(s, heatingActive_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Central heating bool
|
||||
if (Helpers::hasValue(tapwaterActive_, EMS_VALUE_BOOL)) {
|
||||
output["tapwaterActive"] = Helpers::render_value(s, tapwaterActive_, EMS_VALUE_BOOL);
|
||||
json["tapwaterActive"] = Helpers::render_value(s, tapwaterActive_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Selected flow temperature deg
|
||||
if (Helpers::hasValue(selFlowTemp_)) {
|
||||
output["selFlowTemp"] = selFlowTemp_;
|
||||
json["selFlowTemp"] = selFlowTemp_;
|
||||
}
|
||||
|
||||
// Burner selected max power %
|
||||
if (Helpers::hasValue(selBurnPow_)) {
|
||||
output["selBurnPow"] = selBurnPow_;
|
||||
json["selBurnPow"] = selBurnPow_;
|
||||
}
|
||||
|
||||
// Burner current power %
|
||||
if (Helpers::hasValue(curBurnPow_)) {
|
||||
output["curBurnPow"] = curBurnPow_;
|
||||
json["curBurnPow"] = curBurnPow_;
|
||||
}
|
||||
|
||||
// Pump modulation %
|
||||
if (Helpers::hasValue(pumpMod_)) {
|
||||
output["pumpMod"] = pumpMod_;
|
||||
json["pumpMod"] = pumpMod_;
|
||||
}
|
||||
|
||||
// Heat Pump modulation %
|
||||
if (Helpers::hasValue(pumpMod2_)) {
|
||||
output["pumpMod2"] = pumpMod2_;
|
||||
json["pumpMod2"] = pumpMod2_;
|
||||
}
|
||||
|
||||
// Outside temperature
|
||||
if (Helpers::hasValue(outdoorTemp_)) {
|
||||
output["outdoorTemp"] = (float)outdoorTemp_ / 10;
|
||||
json["outdoorTemp"] = (float)outdoorTemp_ / 10;
|
||||
}
|
||||
|
||||
// Current flow temperature
|
||||
if (Helpers::hasValue(curFlowTemp_)) {
|
||||
output["curFlowTemp"] = (float)curFlowTemp_ / 10;
|
||||
json["curFlowTemp"] = (float)curFlowTemp_ / 10;
|
||||
}
|
||||
|
||||
// Return temperature
|
||||
if (Helpers::hasValue(retTemp_)) {
|
||||
output["retTemp"] = (float)retTemp_ / 10;
|
||||
json["retTemp"] = (float)retTemp_ / 10;
|
||||
}
|
||||
|
||||
// Mixing switch temperature
|
||||
if (Helpers::hasValue(switchTemp_)) {
|
||||
output["switchTemp"] = (float)switchTemp_ / 10;
|
||||
json["switchTemp"] = (float)switchTemp_ / 10;
|
||||
}
|
||||
|
||||
// System pressure
|
||||
if (Helpers::hasValue(sysPress_)) {
|
||||
output["sysPress"] = (float)sysPress_ / 10;
|
||||
json["sysPress"] = (float)sysPress_ / 10;
|
||||
}
|
||||
|
||||
// Max boiler temperature
|
||||
if (Helpers::hasValue(boilTemp_)) {
|
||||
output["boilTemp"] = (float)boilTemp_ / 10;
|
||||
json["boilTemp"] = (float)boilTemp_ / 10;
|
||||
}
|
||||
|
||||
// Exhaust temperature
|
||||
if (Helpers::hasValue(exhaustTemp_)) {
|
||||
output["exhaustTemp"] = (float)exhaustTemp_ / 10;
|
||||
json["exhaustTemp"] = (float)exhaustTemp_ / 10;
|
||||
}
|
||||
|
||||
// Gas bool
|
||||
if (Helpers::hasValue(burnGas_, EMS_VALUE_BOOL)) {
|
||||
output["burnGas"] = Helpers::render_value(s, burnGas_, EMS_VALUE_BOOL);
|
||||
json["burnGas"] = Helpers::render_value(s, burnGas_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Flame current uA
|
||||
if (Helpers::hasValue(flameCurr_)) {
|
||||
output["flameCurr"] = (float)(int16_t)flameCurr_ / 10;
|
||||
json["flameCurr"] = (float)(int16_t)flameCurr_ / 10;
|
||||
}
|
||||
|
||||
// Boiler pump bool
|
||||
if (Helpers::hasValue(heatPump_, EMS_VALUE_BOOL)) {
|
||||
output["heatPump"] = Helpers::render_value(s, heatPump_, EMS_VALUE_BOOL);
|
||||
json["heatPump"] = Helpers::render_value(s, heatPump_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Fan bool
|
||||
if (Helpers::hasValue(fanWork_, EMS_VALUE_BOOL)) {
|
||||
output["fanWork"] = Helpers::render_value(s, fanWork_, EMS_VALUE_BOOL);
|
||||
json["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);
|
||||
json["ignWork"] = Helpers::render_value(s, ignWork_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// heating activated bool
|
||||
if (Helpers::hasValue(heatingActivated_, EMS_VALUE_BOOL)) {
|
||||
output["heatingActivated"] = Helpers::render_value(s, heatingActivated_, EMS_VALUE_BOOL);
|
||||
json["heatingActivated"] = Helpers::render_value(s, heatingActivated_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
// Heating temperature setting on the boiler
|
||||
if (Helpers::hasValue(heatingTemp_)) {
|
||||
output["heatingTemp"] = heatingTemp_;
|
||||
json["heatingTemp"] = heatingTemp_;
|
||||
}
|
||||
|
||||
// Boiler circuit pump modulation max power %
|
||||
if (Helpers::hasValue(pumpModMax_)) {
|
||||
output["pumpModMax"] = pumpModMax_;
|
||||
json["pumpModMax"] = pumpModMax_;
|
||||
}
|
||||
|
||||
// Boiler circuit pump modulation min power %
|
||||
if (Helpers::hasValue(pumpModMin_)) {
|
||||
output["pumpModMin"] = pumpModMin_;
|
||||
json["pumpModMin"] = pumpModMin_;
|
||||
}
|
||||
|
||||
// Boiler circuit pump delay time min
|
||||
if (Helpers::hasValue(pumpDelay_)) {
|
||||
output["pumpDelay"] = pumpDelay_;
|
||||
json["pumpDelay"] = pumpDelay_;
|
||||
}
|
||||
|
||||
// Boiler burner min period min
|
||||
if (Helpers::hasValue(burnMinPeriod_)) {
|
||||
output["burnMinPeriod"] = burnMinPeriod_;
|
||||
json["burnMinPeriod"] = burnMinPeriod_;
|
||||
}
|
||||
|
||||
// Boiler burner min power %
|
||||
if (Helpers::hasValue(burnMinPower_)) {
|
||||
output["burnMinPower"] = burnMinPower_;
|
||||
json["burnMinPower"] = burnMinPower_;
|
||||
}
|
||||
|
||||
// Boiler burner max power %
|
||||
if (Helpers::hasValue(burnMaxPower_)) {
|
||||
output["burnMaxPower"] = burnMaxPower_;
|
||||
json["burnMaxPower"] = burnMaxPower_;
|
||||
}
|
||||
|
||||
// Boiler temp hysteresis on degrees
|
||||
if (Helpers::hasValue(boilHystOn_)) {
|
||||
output["boilHystOn"] = boilHystOn_;
|
||||
json["boilHystOn"] = boilHystOn_;
|
||||
}
|
||||
|
||||
// Boiler temp hysteresis off degrees
|
||||
if (Helpers::hasValue(boilHystOff_)) {
|
||||
output["boilHystOff"] = boilHystOff_;
|
||||
json["boilHystOff"] = boilHystOff_;
|
||||
}
|
||||
|
||||
// Set Flow temperature
|
||||
if (Helpers::hasValue(setFlowTemp_)) {
|
||||
output["setFlowTemp"] = setFlowTemp_;
|
||||
json["setFlowTemp"] = setFlowTemp_;
|
||||
}
|
||||
|
||||
// Total UBA working time
|
||||
if (Helpers::hasValue(UBAuptime_)) {
|
||||
output["UBAuptime"] = UBAuptime_;
|
||||
json["UBAuptime"] = UBAuptime_;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(setBurnPow_)) {
|
||||
output["setBurnPow"] = setBurnPow_;
|
||||
json["setBurnPow"] = setBurnPow_;
|
||||
}
|
||||
|
||||
// Burner # starts
|
||||
if (Helpers::hasValue(burnStarts_)) {
|
||||
output["burnStarts"] = burnStarts_;
|
||||
json["burnStarts"] = burnStarts_;
|
||||
}
|
||||
|
||||
// Total burner operating time
|
||||
if (Helpers::hasValue(burnWorkMin_)) {
|
||||
output["burnWorkMin"] = burnWorkMin_;
|
||||
json["burnWorkMin"] = burnWorkMin_;
|
||||
}
|
||||
|
||||
// Total heat operating time
|
||||
if (Helpers::hasValue(heatWorkMin_)) {
|
||||
output["heatWorkMin"] = heatWorkMin_;
|
||||
json["heatWorkMin"] = heatWorkMin_;
|
||||
}
|
||||
|
||||
// Service Code
|
||||
// Service Code Number
|
||||
if (Helpers::hasValue(serviceCodeNumber_)) {
|
||||
output["serviceCode"] = serviceCode_;
|
||||
output["serviceCodeNumber"] = serviceCodeNumber_;
|
||||
json["serviceCode"] = serviceCode_;
|
||||
json["serviceCodeNumber"] = serviceCodeNumber_;
|
||||
}
|
||||
|
||||
return (output.size());
|
||||
return (json.size());
|
||||
}
|
||||
|
||||
// publish values via MQTT
|
||||
void Boiler::publish_values(JsonObject & data, bool force) {
|
||||
void Boiler::publish_values(JsonObject & json, bool force) {
|
||||
// handle HA first
|
||||
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
||||
register_mqtt_ha_config(force);
|
||||
}
|
||||
|
||||
DynamicJsonDocument doc_main(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||
JsonObject output_main = doc_main.to<JsonObject>();
|
||||
if (export_values_main(output_main)) {
|
||||
JsonObject json_main = doc_main.to<JsonObject>();
|
||||
if (export_values_main(json_main)) {
|
||||
Mqtt::publish(F("boiler_data_main"), doc_main.as<JsonObject>());
|
||||
}
|
||||
|
||||
DynamicJsonDocument doc_ww(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||
JsonObject output_ww = doc_ww.to<JsonObject>();
|
||||
if (export_values_ww(output_ww)) {
|
||||
JsonObject json_ww = doc_ww.to<JsonObject>();
|
||||
if (export_values_ww(json_ww)) {
|
||||
Mqtt::publish(F("boiler_data_ww"), doc_ww.as<JsonObject>());
|
||||
}
|
||||
|
||||
@@ -652,73 +646,73 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
||||
|
||||
// fetch the values into a JSON document
|
||||
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (!export_values_main(output)) {
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
if (!export_values_main(json)) {
|
||||
return; // empty
|
||||
}
|
||||
export_values_ww(output); // append ww values
|
||||
export_values_ww(json); // append ww values
|
||||
doc.shrinkToFit();
|
||||
|
||||
print_value_json(shell, F("heatingActive"), nullptr, F_(heatingActive), nullptr, output);
|
||||
print_value_json(shell, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, output);
|
||||
print_value_json(shell, F("serviceCode"), nullptr, F_(serviceCode), nullptr, output);
|
||||
print_value_json(shell, F("serviceCodeNumber"), nullptr, F_(serviceCodeNumber), nullptr, output);
|
||||
print_value_json(shell, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("wWDisinfectionTemp"), nullptr, F_(wWDisinfectionTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("selFlowTemp"), nullptr, F_(selFlowTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("selBurnPow"), nullptr, F_(selBurnPow), F_(percent), output);
|
||||
print_value_json(shell, F("curBurnPow"), nullptr, F_(curBurnPow), F_(percent), output);
|
||||
print_value_json(shell, F("pumpMod"), nullptr, F_(pumpMod), F_(percent), output);
|
||||
print_value_json(shell, F("pumpMod2"), nullptr, F_(pumpMod2), F_(percent), output);
|
||||
print_value_json(shell, F("wWType"), nullptr, F_(wWType), nullptr, output);
|
||||
print_value_json(shell, F("wWChargeType"), nullptr, F_(wWChargeType), nullptr, output);
|
||||
print_value_json(shell, F("wWCircPump"), nullptr, F_(wWCircPump), nullptr, output);
|
||||
print_value_json(shell, F("wWCircPumpMode"), nullptr, F_(wWCircPumpMode), nullptr, output);
|
||||
print_value_json(shell, F("wWCirc"), nullptr, F_(wWCirc), nullptr, output);
|
||||
print_value_json(shell, F("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("wWCurTemp"), nullptr, F_(wWCurTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("wWCurTemp2"), nullptr, F_(wWCurTemp2), F_(degrees), output);
|
||||
print_value_json(shell, F("wWCurFlow"), nullptr, F_(wWCurFlow), F("l/min"), output);
|
||||
print_value_json(shell, F("curFlowTemp"), nullptr, F_(curFlowTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("retTemp"), nullptr, F_(retTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("switchTemp"), nullptr, F_(switchTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("sysPress"), nullptr, F_(sysPress), nullptr, output);
|
||||
print_value_json(shell, F("boilTemp"), nullptr, F_(boilTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), output);
|
||||
print_value_json(shell, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), F_(degrees), output);
|
||||
print_value_json(shell, F("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("wWActivated"), nullptr, F_(wWActivated), nullptr, output);
|
||||
print_value_json(shell, F("wWOneTime"), nullptr, F_(wWOneTime), nullptr, output);
|
||||
print_value_json(shell, F("wWDisinfecting"), nullptr, F_(wWDisinfecting), nullptr, output);
|
||||
print_value_json(shell, F("wWCharging"), nullptr, F_(wWCharging), nullptr, output);
|
||||
print_value_json(shell, F("wWRecharging"), nullptr, F_(wWRecharging), nullptr, output);
|
||||
print_value_json(shell, F("wWTempOK"), nullptr, F_(wWTempOK), nullptr, output);
|
||||
print_value_json(shell, F("wWActive"), nullptr, F_(wWActive), nullptr, output);
|
||||
print_value_json(shell, F("burnGas"), nullptr, F_(burnGas), nullptr, output);
|
||||
print_value_json(shell, F("flameCurr"), nullptr, F_(flameCurr), F_(uA), output);
|
||||
print_value_json(shell, F("heatPump"), nullptr, F_(heatPump), nullptr, output);
|
||||
print_value_json(shell, F("fanWork"), nullptr, F_(fanWork), nullptr, output);
|
||||
print_value_json(shell, F("ignWork"), nullptr, F_(ignWork), nullptr, output);
|
||||
print_value_json(shell, F("wWHeat"), nullptr, F_(wWHeat), nullptr, output);
|
||||
print_value_json(shell, F("heatingActivated"), nullptr, F_(heatingActivated), nullptr, output);
|
||||
print_value_json(shell, F("heatingTemp"), nullptr, F_(heatingTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("pumpModMax"), nullptr, F_(pumpModMax), F_(percent), output);
|
||||
print_value_json(shell, F("pumpModMin"), nullptr, F_(pumpModMin), F_(percent), output);
|
||||
print_value_json(shell, F("pumpDelay"), nullptr, F_(pumpDelay), F_(min), output);
|
||||
print_value_json(shell, F("burnMinPeriod"), nullptr, F_(burnMinPeriod), F_(min), output);
|
||||
print_value_json(shell, F("burnMinPower"), nullptr, F_(burnMinPower), F_(percent), output);
|
||||
print_value_json(shell, F("burnMaxPower"), nullptr, F_(burnMaxPower), F_(percent), output);
|
||||
print_value_json(shell, F("boilHystOn"), nullptr, F_(boilHystOn), F_(degrees), output);
|
||||
print_value_json(shell, F("boilHystOff"), nullptr, F_(boilHystOff), F_(degrees), output);
|
||||
print_value_json(shell, F("setFlowTemp"), nullptr, F_(setFlowTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("wWSetPumpPower"), nullptr, F_(wWSetPumpPower), F_(percent), output);
|
||||
print_value_json(shell, F("wwMixTemperature"), nullptr, F_(wwMixTemperature), F_(degrees), output);
|
||||
print_value_json(shell, F("wwBufferTemperature"), nullptr, F_(wwBufferTemperature), F_(degrees), output);
|
||||
print_value_json(shell, F("wWStarts"), nullptr, F_(wWStarts), nullptr, output);
|
||||
print_value_json(shell, F("wWWorkM"), nullptr, F_(wWWorkM), nullptr, output);
|
||||
print_value_json(shell, F("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), output);
|
||||
print_value_json(shell, F("burnStarts"), nullptr, F_(burnStarts), nullptr, output);
|
||||
print_value_json(shell, F("heatingActive"), nullptr, F_(heatingActive), nullptr, json);
|
||||
print_value_json(shell, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, json);
|
||||
print_value_json(shell, F("serviceCode"), nullptr, F_(serviceCode), nullptr, json);
|
||||
print_value_json(shell, F("serviceCodeNumber"), nullptr, F_(serviceCodeNumber), nullptr, json);
|
||||
print_value_json(shell, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("wWDisinfectionTemp"), nullptr, F_(wWDisinfectionTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("selFlowTemp"), nullptr, F_(selFlowTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("selBurnPow"), nullptr, F_(selBurnPow), F_(percent), json);
|
||||
print_value_json(shell, F("curBurnPow"), nullptr, F_(curBurnPow), F_(percent), json);
|
||||
print_value_json(shell, F("pumpMod"), nullptr, F_(pumpMod), F_(percent), json);
|
||||
print_value_json(shell, F("pumpMod2"), nullptr, F_(pumpMod2), F_(percent), json);
|
||||
print_value_json(shell, F("wWType"), nullptr, F_(wWType), nullptr, json);
|
||||
print_value_json(shell, F("wWChargeType"), nullptr, F_(wWChargeType), nullptr, json);
|
||||
print_value_json(shell, F("wWCircPump"), nullptr, F_(wWCircPump), nullptr, json);
|
||||
print_value_json(shell, F("wWCircPumpMode"), nullptr, F_(wWCircPumpMode), nullptr, json);
|
||||
print_value_json(shell, F("wWCirc"), nullptr, F_(wWCirc), nullptr, json);
|
||||
print_value_json(shell, F("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("wWCurTemp"), nullptr, F_(wWCurTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("wWCurTemp2"), nullptr, F_(wWCurTemp2), F_(degrees), json);
|
||||
print_value_json(shell, F("wWCurFlow"), nullptr, F_(wWCurFlow), F("l/min"), json);
|
||||
print_value_json(shell, F("curFlowTemp"), nullptr, F_(curFlowTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("retTemp"), nullptr, F_(retTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("switchTemp"), nullptr, F_(switchTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("sysPress"), nullptr, F_(sysPress), nullptr, json);
|
||||
print_value_json(shell, F("boilTemp"), nullptr, F_(boilTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), json);
|
||||
print_value_json(shell, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), F_(degrees), json);
|
||||
print_value_json(shell, F("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("wWActivated"), nullptr, F_(wWActivated), nullptr, json);
|
||||
print_value_json(shell, F("wWOneTime"), nullptr, F_(wWOneTime), nullptr, json);
|
||||
print_value_json(shell, F("wWDisinfecting"), nullptr, F_(wWDisinfecting), nullptr, json);
|
||||
print_value_json(shell, F("wWCharging"), nullptr, F_(wWCharging), nullptr, json);
|
||||
print_value_json(shell, F("wWRecharging"), nullptr, F_(wWRecharging), nullptr, json);
|
||||
print_value_json(shell, F("wWTempOK"), nullptr, F_(wWTempOK), nullptr, json);
|
||||
print_value_json(shell, F("wWActive"), nullptr, F_(wWActive), nullptr, json);
|
||||
print_value_json(shell, F("burnGas"), nullptr, F_(burnGas), nullptr, json);
|
||||
print_value_json(shell, F("flameCurr"), nullptr, F_(flameCurr), F_(uA), json);
|
||||
print_value_json(shell, F("heatPump"), nullptr, F_(heatPump), nullptr, json);
|
||||
print_value_json(shell, F("fanWork"), nullptr, F_(fanWork), nullptr, json);
|
||||
print_value_json(shell, F("ignWork"), nullptr, F_(ignWork), nullptr, json);
|
||||
print_value_json(shell, F("wWHeat"), nullptr, F_(wWHeat), nullptr, json);
|
||||
print_value_json(shell, F("heatingActivated"), nullptr, F_(heatingActivated), nullptr, json);
|
||||
print_value_json(shell, F("heatingTemp"), nullptr, F_(heatingTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("pumpModMax"), nullptr, F_(pumpModMax), F_(percent), json);
|
||||
print_value_json(shell, F("pumpModMin"), nullptr, F_(pumpModMin), F_(percent), json);
|
||||
print_value_json(shell, F("pumpDelay"), nullptr, F_(pumpDelay), F_(min), json);
|
||||
print_value_json(shell, F("burnMinPeriod"), nullptr, F_(burnMinPeriod), F_(min), json);
|
||||
print_value_json(shell, F("burnMinPower"), nullptr, F_(burnMinPower), F_(percent), json);
|
||||
print_value_json(shell, F("burnMaxPower"), nullptr, F_(burnMaxPower), F_(percent), json);
|
||||
print_value_json(shell, F("boilHystOn"), nullptr, F_(boilHystOn), F_(degrees), json);
|
||||
print_value_json(shell, F("boilHystOff"), nullptr, F_(boilHystOff), F_(degrees), json);
|
||||
print_value_json(shell, F("setFlowTemp"), nullptr, F_(setFlowTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("wWSetPumpPower"), nullptr, F_(wWSetPumpPower), F_(percent), json);
|
||||
print_value_json(shell, F("wwMixTemperature"), nullptr, F_(wwMixTemperature), F_(degrees), json);
|
||||
print_value_json(shell, F("wwBufferTemperature"), nullptr, F_(wwBufferTemperature), F_(degrees), json);
|
||||
print_value_json(shell, F("wWStarts"), nullptr, F_(wWStarts), nullptr, json);
|
||||
print_value_json(shell, F("wWWorkM"), nullptr, F_(wWWorkM), nullptr, json);
|
||||
print_value_json(shell, F("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), json);
|
||||
print_value_json(shell, F("burnStarts"), nullptr, F_(burnStarts), nullptr, json);
|
||||
|
||||
if (Helpers::hasValue(wWWorkM_)) {
|
||||
shell.printfln(F(" Warm Water active time: %d days %d hours %d minutes"), wWWorkM_ / 1440, (wWWorkM_ % 1440) / 60, wWWorkM_ % 60);
|
||||
@@ -1013,7 +1007,7 @@ void Boiler::process_UBAOutdoorTemp(std::shared_ptr<const Telegram> telegram) {
|
||||
// UBASetPoint 0x1A
|
||||
void Boiler::process_UBASetPoints(std::shared_ptr<const Telegram> telegram) {
|
||||
changed_ |= telegram->read_value(setFlowTemp_, 0); // boiler set temp from thermostat
|
||||
changed_ |= telegram->read_value(setBurnPow_, 1); // max output power in %
|
||||
changed_ |= telegram->read_value(setBurnPow_, 1); // max json power in %
|
||||
changed_ |= telegram->read_value(wWSetPumpPower_, 2); // ww pump speed/power?
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ class Boiler : public EMSdevice {
|
||||
Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||
|
||||
virtual void show_values(uuid::console::Shell & shell);
|
||||
virtual void publish_values(JsonObject & data, bool force);
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
|
||||
@@ -147,8 +148,6 @@ class Boiler : public EMSdevice {
|
||||
uint8_t heatingActive_ = EMS_VALUE_BOOL_NOTSET; // Central heating is on/off
|
||||
uint8_t pumpMod2_ = EMS_VALUE_UINT_NOTSET; // heatpump modulation from 0xE3 (heatpumps)
|
||||
|
||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
||||
|
||||
void process_UBAParameterWW(std::shared_ptr<const Telegram> telegram);
|
||||
void process_UBAMonitorFast(std::shared_ptr<const Telegram> telegram);
|
||||
void process_UBATotalUptime(std::shared_ptr<const Telegram> telegram);
|
||||
|
||||
@@ -37,7 +37,12 @@ void Connect::show_values(uuid::console::Shell & shell) {
|
||||
}
|
||||
|
||||
// publish values via MQTT
|
||||
void Connect::publish_values(JsonObject & data, bool force) {
|
||||
void Connect::publish_values(JsonObject & json, bool force) {
|
||||
}
|
||||
|
||||
// export values to JSON
|
||||
bool Connect::export_values(JsonObject & json) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// check to see if values have been updated
|
||||
|
||||
@@ -36,7 +36,8 @@ class Connect : public EMSdevice {
|
||||
Connect(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||
|
||||
virtual void show_values(uuid::console::Shell & shell);
|
||||
virtual void publish_values(JsonObject & data, bool force);
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
|
||||
|
||||
@@ -37,7 +37,12 @@ void Controller::show_values(uuid::console::Shell & shell) {
|
||||
}
|
||||
|
||||
// publish values via MQTT
|
||||
void Controller::publish_values(JsonObject & data, bool force) {
|
||||
void Controller::publish_values(JsonObject & json, bool force) {
|
||||
}
|
||||
|
||||
// export values to JSON
|
||||
bool Controller::export_values(JsonObject & json) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// check to see if values have been updated
|
||||
|
||||
@@ -36,13 +36,13 @@ class Controller : public EMSdevice {
|
||||
Controller(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||
|
||||
virtual void show_values(uuid::console::Shell & shell);
|
||||
virtual void publish_values(JsonObject & data, bool force);
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
|
||||
private:
|
||||
static uuid::log::Logger logger_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
@@ -37,7 +37,12 @@ void Gateway::show_values(uuid::console::Shell & shell) {
|
||||
}
|
||||
|
||||
// publish values via MQTT
|
||||
void Gateway::publish_values(JsonObject & data, bool force) {
|
||||
void Gateway::publish_values(JsonObject & json, bool force) {
|
||||
}
|
||||
|
||||
// export values to JSON
|
||||
bool Gateway::export_values(JsonObject & json) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// check to see if values have been updated
|
||||
|
||||
@@ -36,13 +36,13 @@ class Gateway : public EMSdevice {
|
||||
Gateway(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||
|
||||
virtual void show_values(uuid::console::Shell & shell);
|
||||
virtual void publish_values(JsonObject & data, bool force);
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
|
||||
private:
|
||||
static uuid::log::Logger logger_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
@@ -37,7 +37,12 @@ void Generic::show_values(uuid::console::Shell & shell) {
|
||||
}
|
||||
|
||||
// publish values via MQTT
|
||||
void Generic::publish_values(JsonObject & data, bool force) {
|
||||
void Generic::publish_values(JsonObject & json, bool force) {
|
||||
}
|
||||
|
||||
// export values to JSON
|
||||
bool Generic::export_values(JsonObject & json) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// check to see if values have been updated
|
||||
|
||||
@@ -36,7 +36,8 @@ class Generic : public EMSdevice {
|
||||
Generic(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||
|
||||
virtual void show_values(uuid::console::Shell & shell);
|
||||
virtual void publish_values(JsonObject & data, bool force);
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
|
||||
|
||||
@@ -31,41 +31,32 @@ Heatpump::Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, c
|
||||
// telegram handlers
|
||||
register_telegram_type(0x042B, F("HP1"), true, [&](std::shared_ptr<const Telegram> t) { process_HPMonitor1(t); });
|
||||
register_telegram_type(0x047B, F("HP2"), true, [&](std::shared_ptr<const Telegram> t) { process_HPMonitor2(t); });
|
||||
|
||||
// API call
|
||||
Command::add_with_json(this->device_type(), F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
||||
return command_info(value, id, object);
|
||||
});
|
||||
}
|
||||
|
||||
bool Heatpump::command_info(const char * value, const int8_t id, JsonObject & output) {
|
||||
return (export_values(output));
|
||||
}
|
||||
|
||||
// creates JSON doc from values
|
||||
// returns false if empty
|
||||
bool Heatpump::export_values(JsonObject & output) {
|
||||
bool Heatpump::export_values(JsonObject & json) {
|
||||
if (Helpers::hasValue(airHumidity_)) {
|
||||
output["airHumidity"] = (float)airHumidity_ / 2;
|
||||
json["airHumidity"] = (float)airHumidity_ / 2;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(dewTemperature_)) {
|
||||
output["dewTemperature"] = dewTemperature_;
|
||||
json["dewTemperature"] = dewTemperature_;
|
||||
}
|
||||
|
||||
return output.size();
|
||||
return json.size();
|
||||
}
|
||||
|
||||
void Heatpump::device_info_web(JsonArray & root) {
|
||||
// fetch the values into a JSON document
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (!export_values(output)) {
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
if (!export_values(json)) {
|
||||
return; // empty
|
||||
}
|
||||
|
||||
print_value_json(root, F("airHumidity"), nullptr, F_(airHumidity), F_(percent), output);
|
||||
print_value_json(root, F("dewTemperature"), nullptr, F_(dewTemperature), F_(degrees), output);
|
||||
print_value_json(root, F("airHumidity"), nullptr, F_(airHumidity), F_(percent), json);
|
||||
print_value_json(root, F("dewTemperature"), nullptr, F_(dewTemperature), F_(degrees), json);
|
||||
}
|
||||
|
||||
// display all values into the shell console
|
||||
@@ -74,25 +65,25 @@ void Heatpump::show_values(uuid::console::Shell & shell) {
|
||||
|
||||
// fetch the values into a JSON document
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (!export_values(output)) {
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
if (!export_values(json)) {
|
||||
return; // empty
|
||||
}
|
||||
|
||||
print_value_json(shell, F("airHumidity"), nullptr, F_(airHumidity), F_(percent), output);
|
||||
print_value_json(shell, F("dewTemperature"), nullptr, F_(dewTemperature), F_(degrees), output);
|
||||
print_value_json(shell, F("airHumidity"), nullptr, F_(airHumidity), F_(percent), json);
|
||||
print_value_json(shell, F("dewTemperature"), nullptr, F_(dewTemperature), F_(degrees), json);
|
||||
}
|
||||
|
||||
// publish values via MQTT
|
||||
void Heatpump::publish_values(JsonObject & data, bool force) {
|
||||
void Heatpump::publish_values(JsonObject & json, bool force) {
|
||||
// handle HA first
|
||||
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
||||
register_mqtt_ha_config(force);
|
||||
}
|
||||
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (export_values(output)) {
|
||||
JsonObject json_data = doc.to<JsonObject>();
|
||||
if (export_values(json_data)) {
|
||||
Mqtt::publish(F("heatpump_data"), doc.as<JsonObject>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,15 +37,14 @@ class Heatpump : public EMSdevice {
|
||||
Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||
|
||||
virtual void show_values(uuid::console::Shell & shell);
|
||||
virtual void publish_values(JsonObject & data, bool force);
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
|
||||
private:
|
||||
static uuid::log::Logger logger_;
|
||||
|
||||
bool export_values(JsonObject & doc);
|
||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
||||
void register_mqtt_ha_config(bool force);
|
||||
|
||||
uint8_t airHumidity_ = EMS_VALUE_UINT_NOTSET;
|
||||
|
||||
@@ -53,11 +53,6 @@ Mixing::Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const
|
||||
if (flags == EMSdevice::EMS_DEVICE_FLAG_IPM) {
|
||||
register_telegram_type(0x010C, F("IPMSetMessage"), false, [&](std::shared_ptr<const Telegram> t) { process_IPMStatusMessage(t); });
|
||||
}
|
||||
|
||||
// API call
|
||||
Command::add_with_json(this->device_type(), F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
||||
return command_info(value, id, object);
|
||||
});
|
||||
}
|
||||
|
||||
// output json to web UI
|
||||
@@ -68,23 +63,23 @@ void Mixing::device_info_web(JsonArray & root) {
|
||||
|
||||
// fetch the values into a JSON document
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (!export_values(Mqtt::Format::SINGLE, output)) {
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
if (!export_values_format(Mqtt::Format::SINGLE, json)) {
|
||||
return; // empty
|
||||
}
|
||||
|
||||
char prefix_str[10];
|
||||
if (type() == Type::HC) {
|
||||
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(hc %d) "), hc_);
|
||||
print_value_json(root, F("flowTemp"), FPSTR(prefix_str), F_(flowTemp), F_(degrees), output);
|
||||
print_value_json(root, F("flowSetTemp"), FPSTR(prefix_str), F_(flowSetTemp), F_(degrees), output);
|
||||
print_value_json(root, F("pumpStatus"), FPSTR(prefix_str), F_(pumpStatus), nullptr, output);
|
||||
print_value_json(root, F("valveStatus"), FPSTR(prefix_str), F_(valveStatus), F_(percent), output);
|
||||
print_value_json(root, F("flowTemp"), FPSTR(prefix_str), F_(flowTemp), F_(degrees), json);
|
||||
print_value_json(root, F("flowSetTemp"), FPSTR(prefix_str), F_(flowSetTemp), F_(degrees), json);
|
||||
print_value_json(root, F("pumpStatus"), FPSTR(prefix_str), F_(pumpStatus), nullptr, json);
|
||||
print_value_json(root, F("valveStatus"), FPSTR(prefix_str), F_(valveStatus), F_(percent), json);
|
||||
} else {
|
||||
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(wwc %d) "), hc_);
|
||||
print_value_json(root, F("wwTemp"), FPSTR(prefix_str), F_(wwTemp), F_(degrees), output);
|
||||
print_value_json(root, F("pumpStatus"), FPSTR(prefix_str), F_(pumpStatus), nullptr, output);
|
||||
print_value_json(root, F("tempStatus"), FPSTR(prefix_str), F_(tempStatus), nullptr, output);
|
||||
print_value_json(root, F("wwTemp"), FPSTR(prefix_str), F_(wwTemp), F_(degrees), json);
|
||||
print_value_json(root, F("pumpStatus"), FPSTR(prefix_str), F_(pumpStatus), nullptr, json);
|
||||
print_value_json(root, F("tempStatus"), FPSTR(prefix_str), F_(tempStatus), nullptr, json);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,38 +102,30 @@ void Mixing::show_values(uuid::console::Shell & shell) {
|
||||
|
||||
// fetch the values into a JSON document
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (!export_values(Mqtt::Format::SINGLE, output)) {
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
if (!export_values_format(Mqtt::Format::SINGLE, json)) {
|
||||
return; // empty
|
||||
}
|
||||
|
||||
if (type() == Type::HC) {
|
||||
shell.printfln(F_(hc), hc_);
|
||||
print_value_json(shell, F("flowTemp"), F_(2spaces), F_(flowTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("flowSetTemp"), F_(2spaces), F_(flowSetTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("pumpStatus"), F_(2spaces), F_(pumpStatus), nullptr, output);
|
||||
print_value_json(shell, F("valveStatus"), F_(2spaces), F_(valveStatus), F_(percent), output);
|
||||
print_value_json(shell, F("flowTemp"), F_(2spaces), F_(flowTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("flowSetTemp"), F_(2spaces), F_(flowSetTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("pumpStatus"), F_(2spaces), F_(pumpStatus), nullptr, json);
|
||||
print_value_json(shell, F("valveStatus"), F_(2spaces), F_(valveStatus), F_(percent), json);
|
||||
} else {
|
||||
shell.printfln(F_(ww_hc), hc_);
|
||||
print_value_json(shell, F("wwTemp"), F_(2spaces), F_(wwTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("pumpStatus"), F_(2spaces), F_(pumpStatus), nullptr, output);
|
||||
print_value_json(shell, F("tempStatus"), F_(2spaces), F_(tempStatus), nullptr, output);
|
||||
print_value_json(shell, F("wwTemp"), F_(2spaces), F_(wwTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("pumpStatus"), F_(2spaces), F_(pumpStatus), nullptr, json);
|
||||
print_value_json(shell, F("tempStatus"), F_(2spaces), F_(tempStatus), nullptr, json);
|
||||
}
|
||||
|
||||
shell.println();
|
||||
}
|
||||
|
||||
// export all values to info command
|
||||
bool Mixing::command_info(const char * value, const int8_t id, JsonObject & output) {
|
||||
if (id != (device_id() - 0x20 + 1) && id > 0) { // defaults to first hc if no id
|
||||
return false;
|
||||
}
|
||||
return (export_values(Mqtt::Format::NESTED, output));
|
||||
}
|
||||
|
||||
// publish values via MQTT
|
||||
// topic is mixing_data<id>
|
||||
void Mixing::publish_values(JsonObject & data, bool force) {
|
||||
void Mixing::publish_values(JsonObject & json, bool force) {
|
||||
// handle HA first
|
||||
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
||||
register_mqtt_ha_config(force);
|
||||
@@ -146,8 +133,8 @@ void Mixing::publish_values(JsonObject & data, bool force) {
|
||||
|
||||
if (Mqtt::mqtt_format() == Mqtt::Format::SINGLE) {
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (export_values(Mqtt::mqtt_format(), output)) {
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
if (export_values_format(Mqtt::mqtt_format(), json)) {
|
||||
char topic[30];
|
||||
char s[5];
|
||||
strlcpy(topic, "mixing_data", 30);
|
||||
@@ -156,7 +143,7 @@ void Mixing::publish_values(JsonObject & data, bool force) {
|
||||
}
|
||||
} else {
|
||||
// format is HA or Nested. This is bundled together and sent in emsesp.cpp
|
||||
(void)export_values(Mqtt::mqtt_format(), data);
|
||||
export_values_format(Mqtt::mqtt_format(), json);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,16 +157,22 @@ void Mixing::register_mqtt_ha_config(bool force) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if we don't have valid values for this HC don't add it ever again
|
||||
if (!Helpers::hasValue(status_)) {
|
||||
mqtt_ha_config_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the Master device
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||
|
||||
char str1[20];
|
||||
snprintf_P(str1, sizeof(str1), PSTR("Mixing %d"), device_id() - 0x20 + 1);
|
||||
doc["name"] = str1;
|
||||
char name[20];
|
||||
snprintf_P(name, sizeof(name), PSTR("Mixing %02X"), device_id() - 0x20 + 1);
|
||||
doc["name"] = name;
|
||||
|
||||
char str2[20];
|
||||
snprintf_P(str2, sizeof(str2), PSTR("mixing %d"), device_id() - 0x20 + 1);
|
||||
doc["uniq_id"] = str2;
|
||||
char uniq_id[20];
|
||||
snprintf_P(uniq_id, sizeof(uniq_id), PSTR("mixing%02X"), device_id() - 0x20 + 1);
|
||||
doc["uniq_id"] = uniq_id;
|
||||
|
||||
doc["ic"] = F("mdi:home-thermometer-outline");
|
||||
|
||||
@@ -188,6 +181,7 @@ void Mixing::register_mqtt_ha_config(bool force) {
|
||||
doc["stat_t"] = stat_t;
|
||||
|
||||
doc["val_tpl"] = F("{{value_json.type}}"); // HA needs a single value. We take the type which is wwc or hc
|
||||
|
||||
JsonObject dev = doc.createNestedObject("dev");
|
||||
dev["name"] = F("EMS-ESP Mixing");
|
||||
dev["sw"] = EMSESP_APP_VERSION;
|
||||
@@ -220,54 +214,72 @@ void Mixing::register_mqtt_ha_config(bool force) {
|
||||
mqtt_ha_config_ = true; // done
|
||||
}
|
||||
|
||||
bool Mixing::export_values(JsonObject & json) {
|
||||
return export_values_format(Mqtt::Format::NESTED, json);
|
||||
}
|
||||
|
||||
// creates JSON doc from values
|
||||
// returns false if empty
|
||||
bool Mixing::export_values(uint8_t mqtt_format, JsonObject & output) {
|
||||
JsonObject output_hc;
|
||||
bool Mixing::export_values_format(uint8_t mqtt_format, JsonObject & json) {
|
||||
// check if there is data for the mixing unit
|
||||
if (!Helpers::hasValue(status_)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
JsonObject json_hc;
|
||||
char hc_name[10]; // hc{1-4}
|
||||
|
||||
if (this->type() == Type::HC) {
|
||||
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_);
|
||||
if (mqtt_format == Mqtt::Format::NESTED || mqtt_format == Mqtt::Format::HA) {
|
||||
output_hc = output.createNestedObject(hc_name);
|
||||
if (mqtt_format == Mqtt::Format::NESTED) {
|
||||
json_hc = json.createNestedObject(hc_name);
|
||||
} else if (mqtt_format == Mqtt::Format::HA) {
|
||||
json_hc = json.createNestedObject(hc_name);
|
||||
json_hc["type"] = F("hc");
|
||||
} else {
|
||||
output_hc = output;
|
||||
output["type"] = F("hc");
|
||||
json_hc = json;
|
||||
json["type"] = F("hc");
|
||||
}
|
||||
if (Helpers::hasValue(flowTemp_)) {
|
||||
output_hc["flowTemp"] = (float)flowTemp_ / 10;
|
||||
json_hc["flowTemp"] = (float)flowTemp_ / 10;
|
||||
}
|
||||
if (Helpers::hasValue(flowSetTemp_)) {
|
||||
output_hc["flowSetTemp"] = flowSetTemp_;
|
||||
json_hc["flowSetTemp"] = flowSetTemp_;
|
||||
}
|
||||
if (Helpers::hasValue(pumpStatus_)) {
|
||||
char s[5];
|
||||
output_hc["pumpStatus"] = Helpers::render_value(s, pumpStatus_, EMS_VALUE_BOOL);
|
||||
json_hc["pumpStatus"] = Helpers::render_value(s, pumpStatus_, EMS_VALUE_BOOL);
|
||||
}
|
||||
if (Helpers::hasValue(status_)) {
|
||||
output_hc["valveStatus"] = status_;
|
||||
}
|
||||
} else {
|
||||
snprintf_P(hc_name, sizeof(hc_name), PSTR("wwc%d"), hc_);
|
||||
if (mqtt_format == Mqtt::Format::NESTED || mqtt_format == Mqtt::Format::HA) {
|
||||
output_hc = output.createNestedObject(hc_name);
|
||||
} else {
|
||||
output_hc = output;
|
||||
output["type"] = F("wwc");
|
||||
}
|
||||
if (Helpers::hasValue(flowTemp_)) {
|
||||
output_hc["wwTemp"] = (float)flowTemp_ / 10;
|
||||
}
|
||||
if (Helpers::hasValue(pumpStatus_)) {
|
||||
char s[5];
|
||||
output_hc["pumpStatus"] = Helpers::render_value(s, pumpStatus_, EMS_VALUE_BOOL);
|
||||
}
|
||||
if (Helpers::hasValue(status_)) {
|
||||
output_hc["tempStatus"] = status_;
|
||||
json_hc["valveStatus"] = status_;
|
||||
}
|
||||
|
||||
return json_hc.size();
|
||||
}
|
||||
|
||||
return output.size();
|
||||
// WWC
|
||||
snprintf_P(hc_name, sizeof(hc_name), PSTR("wwc%d"), hc_);
|
||||
if (mqtt_format == Mqtt::Format::NESTED) {
|
||||
json_hc = json.createNestedObject(hc_name);
|
||||
} else if (mqtt_format == Mqtt::Format::HA) {
|
||||
json_hc = json.createNestedObject(hc_name);
|
||||
json_hc["type"] = F("wwc");
|
||||
} else {
|
||||
json_hc = json;
|
||||
json["type"] = F("wwc");
|
||||
}
|
||||
if (Helpers::hasValue(flowTemp_)) {
|
||||
json_hc["wwTemp"] = (float)flowTemp_ / 10;
|
||||
}
|
||||
if (Helpers::hasValue(pumpStatus_)) {
|
||||
char s[5];
|
||||
json_hc["pumpStatus"] = Helpers::render_value(s, pumpStatus_, EMS_VALUE_BOOL);
|
||||
}
|
||||
if (Helpers::hasValue(status_)) {
|
||||
json_hc["tempStatus"] = status_;
|
||||
}
|
||||
|
||||
return json_hc.size();
|
||||
}
|
||||
|
||||
// heating circuits 0x02D7, 0x02D8 etc...
|
||||
@@ -298,14 +310,17 @@ void Mixing::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> tel
|
||||
// A1 00 FF 00 00 0C 02 04 00 01 1D 00 82
|
||||
void Mixing::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
type(Type::HC);
|
||||
hc_ = device_id() - 0x20 + 1;
|
||||
hc_ = device_id() - 0x20 + 1;
|
||||
|
||||
// check if circuit is active, 0-off, 1-unmixed, 2-mixed
|
||||
uint8_t ismixed = 0;
|
||||
changed_ |= telegram->read_value(ismixed, 0); // check if circuit is active, 0-off, 1-unmixed, 2-mixed
|
||||
changed_ |= telegram->read_value(ismixed, 0);
|
||||
if (ismixed == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ismixed == 2) { // we have a mixed circuit
|
||||
// do we have a mixed circuit
|
||||
if (ismixed == 2) {
|
||||
changed_ |= telegram->read_value(flowTemp_, 3); // is * 10
|
||||
changed_ |= telegram->read_value(flowSetTemp_, 5);
|
||||
changed_ |= telegram->read_value(status_, 2); // valve status
|
||||
|
||||
@@ -37,16 +37,16 @@ class Mixing : public EMSdevice {
|
||||
Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||
|
||||
virtual void show_values(uuid::console::Shell & shell);
|
||||
virtual void publish_values(JsonObject & data, bool force);
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
|
||||
private:
|
||||
static uuid::log::Logger logger_;
|
||||
|
||||
bool export_values(uint8_t mqtt_format, JsonObject & doc);
|
||||
bool export_values_format(uint8_t mqtt_format, JsonObject & doc);
|
||||
void register_mqtt_ha_config(bool force);
|
||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
||||
|
||||
void process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> telegram);
|
||||
void process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram);
|
||||
@@ -73,9 +73,10 @@ class Mixing : public EMSdevice {
|
||||
uint16_t hc_ = EMS_VALUE_USHORT_NOTSET;
|
||||
uint16_t flowTemp_ = EMS_VALUE_USHORT_NOTSET;
|
||||
uint8_t pumpStatus_ = EMS_VALUE_UINT_NOTSET;
|
||||
int8_t status_ = EMS_VALUE_UINT_NOTSET;
|
||||
uint8_t status_ = EMS_VALUE_UINT_NOTSET;
|
||||
uint8_t flowSetTemp_ = EMS_VALUE_UINT_NOTSET;
|
||||
Type type_ = Type::NONE;
|
||||
|
||||
Type type_ = Type::NONE;
|
||||
|
||||
bool changed_ = false;
|
||||
bool mqtt_ha_config_ = false; // for HA MQTT Discovery
|
||||
|
||||
@@ -52,39 +52,30 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s
|
||||
register_telegram_type(0x0103, F("ISM1StatusMessage"), true, [&](std::shared_ptr<const Telegram> t) { process_ISM1StatusMessage(t); });
|
||||
register_telegram_type(0x0101, F("ISM1Set"), false, [&](std::shared_ptr<const Telegram> t) { process_ISM1Set(t); });
|
||||
}
|
||||
|
||||
// API call
|
||||
Command::add_with_json(this->device_type(), F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
||||
return command_info(value, id, object);
|
||||
});
|
||||
}
|
||||
|
||||
bool Solar::command_info(const char * value, const int8_t id, JsonObject & output) {
|
||||
return (export_values(output));
|
||||
}
|
||||
|
||||
// print to web
|
||||
void Solar::device_info_web(JsonArray & root) {
|
||||
// fetch the values into a JSON document
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (!export_values(output)) {
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
if (!export_values(json)) {
|
||||
return; // empty
|
||||
}
|
||||
|
||||
print_value_json(root, F("collectorTemp"), nullptr, F_(collectorTemp), F_(degrees), output);
|
||||
print_value_json(root, F("tankBottomTemp"), nullptr, F_(tankBottomTemp), F_(degrees), output);
|
||||
print_value_json(root, F("tankBottomTemp2"), nullptr, F_(tankBottomTemp2), F_(degrees), output);
|
||||
print_value_json(root, F("heatExchangerTemp"), nullptr, F_(heatExchangerTemp), F_(degrees), output);
|
||||
print_value_json(root, F("solarPumpModulation"), nullptr, F_(solarPumpModulation), F_(percent), output);
|
||||
print_value_json(root, F("cylinderPumpModulation"), nullptr, F_(cylinderPumpModulation), F_(percent), output);
|
||||
print_value_json(root, F("valveStatus"), nullptr, F_(valveStatus), nullptr, output);
|
||||
print_value_json(root, F("solarPump"), nullptr, F_(solarPump), nullptr, output);
|
||||
print_value_json(root, F("tankHeated"), nullptr, F_(tankHeated), nullptr, output);
|
||||
print_value_json(root, F("collectorShutdown"), nullptr, F_(collectorShutdown), nullptr, output);
|
||||
print_value_json(root, F("energyLastHour"), nullptr, F_(energyLastHour), F_(wh), output);
|
||||
print_value_json(root, F("energyToday"), nullptr, F_(energyToday), F_(wh), output);
|
||||
print_value_json(root, F("energyTotal"), nullptr, F_(energyTotal), F_(kwh), output);
|
||||
print_value_json(root, F("collectorTemp"), nullptr, F_(collectorTemp), F_(degrees), json);
|
||||
print_value_json(root, F("tankBottomTemp"), nullptr, F_(tankBottomTemp), F_(degrees), json);
|
||||
print_value_json(root, F("tankBottomTemp2"), nullptr, F_(tankBottomTemp2), F_(degrees), json);
|
||||
print_value_json(root, F("heatExchangerTemp"), nullptr, F_(heatExchangerTemp), F_(degrees), json);
|
||||
print_value_json(root, F("solarPumpModulation"), nullptr, F_(solarPumpModulation), F_(percent), json);
|
||||
print_value_json(root, F("cylinderPumpModulation"), nullptr, F_(cylinderPumpModulation), F_(percent), json);
|
||||
print_value_json(root, F("valveStatus"), nullptr, F_(valveStatus), nullptr, json);
|
||||
print_value_json(root, F("solarPump"), nullptr, F_(solarPump), nullptr, json);
|
||||
print_value_json(root, F("tankHeated"), nullptr, F_(tankHeated), nullptr, json);
|
||||
print_value_json(root, F("collectorShutdown"), nullptr, F_(collectorShutdown), nullptr, json);
|
||||
print_value_json(root, F("energyLastHour"), nullptr, F_(energyLastHour), F_(wh), json);
|
||||
print_value_json(root, F("energyToday"), nullptr, F_(energyToday), F_(wh), json);
|
||||
print_value_json(root, F("energyTotal"), nullptr, F_(energyTotal), F_(kwh), json);
|
||||
|
||||
if (Helpers::hasValue(pumpWorkMin_)) {
|
||||
JsonObject dataElement = root.createNestedObject();
|
||||
@@ -101,24 +92,24 @@ void Solar::show_values(uuid::console::Shell & shell) {
|
||||
|
||||
// fetch the values into a JSON document
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (!export_values(output)) {
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
if (!export_values(json)) {
|
||||
return; // empty
|
||||
}
|
||||
|
||||
print_value_json(shell, F("collectorTemp"), nullptr, F_(collectorTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("tankBottomTemp"), nullptr, F_(tankBottomTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("tankBottomTemp2"), nullptr, F_(tankBottomTemp2), F_(degrees), output);
|
||||
print_value_json(shell, F("heatExchangerTemp"), nullptr, F_(heatExchangerTemp), F_(degrees), output);
|
||||
print_value_json(shell, F("solarPumpModulation"), nullptr, F_(solarPumpModulation), F_(percent), output);
|
||||
print_value_json(shell, F("cylinderPumpModulation"), nullptr, F_(cylinderPumpModulation), F_(percent), output);
|
||||
print_value_json(shell, F("valveStatus"), nullptr, F_(valveStatus), nullptr, output);
|
||||
print_value_json(shell, F("solarPump"), nullptr, F_(solarPump), nullptr, output);
|
||||
print_value_json(shell, F("tankHeated"), nullptr, F_(tankHeated), nullptr, output);
|
||||
print_value_json(shell, F("collectorShutdown"), nullptr, F_(collectorShutdown), nullptr, output);
|
||||
print_value_json(shell, F("energyLastHour"), nullptr, F_(energyLastHour), F_(wh), output);
|
||||
print_value_json(shell, F("energyToday"), nullptr, F_(energyToday), F_(wh), output);
|
||||
print_value_json(shell, F("energyTotal"), nullptr, F_(energyTotal), F_(kwh), output);
|
||||
print_value_json(shell, F("collectorTemp"), nullptr, F_(collectorTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("tankBottomTemp"), nullptr, F_(tankBottomTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("tankBottomTemp2"), nullptr, F_(tankBottomTemp2), F_(degrees), json);
|
||||
print_value_json(shell, F("heatExchangerTemp"), nullptr, F_(heatExchangerTemp), F_(degrees), json);
|
||||
print_value_json(shell, F("solarPumpModulation"), nullptr, F_(solarPumpModulation), F_(percent), json);
|
||||
print_value_json(shell, F("cylinderPumpModulation"), nullptr, F_(cylinderPumpModulation), F_(percent), json);
|
||||
print_value_json(shell, F("valveStatus"), nullptr, F_(valveStatus), nullptr, json);
|
||||
print_value_json(shell, F("solarPump"), nullptr, F_(solarPump), nullptr, json);
|
||||
print_value_json(shell, F("tankHeated"), nullptr, F_(tankHeated), nullptr, json);
|
||||
print_value_json(shell, F("collectorShutdown"), nullptr, F_(collectorShutdown), nullptr, json);
|
||||
print_value_json(shell, F("energyLastHour"), nullptr, F_(energyLastHour), F_(wh), json);
|
||||
print_value_json(shell, F("energyToday"), nullptr, F_(energyToday), F_(wh), json);
|
||||
print_value_json(shell, F("energyTotal"), nullptr, F_(energyTotal), F_(kwh), json);
|
||||
|
||||
if (Helpers::hasValue(pumpWorkMin_)) {
|
||||
shell.printfln(F(" %s: %d days %d hours %d minutes"),
|
||||
@@ -130,15 +121,15 @@ void Solar::show_values(uuid::console::Shell & shell) {
|
||||
}
|
||||
|
||||
// publish values via MQTT
|
||||
void Solar::publish_values(JsonObject & data, bool force) {
|
||||
void Solar::publish_values(JsonObject & json, bool force) {
|
||||
// handle HA first
|
||||
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
||||
register_mqtt_ha_config(force);
|
||||
}
|
||||
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
if (export_values(output)) {
|
||||
JsonObject json_payload = doc.to<JsonObject>();
|
||||
if (export_values(json_payload)) {
|
||||
if (device_id() == 0x2A) {
|
||||
Mqtt::publish(F("ww_data"), doc.as<JsonObject>());
|
||||
} else {
|
||||
@@ -197,66 +188,66 @@ void Solar::register_mqtt_ha_config(bool force) {
|
||||
|
||||
// creates JSON doc from values
|
||||
// returns false if empty
|
||||
bool Solar::export_values(JsonObject & output) {
|
||||
bool Solar::export_values(JsonObject & json) {
|
||||
char s[10]; // for formatting strings
|
||||
|
||||
if (Helpers::hasValue(collectorTemp_)) {
|
||||
output["collectorTemp"] = (float)collectorTemp_ / 10;
|
||||
json["collectorTemp"] = (float)collectorTemp_ / 10;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(tankBottomTemp_)) {
|
||||
output["tankBottomTemp"] = (float)tankBottomTemp_ / 10;
|
||||
json["tankBottomTemp"] = (float)tankBottomTemp_ / 10;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(tankBottomTemp2_)) {
|
||||
output["tankBottomTemp2"] = (float)tankBottomTemp2_ / 10;
|
||||
json["tankBottomTemp2"] = (float)tankBottomTemp2_ / 10;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(heatExchangerTemp_)) {
|
||||
output["heatExchangerTemp"] = (float)heatExchangerTemp_ / 10;
|
||||
json["heatExchangerTemp"] = (float)heatExchangerTemp_ / 10;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(solarPumpModulation_)) {
|
||||
output["solarPumpModulation"] = solarPumpModulation_;
|
||||
json["solarPumpModulation"] = solarPumpModulation_;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(cylinderPumpModulation_)) {
|
||||
output["cylinderPumpModulation"] = cylinderPumpModulation_;
|
||||
json["cylinderPumpModulation"] = cylinderPumpModulation_;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(solarPump_, EMS_VALUE_BOOL)) {
|
||||
output["solarPump"] = Helpers::render_value(s, solarPump_, EMS_VALUE_BOOL);
|
||||
json["solarPump"] = Helpers::render_value(s, solarPump_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(valveStatus_, EMS_VALUE_BOOL)) {
|
||||
output["valveStatus"] = Helpers::render_value(s, valveStatus_, EMS_VALUE_BOOL);
|
||||
json["valveStatus"] = Helpers::render_value(s, valveStatus_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(pumpWorkMin_)) {
|
||||
output["pumpWorkMin"] = pumpWorkMin_;
|
||||
json["pumpWorkMin"] = pumpWorkMin_;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(tankHeated_, EMS_VALUE_BOOL)) {
|
||||
output["tankHeated"] = Helpers::render_value(s, tankHeated_, EMS_VALUE_BOOL);
|
||||
json["tankHeated"] = Helpers::render_value(s, tankHeated_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(collectorShutdown_, EMS_VALUE_BOOL)) {
|
||||
output["collectorShutdown"] = Helpers::render_value(s, collectorShutdown_, EMS_VALUE_BOOL);
|
||||
json["collectorShutdown"] = Helpers::render_value(s, collectorShutdown_, EMS_VALUE_BOOL);
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(energyLastHour_)) {
|
||||
output["energyLastHour"] = (float)energyLastHour_ / 10;
|
||||
json["energyLastHour"] = (float)energyLastHour_ / 10;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(energyToday_)) {
|
||||
output["energyToday"] = energyToday_;
|
||||
json["energyToday"] = energyToday_;
|
||||
}
|
||||
|
||||
if (Helpers::hasValue(energyTotal_)) {
|
||||
output["energyTotal"] = (float)energyTotal_ / 10;
|
||||
json["energyTotal"] = (float)energyTotal_ / 10;
|
||||
}
|
||||
|
||||
return output.size();
|
||||
return json.size();
|
||||
}
|
||||
|
||||
// check to see if values have been updated
|
||||
|
||||
@@ -37,16 +37,14 @@ class Solar : public EMSdevice {
|
||||
Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||
|
||||
virtual void show_values(uuid::console::Shell & shell);
|
||||
virtual void publish_values(JsonObject & data, bool force);
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
|
||||
private:
|
||||
static uuid::log::Logger logger_;
|
||||
|
||||
bool export_values(JsonObject & doc);
|
||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
||||
void register_mqtt_ha_config(bool force);
|
||||
void register_mqtt_ha_config(bool force);
|
||||
|
||||
int16_t collectorTemp_ = EMS_VALUE_SHORT_NOTSET; // TS1: Temperature sensor for collector array 1
|
||||
int16_t tankBottomTemp_ = EMS_VALUE_SHORT_NOTSET; // TS2: Temperature sensor 1 cylinder, bottom (solar thermal system)
|
||||
|
||||
@@ -22,7 +22,9 @@ namespace emsesp {
|
||||
|
||||
REGISTER_FACTORY(Switch, EMSdevice::DeviceType::SWITCH);
|
||||
|
||||
uuid::log::Logger Switch::logger_{F_(switch), uuid::log::Facility::CONSOLE};
|
||||
uuid::log::Logger Switch::logger_ {
|
||||
F_(switch), uuid::log::Facility::CONSOLE
|
||||
};
|
||||
|
||||
Switch::Switch(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand)
|
||||
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
|
||||
@@ -37,7 +39,12 @@ void Switch::show_values(uuid::console::Shell & shell) {
|
||||
}
|
||||
|
||||
// publish values via MQTT
|
||||
void Switch::publish_values(JsonObject & data, bool force) {
|
||||
void Switch::publish_values(JsonObject & json, bool force) {
|
||||
}
|
||||
|
||||
// export values to JSON
|
||||
bool Switch::export_values(JsonObject & json) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// check to see if values have been updated
|
||||
|
||||
@@ -36,13 +36,13 @@ class Switch : public EMSdevice {
|
||||
Switch(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||
|
||||
virtual void show_values(uuid::console::Shell & shell);
|
||||
virtual void publish_values(JsonObject & data, bool force);
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
|
||||
private:
|
||||
static uuid::log::Logger logger_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
@@ -173,57 +173,57 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
|
||||
// prepare data for Web UI
|
||||
void Thermostat::device_info_web(JsonArray & root) {
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc_main;
|
||||
JsonObject output_main = doc_main.to<JsonObject>();
|
||||
if (export_values_main(output_main)) {
|
||||
print_value_json(root, F("time"), nullptr, F_(time), nullptr, output_main);
|
||||
print_value_json(root, F("errorcode"), nullptr, F_(error), nullptr, output_main);
|
||||
print_value_json(root, F("display"), nullptr, F_(display), nullptr, output_main);
|
||||
print_value_json(root, F("language"), nullptr, F_(language), nullptr, output_main);
|
||||
print_value_json(root, F("offsetclock"), nullptr, F_(offsetclock), nullptr, output_main);
|
||||
print_value_json(root, F("dampedtemp"), nullptr, F_(dampedtemp), F_(degrees), output_main);
|
||||
print_value_json(root, F("inttemp1"), nullptr, F_(inttemp1), F_(degrees), output_main);
|
||||
print_value_json(root, F("inttemp2"), nullptr, F_(inttemp2), F_(degrees), output_main);
|
||||
print_value_json(root, F("intoffset"), nullptr, F_(intoffset), nullptr, output_main);
|
||||
print_value_json(root, F("minexttemp"), nullptr, F_(minexttemp), F_(degrees), output_main);
|
||||
print_value_json(root, F("building"), nullptr, F_(building), nullptr, output_main);
|
||||
print_value_json(root, F("wwmode"), nullptr, F_(wwmode), nullptr, output_main);
|
||||
print_value_json(root, F("wwtemp"), nullptr, F_(wwtemp), nullptr, output_main);
|
||||
print_value_json(root, F("wwtemplow"), nullptr, F_(wwtemplow), nullptr, output_main);
|
||||
print_value_json(root, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, output_main);
|
||||
JsonObject json_main = doc_main.to<JsonObject>();
|
||||
if (export_values_main(json_main)) {
|
||||
print_value_json(root, F("time"), nullptr, F_(time), nullptr, json_main);
|
||||
print_value_json(root, F("errorcode"), nullptr, F_(error), nullptr, json_main);
|
||||
print_value_json(root, F("display"), nullptr, F_(display), nullptr, json_main);
|
||||
print_value_json(root, F("language"), nullptr, F_(language), nullptr, json_main);
|
||||
print_value_json(root, F("offsetclock"), nullptr, F_(offsetclock), nullptr, json_main);
|
||||
print_value_json(root, F("dampedtemp"), nullptr, F_(dampedtemp), F_(degrees), json_main);
|
||||
print_value_json(root, F("inttemp1"), nullptr, F_(inttemp1), F_(degrees), json_main);
|
||||
print_value_json(root, F("inttemp2"), nullptr, F_(inttemp2), F_(degrees), json_main);
|
||||
print_value_json(root, F("intoffset"), nullptr, F_(intoffset), nullptr, json_main);
|
||||
print_value_json(root, F("minexttemp"), nullptr, F_(minexttemp), F_(degrees), json_main);
|
||||
print_value_json(root, F("building"), nullptr, F_(building), nullptr, json_main);
|
||||
print_value_json(root, F("wwmode"), nullptr, F_(wwmode), nullptr, json_main);
|
||||
print_value_json(root, F("wwtemp"), nullptr, F_(wwtemp), nullptr, json_main);
|
||||
print_value_json(root, F("wwtemplow"), nullptr, F_(wwtemplow), nullptr, json_main);
|
||||
print_value_json(root, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, json_main);
|
||||
}
|
||||
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc_hc;
|
||||
JsonObject output_hc = doc_hc.to<JsonObject>();
|
||||
JsonObject json_hc = doc_hc.to<JsonObject>();
|
||||
|
||||
if (export_values_hc(Mqtt::Format::NESTED, output_hc)) {
|
||||
if (export_values_hc(Mqtt::Format::NESTED, json_hc)) {
|
||||
// display for each active heating circuit
|
||||
for (const auto & hc : heating_circuits_) {
|
||||
if (hc->is_active()) {
|
||||
char prefix_str[10];
|
||||
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("hc%d"), hc->hc_num());
|
||||
JsonObject output = output_hc[prefix_str];
|
||||
JsonObject json = json_hc[prefix_str];
|
||||
|
||||
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(hc %d) "), hc->hc_num());
|
||||
|
||||
print_value_json(root, F("seltemp"), FPSTR(prefix_str), F_(seltemp), F_(degrees), output);
|
||||
print_value_json(root, F("currtemp"), FPSTR(prefix_str), F_(currtemp), F_(degrees), output);
|
||||
print_value_json(root, F("heattemp"), FPSTR(prefix_str), F_(heattemp), F_(degrees), output);
|
||||
print_value_json(root, F("comforttemp"), FPSTR(prefix_str), F_(comforttemp), F_(degrees), output);
|
||||
print_value_json(root, F("daytemp"), FPSTR(prefix_str), F_(daytemp), F_(degrees), output);
|
||||
print_value_json(root, F("ecotemp"), FPSTR(prefix_str), F_(ecotemp), F_(degrees), output);
|
||||
print_value_json(root, F("nighttemp"), FPSTR(prefix_str), F_(nighttemp), F_(degrees), output);
|
||||
print_value_json(root, F("manualtemp"), FPSTR(prefix_str), F_(manualtemp), F_(degrees), output);
|
||||
print_value_json(root, F("holidaytemp"), FPSTR(prefix_str), F_(holidaytemp), F_(degrees), output);
|
||||
print_value_json(root, F("nofrosttemp"), FPSTR(prefix_str), F_(nofrosttemp), F_(degrees), output);
|
||||
print_value_json(root, F("heatingtype"), FPSTR(prefix_str), F_(heatingtype), nullptr, output);
|
||||
print_value_json(root, F("targetflowtemp"), FPSTR(prefix_str), F_(targetflowtemp), F_(degrees), output);
|
||||
print_value_json(root, F("offsettemp"), FPSTR(prefix_str), F_(offsettemp), F_(degrees), output);
|
||||
print_value_json(root, F("designtemp"), FPSTR(prefix_str), F_(designtemp), F_(degrees), output);
|
||||
print_value_json(root, F("roominfluence"), FPSTR(prefix_str), F_(roominfluence), F_(degrees), output);
|
||||
print_value_json(root, F("summertemp"), FPSTR(prefix_str), F_(summertemp), F_(degrees), output);
|
||||
print_value_json(root, F("summermode"), FPSTR(prefix_str), F_(summermode), F_(degrees), output);
|
||||
print_value_json(root, F("mode"), FPSTR(prefix_str), F_(mode), nullptr, output);
|
||||
print_value_json(root, F("modetype"), FPSTR(prefix_str), F_(modetype), nullptr, output);
|
||||
print_value_json(root, F("seltemp"), FPSTR(prefix_str), F_(seltemp), F_(degrees), json);
|
||||
print_value_json(root, F("currtemp"), FPSTR(prefix_str), F_(currtemp), F_(degrees), json);
|
||||
print_value_json(root, F("heattemp"), FPSTR(prefix_str), F_(heattemp), F_(degrees), json);
|
||||
print_value_json(root, F("comforttemp"), FPSTR(prefix_str), F_(comforttemp), F_(degrees), json);
|
||||
print_value_json(root, F("daytemp"), FPSTR(prefix_str), F_(daytemp), F_(degrees), json);
|
||||
print_value_json(root, F("ecotemp"), FPSTR(prefix_str), F_(ecotemp), F_(degrees), json);
|
||||
print_value_json(root, F("nighttemp"), FPSTR(prefix_str), F_(nighttemp), F_(degrees), json);
|
||||
print_value_json(root, F("manualtemp"), FPSTR(prefix_str), F_(manualtemp), F_(degrees), json);
|
||||
print_value_json(root, F("holidaytemp"), FPSTR(prefix_str), F_(holidaytemp), F_(degrees), json);
|
||||
print_value_json(root, F("nofrosttemp"), FPSTR(prefix_str), F_(nofrosttemp), F_(degrees), json);
|
||||
print_value_json(root, F("heatingtype"), FPSTR(prefix_str), F_(heatingtype), nullptr, json);
|
||||
print_value_json(root, F("targetflowtemp"), FPSTR(prefix_str), F_(targetflowtemp), F_(degrees), json);
|
||||
print_value_json(root, F("offsettemp"), FPSTR(prefix_str), F_(offsettemp), F_(degrees), json);
|
||||
print_value_json(root, F("designtemp"), FPSTR(prefix_str), F_(designtemp), F_(degrees), json);
|
||||
print_value_json(root, F("roominfluence"), FPSTR(prefix_str), F_(roominfluence), F_(degrees), json);
|
||||
print_value_json(root, F("summertemp"), FPSTR(prefix_str), F_(summertemp), F_(degrees), json);
|
||||
print_value_json(root, F("summermode"), FPSTR(prefix_str), F_(summermode), F_(degrees), json);
|
||||
print_value_json(root, F("mode"), FPSTR(prefix_str), F_(mode), nullptr, json);
|
||||
print_value_json(root, F("modetype"), FPSTR(prefix_str), F_(modetype), nullptr, json);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,12 +243,9 @@ bool Thermostat::updated_values() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// info API command
|
||||
// returns the same MQTT publish payload in Nested format
|
||||
bool Thermostat::command_info(const char * value, const int8_t id, JsonObject & output) {
|
||||
bool has_value = false;
|
||||
has_value |= export_values_main(output);
|
||||
has_value |= export_values_hc(Mqtt::Format::NESTED, output);
|
||||
bool Thermostat::export_values(JsonObject & json) {
|
||||
bool has_value = export_values_main(json);
|
||||
has_value |= export_values_hc(Mqtt::Format::NESTED, json);
|
||||
return has_value;
|
||||
}
|
||||
|
||||
@@ -257,30 +254,30 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
||||
EMSdevice::show_values(shell); // always call this to show header
|
||||
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc_main;
|
||||
JsonObject output_main = doc_main.to<JsonObject>();
|
||||
if (export_values_main(output_main)) {
|
||||
print_value_json(shell, F("time"), nullptr, F_(time), nullptr, output_main);
|
||||
print_value_json(shell, F("errorcode"), nullptr, F_(error), nullptr, output_main);
|
||||
print_value_json(shell, F("display"), nullptr, F_(display), nullptr, output_main);
|
||||
print_value_json(shell, F("language"), nullptr, F_(language), nullptr, output_main);
|
||||
print_value_json(shell, F("offsetclock"), nullptr, F_(offsetclock), nullptr, output_main);
|
||||
print_value_json(shell, F("dampedtemp"), nullptr, F_(dampedtemp), F_(degrees), output_main);
|
||||
print_value_json(shell, F("inttemp1"), nullptr, F_(inttemp1), F_(degrees), output_main);
|
||||
print_value_json(shell, F("inttemp2"), nullptr, F_(inttemp2), F_(degrees), output_main);
|
||||
print_value_json(shell, F("intoffset"), nullptr, F_(intoffset), nullptr, output_main);
|
||||
print_value_json(shell, F("minexttemp"), nullptr, F_(minexttemp), F_(degrees), output_main);
|
||||
print_value_json(shell, F("building"), nullptr, F_(building), nullptr, output_main);
|
||||
print_value_json(shell, F("wwmode"), nullptr, F_(wwmode), nullptr, output_main);
|
||||
print_value_json(shell, F("wwtemp"), nullptr, F_(wwtemp), nullptr, output_main);
|
||||
print_value_json(shell, F("wwtemplow"), nullptr, F_(wwtemplow), nullptr, output_main);
|
||||
print_value_json(shell, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, output_main);
|
||||
JsonObject json_main = doc_main.to<JsonObject>();
|
||||
if (export_values_main(json_main)) {
|
||||
print_value_json(shell, F("time"), nullptr, F_(time), nullptr, json_main);
|
||||
print_value_json(shell, F("errorcode"), nullptr, F_(error), nullptr, json_main);
|
||||
print_value_json(shell, F("display"), nullptr, F_(display), nullptr, json_main);
|
||||
print_value_json(shell, F("language"), nullptr, F_(language), nullptr, json_main);
|
||||
print_value_json(shell, F("offsetclock"), nullptr, F_(offsetclock), nullptr, json_main);
|
||||
print_value_json(shell, F("dampedtemp"), nullptr, F_(dampedtemp), F_(degrees), json_main);
|
||||
print_value_json(shell, F("inttemp1"), nullptr, F_(inttemp1), F_(degrees), json_main);
|
||||
print_value_json(shell, F("inttemp2"), nullptr, F_(inttemp2), F_(degrees), json_main);
|
||||
print_value_json(shell, F("intoffset"), nullptr, F_(intoffset), nullptr, json_main);
|
||||
print_value_json(shell, F("minexttemp"), nullptr, F_(minexttemp), F_(degrees), json_main);
|
||||
print_value_json(shell, F("building"), nullptr, F_(building), nullptr, json_main);
|
||||
print_value_json(shell, F("wwmode"), nullptr, F_(wwmode), nullptr, json_main);
|
||||
print_value_json(shell, F("wwtemp"), nullptr, F_(wwtemp), nullptr, json_main);
|
||||
print_value_json(shell, F("wwtemplow"), nullptr, F_(wwtemplow), nullptr, json_main);
|
||||
print_value_json(shell, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, json_main);
|
||||
}
|
||||
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc_hc;
|
||||
JsonObject output_hc = doc_hc.to<JsonObject>();
|
||||
JsonObject json_hc = doc_hc.to<JsonObject>();
|
||||
// e.g. {"hc1":{"seltemp":849.4,"currtemp":819.2,"mode":"unknown","modetype":"day"},"hc2":{"seltemp":875.1,"currtemp":409.6,"mode":"unknown","modetype":"day"},"hc3":{"seltemp":0,"currtemp":0,"mode":"unknown","modetype":"day"}}
|
||||
|
||||
if (export_values_hc(Mqtt::Format::NESTED, output_hc)) {
|
||||
if (export_values_hc(Mqtt::Format::NESTED, json_hc)) {
|
||||
// display for each active heating circuit
|
||||
for (const auto & hc : heating_circuits_) {
|
||||
if (hc->is_active()) {
|
||||
@@ -288,26 +285,26 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
||||
|
||||
char hc_name[10]; // hc{1-4}
|
||||
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc->hc_num());
|
||||
JsonObject output = output_hc[hc_name];
|
||||
JsonObject json = json_hc[hc_name];
|
||||
|
||||
print_value_json(shell, F("seltemp"), F_(2spaces), F_(seltemp), F_(degrees), output);
|
||||
print_value_json(shell, F("currtemp"), F_(2spaces), F_(currtemp), F_(degrees), output);
|
||||
print_value_json(shell, F("heattemp"), F_(2spaces), F_(heattemp), F_(degrees), output);
|
||||
print_value_json(shell, F("comforttemp"), F_(2spaces), F_(comforttemp), F_(degrees), output);
|
||||
print_value_json(shell, F("daytemp"), F_(2spaces), F_(daytemp), F_(degrees), output);
|
||||
print_value_json(shell, F("ecotemp"), F_(2spaces), F_(ecotemp), F_(degrees), output);
|
||||
print_value_json(shell, F("nighttemp"), F_(2spaces), F_(nighttemp), F_(degrees), output);
|
||||
print_value_json(shell, F("manualtemp"), F_(2spaces), F_(manualtemp), F_(degrees), output);
|
||||
print_value_json(shell, F("holidaytemp"), F_(2spaces), F_(holidaytemp), F_(degrees), output);
|
||||
print_value_json(shell, F("nofrosttemp"), F_(2spaces), F_(nofrosttemp), F_(degrees), output);
|
||||
print_value_json(shell, F("targetflowtemp"), F_(2spaces), F_(targetflowtemp), F_(degrees), output);
|
||||
print_value_json(shell, F("offsettemp"), F_(2spaces), F_(offsettemp), F_(degrees), output);
|
||||
print_value_json(shell, F("designtemp"), F_(2spaces), F_(designtemp), F_(degrees), output);
|
||||
print_value_json(shell, F("roominfluence"), F_(2spaces), F_(roominfluence), F_(degrees), output);
|
||||
print_value_json(shell, F("summertemp"), F_(2spaces), F_(summertemp), F_(degrees), output);
|
||||
print_value_json(shell, F("summermode"), F_(2spaces), F_(summermode), F_(degrees), output);
|
||||
print_value_json(shell, F("mode"), F_(2spaces), F_(mode), nullptr, output);
|
||||
print_value_json(shell, F("modetype"), F_(2spaces), F_(modetype), nullptr, output);
|
||||
print_value_json(shell, F("seltemp"), F_(2spaces), F_(seltemp), F_(degrees), json);
|
||||
print_value_json(shell, F("currtemp"), F_(2spaces), F_(currtemp), F_(degrees), json);
|
||||
print_value_json(shell, F("heattemp"), F_(2spaces), F_(heattemp), F_(degrees), json);
|
||||
print_value_json(shell, F("comforttemp"), F_(2spaces), F_(comforttemp), F_(degrees), json);
|
||||
print_value_json(shell, F("daytemp"), F_(2spaces), F_(daytemp), F_(degrees), json);
|
||||
print_value_json(shell, F("ecotemp"), F_(2spaces), F_(ecotemp), F_(degrees), json);
|
||||
print_value_json(shell, F("nighttemp"), F_(2spaces), F_(nighttemp), F_(degrees), json);
|
||||
print_value_json(shell, F("manualtemp"), F_(2spaces), F_(manualtemp), F_(degrees), json);
|
||||
print_value_json(shell, F("holidaytemp"), F_(2spaces), F_(holidaytemp), F_(degrees), json);
|
||||
print_value_json(shell, F("nofrosttemp"), F_(2spaces), F_(nofrosttemp), F_(degrees), json);
|
||||
print_value_json(shell, F("targetflowtemp"), F_(2spaces), F_(targetflowtemp), F_(degrees), json);
|
||||
print_value_json(shell, F("offsettemp"), F_(2spaces), F_(offsettemp), F_(degrees), json);
|
||||
print_value_json(shell, F("designtemp"), F_(2spaces), F_(designtemp), F_(degrees), json);
|
||||
print_value_json(shell, F("roominfluence"), F_(2spaces), F_(roominfluence), F_(degrees), json);
|
||||
print_value_json(shell, F("summertemp"), F_(2spaces), F_(summertemp), F_(degrees), json);
|
||||
print_value_json(shell, F("summermode"), F_(2spaces), F_(summermode), F_(degrees), json);
|
||||
print_value_json(shell, F("mode"), F_(2spaces), F_(mode), nullptr, json);
|
||||
print_value_json(shell, F("modetype"), F_(2spaces), F_(modetype), nullptr, json);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,25 +312,25 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
||||
}
|
||||
|
||||
// publish values via MQTT
|
||||
void Thermostat::publish_values(JsonObject & data, bool force) {
|
||||
void Thermostat::publish_values(JsonObject & json, bool force) {
|
||||
if (EMSESP::actual_master_thermostat() != this->device_id()) {
|
||||
return;
|
||||
}
|
||||
|
||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||
JsonObject output = doc.to<JsonObject>();
|
||||
bool has_data = false;
|
||||
JsonObject json_data = doc.to<JsonObject>();
|
||||
bool has_data = false;
|
||||
|
||||
// if MQTT is in single mode send out the main data to the thermostat_data topic
|
||||
has_data |= export_values_main(output);
|
||||
has_data |= export_values_main(json_data);
|
||||
if (Mqtt::mqtt_format() == Mqtt::Format::SINGLE && has_data) {
|
||||
Mqtt::publish(F("thermostat_data"), output);
|
||||
output.clear();
|
||||
Mqtt::publish(F("thermostat_data"), json_data);
|
||||
json_data.clear();
|
||||
}
|
||||
|
||||
// get the thermostat data.
|
||||
// if we're in Single mode this function will also have published each of the heating circuits
|
||||
has_data |= export_values_hc(Mqtt::mqtt_format(), output);
|
||||
has_data |= export_values_hc(Mqtt::mqtt_format(), json_data);
|
||||
|
||||
// if we're in HA or CUSTOM, send out the complete topic with all the data
|
||||
if (Mqtt::mqtt_format() != Mqtt::Format::SINGLE && has_data) {
|
||||
@@ -341,7 +338,7 @@ void Thermostat::publish_values(JsonObject & data, bool force) {
|
||||
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
||||
ha_config(force);
|
||||
}
|
||||
Mqtt::publish(F("thermostat_data"), output);
|
||||
Mqtt::publish(F("thermostat_data"), json_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2164,11 +2161,6 @@ bool Thermostat::set_manualtemp(const char * value, const int8_t id) {
|
||||
|
||||
// API commands for MQTT and Console
|
||||
void Thermostat::add_commands() {
|
||||
// API call
|
||||
Command::add_with_json(this->device_type(), F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
||||
return command_info(value, id, object);
|
||||
});
|
||||
|
||||
// if this thermostat doesn't support write, don't add the commands
|
||||
if ((this->flags() & EMSdevice::EMS_DEVICE_FLAG_NO_WRITE) == EMSdevice::EMS_DEVICE_FLAG_NO_WRITE) {
|
||||
return;
|
||||
|
||||
@@ -100,7 +100,8 @@ class Thermostat : public EMSdevice {
|
||||
static std::string mode_tostring(uint8_t mode);
|
||||
|
||||
virtual void show_values(uuid::console::Shell & shell);
|
||||
virtual void publish_values(JsonObject & data, bool force);
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
|
||||
@@ -242,8 +243,6 @@ class Thermostat : public EMSdevice {
|
||||
void ha_config(bool force = false);
|
||||
bool thermostat_ha_cmd(const char * message, uint8_t hc_num);
|
||||
|
||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
||||
|
||||
void process_RCOutdoorTemp(std::shared_ptr<const Telegram> telegram);
|
||||
void process_IBASettings(std::shared_ptr<const Telegram> telegram);
|
||||
void process_RCTime(std::shared_ptr<const Telegram> telegram);
|
||||
|
||||
Reference in New Issue
Block a user