web and shell printing share common functions - refactor how device values are printed to shell #632

This commit is contained in:
proddy
2020-11-26 23:06:56 +01:00
parent 5fb8ca166b
commit 18b6dc645f
28 changed files with 282 additions and 648 deletions

View File

@@ -35,6 +35,7 @@ import { RestFormProps, FormButton } from "../components";
import { EMSESPDevices, EMSESPDeviceData, Device } from "./EMSESPtypes"; import { EMSESPDevices, EMSESPDeviceData, Device } from "./EMSESPtypes";
import { ENDPOINT_ROOT } from "../api"; import { ENDPOINT_ROOT } from "../api";
export const SCANDEVICES_ENDPOINT = ENDPOINT_ROOT + "scanDevices"; export const SCANDEVICES_ENDPOINT = ENDPOINT_ROOT + "scanDevices";
export const DEVICE_DATA_ENDPOINT = ENDPOINT_ROOT + "deviceData"; export const DEVICE_DATA_ENDPOINT = ENDPOINT_ROOT + "deviceData";
@@ -340,14 +341,18 @@ class EMSESPDevicesForm extends Component<
> >
<TableHead></TableHead> <TableHead></TableHead>
<TableBody> <TableBody>
{deviceData.deviceData.map((deviceData) => ( {deviceData.deviceData.map((item, i) => {
<TableRow key={deviceData.n}> if (i % 2) {
<TableCell component="th" scope="row"> return null;
{deviceData.n} } else {
</TableCell> return (
<TableCell align="right">{deviceData.v}</TableCell> <TableRow key={i}>
<TableCell component="th" scope="row">{deviceData.deviceData[i]}</TableCell>
<TableCell align="right">{deviceData.deviceData[i + 1]}</TableCell>
</TableRow> </TableRow>
))} );
}
})}
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>

View File

@@ -54,13 +54,7 @@ export interface EMSESPDevices {
sensors: Sensor[]; sensors: Sensor[];
} }
export interface DeviceData {
n: string;
v: string;
}
export interface EMSESPDeviceData { export interface EMSESPDeviceData {
deviceName: string; deviceName: string;
deviceData: DeviceData[]; deviceData: string[];
} }

View File

@@ -85,17 +85,17 @@ void Boiler::register_mqtt_ha_config() {
// Create the Master device // Create the Master device
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_HA_CONFIG> doc; StaticJsonDocument<EMSESP_MAX_JSON_SIZE_HA_CONFIG> doc;
doc["name"] = F("Service Code"); doc["name"] = FJSON("Service Code");
doc["uniq_id"] = F("boiler"); doc["uniq_id"] = FJSON("boiler");
doc["ic"] = F("mdi:home-thermometer-outline"); doc["ic"] = FJSON("mdi:home-thermometer-outline");
char stat_t[50]; char stat_t[50];
snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/boiler_data"), System::hostname().c_str()); snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/boiler_data"), System::hostname().c_str());
doc["stat_t"] = stat_t; doc["stat_t"] = stat_t;
doc["val_tpl"] = F("{{value_json.serviceCode}}"); doc["val_tpl"] = FJSON("{{value_json.serviceCode}}");
JsonObject dev = doc.createNestedObject("dev"); JsonObject dev = doc.createNestedObject("dev");
dev["name"] = F("EMS-ESP Boiler"); dev["name"] = FJSON("EMS-ESP Boiler");
dev["sw"] = EMSESP_APP_VERSION; dev["sw"] = EMSESP_APP_VERSION;
dev["mf"] = brand_to_string(); dev["mf"] = brand_to_string();
dev["mdl"] = name(); dev["mdl"] = name();
@@ -191,43 +191,47 @@ void Boiler::device_info_web(JsonArray & root) {
return; // empty return; // empty
} }
print_value_json(root, F("heatingActive"), nullptr, F_(heatingActive), nullptr, json); create_value_json(root, F("heatingActive"), nullptr, F_(heatingActive), nullptr, json);
print_value_json(root, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, json); create_value_json(root, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, json);
print_value_json(root, F("serviceCode"), nullptr, F_(serviceCode), nullptr, json); create_value_json(root, F("serviceCode"), nullptr, F_(serviceCode), nullptr, json);
print_value_json(root, F("serviceCodeNumber"), nullptr, F_(serviceCodeNumber), nullptr, json); create_value_json(root, F("serviceCodeNumber"), nullptr, F_(serviceCodeNumber), nullptr, json);
print_value_json(root, F("lastCode"), nullptr, F_(lastCode), nullptr, json); create_value_json(root, F("lastCode"), nullptr, F_(lastCode), nullptr, json);
print_value_json(root, F("selFlowTemp"), nullptr, F_(selFlowTemp), F_(degrees), json); create_value_json(root, F("selFlowTemp"), nullptr, F_(selFlowTemp), F_(degrees), json);
print_value_json(root, F("selBurnPow"), nullptr, F_(selBurnPow), F_(percent), json); create_value_json(root, F("selBurnPow"), nullptr, F_(selBurnPow), F_(percent), json);
print_value_json(root, F("curBurnPow"), nullptr, F_(curBurnPow), F_(percent), json); create_value_json(root, F("curBurnPow"), nullptr, F_(curBurnPow), F_(percent), json);
print_value_json(root, F("pumpMod"), nullptr, F_(pumpMod), F_(percent), json); create_value_json(root, F("pumpMod"), nullptr, F_(pumpMod), F_(percent), json);
print_value_json(root, F("pumpMod2"), nullptr, F_(pumpMod2), F_(percent), json); create_value_json(root, F("pumpMod2"), nullptr, F_(pumpMod2), F_(percent), json);
print_value_json(root, F("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), json); create_value_json(root, F("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), json);
print_value_json(root, F("curFlowTemp"), nullptr, F_(curFlowTemp), F_(degrees), json); create_value_json(root, F("curFlowTemp"), nullptr, F_(curFlowTemp), F_(degrees), json);
print_value_json(root, F("retTemp"), nullptr, F_(retTemp), F_(degrees), json); create_value_json(root, F("retTemp"), nullptr, F_(retTemp), F_(degrees), json);
print_value_json(root, F("switchTemp"), nullptr, F_(switchTemp), F_(degrees), json); create_value_json(root, F("switchTemp"), nullptr, F_(switchTemp), F_(degrees), json);
print_value_json(root, F("sysPress"), nullptr, F_(sysPress), nullptr, json); create_value_json(root, F("sysPress"), nullptr, F_(sysPress), nullptr, json);
print_value_json(root, F("boilTemp"), nullptr, F_(boilTemp), F_(degrees), json); create_value_json(root, F("boilTemp"), nullptr, F_(boilTemp), F_(degrees), json);
print_value_json(root, F("burnGas"), nullptr, F_(burnGas), nullptr, json); create_value_json(root, F("burnGas"), nullptr, F_(burnGas), nullptr, json);
print_value_json(root, F("flameCurr"), nullptr, F_(flameCurr), F_(uA), json); create_value_json(root, F("flameCurr"), nullptr, F_(flameCurr), F_(uA), json);
print_value_json(root, F("heatPump"), nullptr, F_(heatPump), nullptr, json); create_value_json(root, F("heatPump"), nullptr, F_(heatPump), nullptr, json);
print_value_json(root, F("fanWork"), nullptr, F_(fanWork), nullptr, json); create_value_json(root, F("fanWork"), nullptr, F_(fanWork), nullptr, json);
print_value_json(root, F("ignWork"), nullptr, F_(ignWork), nullptr, json); create_value_json(root, F("ignWork"), nullptr, F_(ignWork), nullptr, json);
print_value_json(root, F("heatingActivated"), nullptr, F_(heatingActivated), nullptr, json); create_value_json(root, F("heatingActivated"), nullptr, F_(heatingActivated), nullptr, json);
print_value_json(root, F("heatingTemp"), nullptr, F_(heatingTemp), F_(degrees), json); create_value_json(root, F("heatingTemp"), nullptr, F_(heatingTemp), F_(degrees), json);
print_value_json(root, F("pumpModMax"), nullptr, F_(pumpModMax), F_(percent), json); create_value_json(root, F("pumpModMax"), nullptr, F_(pumpModMax), F_(percent), json);
print_value_json(root, F("pumpModMin"), nullptr, F_(pumpModMin), F_(percent), json); create_value_json(root, F("pumpModMin"), nullptr, F_(pumpModMin), F_(percent), json);
print_value_json(root, F("pumpDelay"), nullptr, F_(pumpDelay), F_(min), json); create_value_json(root, F("pumpDelay"), nullptr, F_(pumpDelay), F_(min), json);
print_value_json(root, F("burnMinPeriod"), nullptr, F_(burnMinPeriod), F_(min), json); create_value_json(root, F("burnMinPeriod"), nullptr, F_(burnMinPeriod), F_(min), json);
print_value_json(root, F("burnMinPower"), nullptr, F_(burnMinPower), F_(percent), json); create_value_json(root, F("burnMinPower"), nullptr, F_(burnMinPower), F_(percent), json);
print_value_json(root, F("burnMaxPower"), nullptr, F_(burnMaxPower), F_(percent), json); create_value_json(root, F("burnMaxPower"), nullptr, F_(burnMaxPower), F_(percent), json);
print_value_json(root, F("boilHystOn"), nullptr, F_(boilHystOn), F_(degrees), json); create_value_json(root, F("boilHystOn"), nullptr, F_(boilHystOn), F_(degrees), json);
print_value_json(root, F("boilHystOff"), nullptr, F_(boilHystOff), F_(degrees), json); create_value_json(root, F("boilHystOff"), nullptr, F_(boilHystOff), F_(degrees), json);
print_value_json(root, F("setFlowTemp"), nullptr, F_(setFlowTemp), F_(degrees), json); create_value_json(root, F("setFlowTemp"), nullptr, F_(setFlowTemp), F_(degrees), json);
print_value_json(root, F("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), json); create_value_json(root, F("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), json);
print_value_json(root, F("burnStarts"), nullptr, F_(burnStarts), nullptr, json); create_value_json(root, F("burnStarts"), nullptr, F_(burnStarts), nullptr, json);
print_value_json(root, F("burnWorkMin"), nullptr, F_(burnWorkMin), F_(min), json); create_value_json(root, F("burnWorkMin"), nullptr, F_(burnWorkMin), F_(min), json);
print_value_json(root, F("heatWorkMin"), nullptr, F_(heatWorkMin), F_(min), json); create_value_json(root, F("heatWorkMin"), nullptr, F_(heatWorkMin), F_(min), json);
print_value_json(root, F("UBAuptime"), nullptr, F_(UBAuptime), F_(min), json); create_value_json(root, F("UBAuptime"), nullptr, F_(UBAuptime), F_(min), json);
create_value_json(root, F("burnWorkMintxt"), nullptr, F_(burnWorkMintxt), nullptr, json);
create_value_json(root, F("heatWorkMintxt"), nullptr, F_(heatWorkMintxt), nullptr, json);
create_value_json(root, F("UBAuptimetxt"), nullptr, F_(UBAuptimetxt), nullptr, json);
doc.clear(); doc.clear();
if (!export_values_ww(json)) { // append ww values if (!export_values_ww(json)) { // append ww values
@@ -235,33 +239,35 @@ void Boiler::device_info_web(JsonArray & root) {
} }
// ww // ww
print_value_json(root, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), json); create_value_json(root, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), json);
print_value_json(root, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), json); create_value_json(root, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), json);
print_value_json(root, F("wWDisinfectionTemp"), nullptr, F_(wWDisinfectionTemp), F_(degrees), json); create_value_json(root, F("wWDisinfectionTemp"), nullptr, F_(wWDisinfectionTemp), F_(degrees), json);
print_value_json(root, F("wWType"), nullptr, F_(wWType), nullptr, json); create_value_json(root, F("wWType"), nullptr, F_(wWType), nullptr, json);
print_value_json(root, F("wWChargeType"), nullptr, F_(wWChargeType), nullptr, json); create_value_json(root, F("wWChargeType"), nullptr, F_(wWChargeType), nullptr, json);
print_value_json(root, F("wWCircPump"), nullptr, F_(wWCircPump), nullptr, json); create_value_json(root, F("wWCircPump"), nullptr, F_(wWCircPump), nullptr, json);
print_value_json(root, F("wWCircPumpMode"), nullptr, F_(wWCircPumpMode), nullptr, json); create_value_json(root, F("wWCircPumpMode"), nullptr, F_(wWCircPumpMode), nullptr, json);
print_value_json(root, F("wWCirc"), nullptr, F_(wWCirc), nullptr, json); create_value_json(root, F("wWCirc"), nullptr, F_(wWCirc), nullptr, json);
print_value_json(root, F("wWCurTemp"), nullptr, F_(wWCurTemp), F_(degrees), json); create_value_json(root, F("wWCurTemp"), nullptr, F_(wWCurTemp), F_(degrees), json);
print_value_json(root, F("wWCurTemp2"), nullptr, F_(wWCurTemp2), F_(degrees), json); create_value_json(root, F("wWCurTemp2"), nullptr, F_(wWCurTemp2), F_(degrees), json);
print_value_json(root, F("wWCurFlow"), nullptr, F_(wWCurFlow), F("l/min"), json); create_value_json(root, F("wWCurFlow"), nullptr, F_(wWCurFlow), F("l/min"), json);
print_value_json(root, F("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), json); create_value_json(root, F("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), json);
print_value_json(root, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), F_(degrees), json); create_value_json(root, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), F_(degrees), json);
print_value_json(root, F("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), json); create_value_json(root, F("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), json);
print_value_json(root, F("wWActivated"), nullptr, F_(wWActivated), nullptr, json); create_value_json(root, F("wWActivated"), nullptr, F_(wWActivated), nullptr, json);
print_value_json(root, F("wWOneTime"), nullptr, F_(wWOneTime), nullptr, json); create_value_json(root, F("wWOneTime"), nullptr, F_(wWOneTime), nullptr, json);
print_value_json(root, F("wWDisinfecting"), nullptr, F_(wWDisinfecting), nullptr, json); create_value_json(root, F("wWDisinfecting"), nullptr, F_(wWDisinfecting), nullptr, json);
print_value_json(root, F("wWCharging"), nullptr, F_(wWCharging), nullptr, json); create_value_json(root, F("wWCharging"), nullptr, F_(wWCharging), nullptr, json);
print_value_json(root, F("wWRecharging"), nullptr, F_(wWRecharging), nullptr, json); create_value_json(root, F("wWRecharging"), nullptr, F_(wWRecharging), nullptr, json);
print_value_json(root, F("wWTempOK"), nullptr, F_(wWTempOK), nullptr, json); create_value_json(root, F("wWTempOK"), nullptr, F_(wWTempOK), nullptr, json);
print_value_json(root, F("wWActive"), nullptr, F_(wWActive), nullptr, json); create_value_json(root, F("wWActive"), nullptr, F_(wWActive), nullptr, json);
print_value_json(root, F("wWHeat"), nullptr, F_(wWHeat), nullptr, json); create_value_json(root, F("wWHeat"), nullptr, F_(wWHeat), nullptr, json);
print_value_json(root, F("wWSetPumpPower"), nullptr, F_(wWSetPumpPower), F_(percent), json); create_value_json(root, F("wWSetPumpPower"), nullptr, F_(wWSetPumpPower), F_(percent), json);
print_value_json(root, F("wwMixTemperature"), nullptr, F_(wwMixTemperature), F_(degrees), json); create_value_json(root, F("wwMixTemperature"), nullptr, F_(wwMixTemperature), F_(degrees), json);
print_value_json(root, F("wwBufferTemperature"), nullptr, F_(wwBufferTemperature), F_(degrees), json); create_value_json(root, F("wwBufferTemperature"), nullptr, F_(wwBufferTemperature), F_(degrees), json);
print_value_json(root, F("wWStarts"), nullptr, F_(wWStarts), nullptr, json); create_value_json(root, F("wWStarts"), nullptr, F_(wWStarts), nullptr, json);
print_value_json(root, F("wWWorkM"), nullptr, F_(wWWorkM), F_(min), json); create_value_json(root, F("wWWorkM"), nullptr, F_(wWWorkM), F_(min), json);
create_value_json(root, F("wWWorkMtxt"), nullptr, F_(wWWorkMtxt), nullptr, json);
} }
bool Boiler::export_values(JsonObject & json) { bool Boiler::export_values(JsonObject & json) {
@@ -280,11 +286,11 @@ bool Boiler::export_values_ww(JsonObject & json) {
// Warm Water comfort setting // Warm Water comfort setting
if (Helpers::hasValue(wWComfort_)) { if (Helpers::hasValue(wWComfort_)) {
if (wWComfort_ == 0x00) { if (wWComfort_ == 0x00) {
json["wWComfort"] = F("Hot"); json["wWComfort"] = FJSON("Hot");
} else if (wWComfort_ == 0xD8) { } else if (wWComfort_ == 0xD8) {
json["wWComfort"] = F("Eco"); json["wWComfort"] = FJSON("Eco");
} else if (wWComfort_ == 0xEC) { } else if (wWComfort_ == 0xEC) {
json["wWComfort"] = F("Intelligent"); json["wWComfort"] = FJSON("Intelligent");
} }
} }
@@ -305,20 +311,20 @@ bool Boiler::export_values_ww(JsonObject & json) {
// Warm Water type // Warm Water type
if (wWType_ == 0) { // no json if not set if (wWType_ == 0) { // no json if not set
json["wWType"] = F("off"); json["wWType"] = FJSON("off");
} else if (wWType_ == 1) { } else if (wWType_ == 1) {
json["wWType"] = F("flow"); json["wWType"] = FJSON("flow");
} else if (wWType_ == 2) { } else if (wWType_ == 2) {
json["wWType"] = F("buffered flow"); json["wWType"] = FJSON("buffered flow");
} else if (wWType_ == 3) { } else if (wWType_ == 3) {
json["wWType"] = F("buffer"); json["wWType"] = FJSON("buffer");
} else if (wWType_ == 4) { } else if (wWType_ == 4) {
json["wWType"] = F("layered buffer"); json["wWType"] = FJSON("layered buffer");
} }
// Warm Water charging type // Warm Water charging type
if (Helpers::hasValue(wWChargeType_, EMS_VALUE_BOOL)) { if (Helpers::hasValue(wWChargeType_, EMS_VALUE_BOOL)) {
json["wWChargeType"] = wWChargeType_ ? F("3-way valve") : F("charge pump"); json["wWChargeType"] = wWChargeType_ ? FJSON("3-way valve") : FJSON("charge pump");
} }
// Warm Water circulation pump available bool // Warm Water circulation pump available bool
@@ -329,7 +335,7 @@ bool Boiler::export_values_ww(JsonObject & json) {
// Warm Water circulation pump freq // Warm Water circulation pump freq
if (Helpers::hasValue(wWCircPumpMode_)) { if (Helpers::hasValue(wWCircPumpMode_)) {
if (wWCircPumpMode_ == 7) { if (wWCircPumpMode_ == 7) {
json["wWCircPumpMode"] = F("continuous"); json["wWCircPumpMode"] = FJSON("continuous");
} else { } else {
char s[7]; char s[7];
char buffer[2]; char buffer[2];
@@ -434,6 +440,8 @@ bool Boiler::export_values_ww(JsonObject & json) {
// Warm Water active time // Warm Water active time
if (Helpers::hasValue(wWWorkM_)) { if (Helpers::hasValue(wWWorkM_)) {
json["wWWorkM"] = wWWorkM_; json["wWWorkM"] = wWWorkM_;
char slong[40];
json["wWWorkMtxt"] = Helpers::render_value(slong, wWWorkM_, EMS_VALUE_TIME); // Warm Water active time (full text)
} }
return (json.size()); return (json.size());
@@ -594,11 +602,7 @@ bool Boiler::export_values_main(JsonObject & json) {
json["setFlowTemp"] = setFlowTemp_; json["setFlowTemp"] = setFlowTemp_;
} }
// Total UBA working time // burn power %
if (Helpers::hasValue(UBAuptime_)) {
json["UBAuptime"] = UBAuptime_;
}
if (Helpers::hasValue(setBurnPow_)) { if (Helpers::hasValue(setBurnPow_)) {
json["setBurnPow"] = setBurnPow_; json["setBurnPow"] = setBurnPow_;
} }
@@ -611,15 +615,25 @@ bool Boiler::export_values_main(JsonObject & json) {
// Total burner operating time // Total burner operating time
if (Helpers::hasValue(burnWorkMin_)) { if (Helpers::hasValue(burnWorkMin_)) {
json["burnWorkMin"] = burnWorkMin_; json["burnWorkMin"] = burnWorkMin_;
char slong[40];
json["burnWorkMintxt"] = Helpers::render_value(slong, burnWorkMin_, EMS_VALUE_TIME);
} }
// Total heat operating time // Total heat operating time
if (Helpers::hasValue(heatWorkMin_)) { if (Helpers::hasValue(heatWorkMin_)) {
json["heatWorkMin"] = heatWorkMin_; json["heatWorkMin"] = heatWorkMin_;
char slong[40];
json["heatWorkMintxt"] = Helpers::render_value(slong, heatWorkMin_, EMS_VALUE_TIME);
} }
// Service Code // Total UBA working time
// Service Code Number if (Helpers::hasValue(UBAuptime_)) {
json["UBAuptime"] = UBAuptime_;
char slong[40];
json["UBAuptimetxt"] = Helpers::render_value(slong, UBAuptime_, EMS_VALUE_TIME);
}
// Service Code & Service Code Number
if (Helpers::hasValue(serviceCodeNumber_)) { if (Helpers::hasValue(serviceCodeNumber_)) {
json["serviceCode"] = serviceCode_; json["serviceCode"] = serviceCode_;
json["serviceCodeNumber"] = serviceCodeNumber_; json["serviceCodeNumber"] = serviceCodeNumber_;
@@ -630,7 +644,7 @@ bool Boiler::export_values_main(JsonObject & json) {
} }
return (json.size()); return (json.size());
} } // namespace emsesp
// publish values via MQTT // publish values via MQTT
void Boiler::publish_values(JsonObject & json, bool force) { void Boiler::publish_values(JsonObject & json, bool force) {
@@ -674,103 +688,6 @@ bool Boiler::updated_values() {
return false; return false;
} }
// print values to shell console
void Boiler::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // for showing the header
// fetch the values into a JSON document
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_LARGE> doc;
JsonObject json = doc.to<JsonObject>();
if (!export_values_main(json)) {
return; // empty
}
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("lastCode"), nullptr, F_(lastCode), nullptr, 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("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), 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("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), 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("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("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), json);
print_value_json(shell, F("burnStarts"), nullptr, F_(burnStarts), nullptr, json);
if (Helpers::hasValue(burnWorkMin_)) {
shell.printfln(F(" Total burner operating time: %d days %d hours %d minutes"), burnWorkMin_ / 1440, (burnWorkMin_ % 1440) / 60, burnWorkMin_ % 60);
}
if (Helpers::hasValue(heatWorkMin_)) {
shell.printfln(F(" Total heat operating time: %d days %d hours %d minutes"), heatWorkMin_ / 1440, (heatWorkMin_ % 1440) / 60, heatWorkMin_ % 60);
}
if (Helpers::hasValue(UBAuptime_)) {
shell.printfln(F(" Total UBA working time: %d days %d hours %d minutes"), UBAuptime_ / 1440, (UBAuptime_ % 1440) / 60, UBAuptime_ % 60);
}
doc.clear();
if (!export_values_ww(json)) { // append ww values
shell.println();
return;
}
// ww
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("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("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("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), json);
print_value_json(shell, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), 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("wWHeat"), nullptr, F_(wWHeat), nullptr, 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);
if (Helpers::hasValue(wWWorkM_)) {
shell.printfln(F(" Warm Water active time: %d days %d hours %d minutes"), wWWorkM_ / 1440, (wWWorkM_ % 1440) / 60, wWWorkM_ % 60);
}
shell.println();
}
/* /*
* Check if hot tap water or heating is active * Check if hot tap water or heating is active
* If a value has changed, post it immediately to MQTT so we get real time data * If a value has changed, post it immediately to MQTT so we get real time data

View File

@@ -38,7 +38,6 @@ class Boiler : public EMSdevice {
public: public:
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); 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 & json, bool force); virtual void publish_values(JsonObject & json, bool force);
virtual bool export_values(JsonObject & json); virtual bool export_values(JsonObject & json);
virtual void device_info_web(JsonArray & root); virtual void device_info_web(JsonArray & root);

View File

@@ -31,11 +31,6 @@ Connect::Connect(uint8_t device_type, uint8_t device_id, uint8_t product_id, con
void Connect::device_info_web(JsonArray & root) { void Connect::device_info_web(JsonArray & root) {
} }
// display all values into the shell console
void Connect::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header
}
// publish values via MQTT // publish values via MQTT
void Connect::publish_values(JsonObject & json, bool force) { void Connect::publish_values(JsonObject & json, bool force) {
} }

View File

@@ -35,7 +35,6 @@ class Connect : public EMSdevice {
public: public:
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); 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 & json, bool force); virtual void publish_values(JsonObject & json, bool force);
virtual bool export_values(JsonObject & json); virtual bool export_values(JsonObject & json);
virtual void device_info_web(JsonArray & root); virtual void device_info_web(JsonArray & root);

View File

@@ -31,11 +31,6 @@ Controller::Controller(uint8_t device_type, uint8_t device_id, uint8_t product_i
void Controller::device_info_web(JsonArray & root) { void Controller::device_info_web(JsonArray & root) {
} }
// display all values into the shell console
void Controller::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header
}
// publish values via MQTT // publish values via MQTT
void Controller::publish_values(JsonObject & json, bool force) { void Controller::publish_values(JsonObject & json, bool force) {
} }

View File

@@ -35,7 +35,6 @@ class Controller : public EMSdevice {
public: public:
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); 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 & json, bool force); virtual void publish_values(JsonObject & json, bool force);
virtual bool export_values(JsonObject & json); virtual bool export_values(JsonObject & json);
virtual void device_info_web(JsonArray & root); virtual void device_info_web(JsonArray & root);

View File

@@ -31,11 +31,6 @@ Gateway::Gateway(uint8_t device_type, uint8_t device_id, uint8_t product_id, con
void Gateway::device_info_web(JsonArray & root) { void Gateway::device_info_web(JsonArray & root) {
} }
// display all values into the shell console
void Gateway::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header
}
// publish values via MQTT // publish values via MQTT
void Gateway::publish_values(JsonObject & json, bool force) { void Gateway::publish_values(JsonObject & json, bool force) {
} }

View File

@@ -35,7 +35,6 @@ class Gateway : public EMSdevice {
public: public:
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); 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 & json, bool force); virtual void publish_values(JsonObject & json, bool force);
virtual bool export_values(JsonObject & json); virtual bool export_values(JsonObject & json);
virtual void device_info_web(JsonArray & root); virtual void device_info_web(JsonArray & root);

View File

@@ -31,11 +31,6 @@ Generic::Generic(uint8_t device_type, uint8_t device_id, uint8_t product_id, con
void Generic::device_info_web(JsonArray & root) { void Generic::device_info_web(JsonArray & root) {
} }
// display all values into the shell console
void Generic::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header
}
// publish values via MQTT // publish values via MQTT
void Generic::publish_values(JsonObject & json, bool force) { void Generic::publish_values(JsonObject & json, bool force) {
} }

View File

@@ -35,7 +35,6 @@ class Generic : public EMSdevice {
public: public:
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); 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 & json, bool force); virtual void publish_values(JsonObject & json, bool force);
virtual bool export_values(JsonObject & json); virtual bool export_values(JsonObject & json);
virtual void device_info_web(JsonArray & root); virtual void device_info_web(JsonArray & root);

View File

@@ -55,23 +55,8 @@ void Heatpump::device_info_web(JsonArray & root) {
return; // empty return; // empty
} }
print_value_json(root, F("airHumidity"), nullptr, F_(airHumidity), F_(percent), json); create_value_json(root, F("airHumidity"), nullptr, F_(airHumidity), F_(percent), json);
print_value_json(root, F("dewTemperature"), nullptr, F_(dewTemperature), F_(degrees), json); create_value_json(root, F("dewTemperature"), nullptr, F_(dewTemperature), F_(degrees), json);
}
// display all values into the shell console
void Heatpump::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header
// fetch the values into a JSON document
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
JsonObject json = doc.to<JsonObject>();
if (!export_values(json)) {
return; // empty
}
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 // publish values via MQTT
@@ -106,10 +91,10 @@ void Heatpump::register_mqtt_ha_config() {
snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/heatpump_data"), System::hostname().c_str()); snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/heatpump_data"), System::hostname().c_str());
doc["stat_t"] = stat_t; doc["stat_t"] = stat_t;
doc["val_tpl"] = F("{{value_json.airHumidity}}"); doc["val_tpl"] = FJSON("{{value_json.airHumidity}}");
JsonObject dev = doc.createNestedObject("dev"); JsonObject dev = doc.createNestedObject("dev");
dev["name"] = F("EMS-ESP Heat Pump"); dev["name"] = FJSON("EMS-ESP Heat Pump");
dev["sw"] = EMSESP_APP_VERSION; dev["sw"] = EMSESP_APP_VERSION;
dev["mf"] = brand_to_string(); dev["mf"] = brand_to_string();
dev["mdl"] = this->name(); dev["mdl"] = this->name();

View File

@@ -36,7 +36,6 @@ class Heatpump : public EMSdevice {
public: public:
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); 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 & json, bool force); virtual void publish_values(JsonObject & json, bool force);
virtual bool export_values(JsonObject & json); virtual bool export_values(JsonObject & json);
virtual void device_info_web(JsonArray & root); virtual void device_info_web(JsonArray & root);

View File

@@ -72,15 +72,15 @@ void Mixer::device_info_web(JsonArray & root) {
char prefix_str[10]; char prefix_str[10];
if (type() == Type::HC) { if (type() == Type::HC) {
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(hc %d) "), 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), json); create_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); create_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); create_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); create_value_json(root, F("valveStatus"), FPSTR(prefix_str), F_(valveStatus), F_(percent), json);
} else { } else {
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(wwc %d) "), hc_); snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(wwc %d) "), hc_);
print_value_json(root, F("wwTemp"), FPSTR(prefix_str), F_(wwTemp), F_(degrees), json); create_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); create_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); create_value_json(root, F("tempStatus"), FPSTR(prefix_str), F_(tempStatus), nullptr, json);
} }
} }
@@ -93,38 +93,6 @@ bool Mixer::updated_values() {
return false; return false;
} }
// display all values into the shell console
void Mixer::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header
if (type() == Type::NONE) {
return; // don't have any values yet
}
// fetch the values into a JSON document
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
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), 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), 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();
}
// publish values via MQTT // publish values via MQTT
// topic is mixer_data<id> // topic is mixer_data<id>
void Mixer::publish_values(JsonObject & json, bool force) { void Mixer::publish_values(JsonObject & json, bool force) {
@@ -176,16 +144,16 @@ void Mixer::register_mqtt_ha_config() {
snprintf_P(uniq_id, sizeof(uniq_id), PSTR("mixer%02X"), device_id() - 0x20 + 1); snprintf_P(uniq_id, sizeof(uniq_id), PSTR("mixer%02X"), device_id() - 0x20 + 1);
doc["uniq_id"] = uniq_id; doc["uniq_id"] = uniq_id;
doc["ic"] = F("mdi:home-thermometer-outline"); doc["ic"] = FJSON("mdi:home-thermometer-outline");
char stat_t[50]; char stat_t[50];
snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/mixer_data"), System::hostname().c_str()); snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/mixer_data"), System::hostname().c_str());
doc["stat_t"] = stat_t; 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 doc["val_tpl"] = FJSON("{{value_json.type}}"); // HA needs a single value. We take the type which is wwc or hc
JsonObject dev = doc.createNestedObject("dev"); JsonObject dev = doc.createNestedObject("dev");
dev["name"] = F("EMS-ESP Mixer"); dev["name"] = FJSON("EMS-ESP Mixer");
dev["sw"] = EMSESP_APP_VERSION; dev["sw"] = EMSESP_APP_VERSION;
dev["mf"] = brand_to_string(); dev["mf"] = brand_to_string();
dev["mdl"] = this->name(); dev["mdl"] = this->name();
@@ -235,10 +203,10 @@ bool Mixer::export_values_format(uint8_t mqtt_format, JsonObject & json) {
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_); snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_);
if (mqtt_format == Mqtt::Format::SINGLE) { if (mqtt_format == Mqtt::Format::SINGLE) {
json_hc = json; json_hc = json;
json["type"] = F("hc"); json["type"] = FJSON("hc");
} else if (mqtt_format == Mqtt::Format::HA) { } else if (mqtt_format == Mqtt::Format::HA) {
json_hc = json.createNestedObject(hc_name); json_hc = json.createNestedObject(hc_name);
json_hc["type"] = F("hc"); json_hc["type"] = FJSON("hc");
} else { } else {
json_hc = json.createNestedObject(hc_name); json_hc = json.createNestedObject(hc_name);
} }
@@ -263,10 +231,10 @@ bool Mixer::export_values_format(uint8_t mqtt_format, JsonObject & json) {
snprintf_P(hc_name, sizeof(hc_name), PSTR("wwc%d"), hc_); snprintf_P(hc_name, sizeof(hc_name), PSTR("wwc%d"), hc_);
if (mqtt_format == Mqtt::Format::SINGLE) { if (mqtt_format == Mqtt::Format::SINGLE) {
json_hc = json; json_hc = json;
json["type"] = F("wwc"); json["type"] = FJSON("wwc");
} else if (mqtt_format == Mqtt::Format::HA) { } else if (mqtt_format == Mqtt::Format::HA) {
json_hc = json.createNestedObject(hc_name); json_hc = json.createNestedObject(hc_name);
json_hc["type"] = F("wwc"); json_hc["type"] = FJSON("wwc");
} else { } else {
json_hc = json.createNestedObject(hc_name); json_hc = json.createNestedObject(hc_name);
} }

View File

@@ -36,7 +36,6 @@ class Mixer : public EMSdevice {
public: public:
Mixer(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); Mixer(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 & json, bool force); virtual void publish_values(JsonObject & json, bool force);
virtual bool export_values(JsonObject & json); virtual bool export_values(JsonObject & json);
virtual void device_info_web(JsonArray & root); virtual void device_info_web(JsonArray & root);

View File

@@ -70,65 +70,22 @@ void Solar::device_info_web(JsonArray & root) {
return; // empty return; // empty
} }
print_value_json(root, F("collectorTemp"), nullptr, F_(collectorTemp), F_(degrees), json); create_value_json(root, F("collectorTemp"), nullptr, F_(collectorTemp), F_(degrees), json);
print_value_json(root, F("tankBottomTemp"), nullptr, F_(tankBottomTemp), F_(degrees), json); create_value_json(root, F("tankBottomTemp"), nullptr, F_(tankBottomTemp), F_(degrees), json);
print_value_json(root, F("tankBottomTemp2"), nullptr, F_(tankBottomTemp2), F_(degrees), json); create_value_json(root, F("tankBottomTemp2"), nullptr, F_(tankBottomTemp2), F_(degrees), json);
print_value_json(root, F("tank1MaxTempCurrent"), nullptr, F_(tank1MaxTempCurrent), F_(degrees), json); create_value_json(root, F("tank1MaxTempCurrent"), nullptr, F_(tank1MaxTempCurrent), F_(degrees), json);
print_value_json(root, F("heatExchangerTemp"), nullptr, F_(heatExchangerTemp), F_(degrees), json); create_value_json(root, F("heatExchangerTemp"), nullptr, F_(heatExchangerTemp), F_(degrees), json);
print_value_json(root, F("solarPumpModulation"), nullptr, F_(solarPumpModulation), F_(percent), json); create_value_json(root, F("solarPumpModulation"), nullptr, F_(solarPumpModulation), F_(percent), json);
print_value_json(root, F("cylinderPumpModulation"), nullptr, F_(cylinderPumpModulation), F_(percent), json); create_value_json(root, F("cylinderPumpModulation"), nullptr, F_(cylinderPumpModulation), F_(percent), json);
print_value_json(root, F("valveStatus"), nullptr, F_(valveStatus), nullptr, json); create_value_json(root, F("valveStatus"), nullptr, F_(valveStatus), nullptr, json);
print_value_json(root, F("solarPump"), nullptr, F_(solarPump), nullptr, json); create_value_json(root, F("solarPump"), nullptr, F_(solarPump), nullptr, json);
print_value_json(root, F("tankHeated"), nullptr, F_(tankHeated), nullptr, json); create_value_json(root, F("tankHeated"), nullptr, F_(tankHeated), nullptr, json);
print_value_json(root, F("collectorShutdown"), nullptr, F_(collectorShutdown), nullptr, json); create_value_json(root, F("collectorShutdown"), nullptr, F_(collectorShutdown), nullptr, json);
print_value_json(root, F("energyLastHour"), nullptr, F_(energyLastHour), F_(wh), json); create_value_json(root, F("energyLastHour"), nullptr, F_(energyLastHour), F_(wh), json);
print_value_json(root, F("energyToday"), nullptr, F_(energyToday), F_(wh), json); create_value_json(root, F("energyToday"), nullptr, F_(energyToday), F_(wh), json);
print_value_json(root, F("energyTotal"), nullptr, F_(energyTotal), F_(kwh), json); create_value_json(root, F("energyTotal"), nullptr, F_(energyTotal), F_(kwh), json);
print_value_json(root, F("pumpWorkMin"), nullptr, F_(pumpWorkMin), F_(min), json); create_value_json(root, F("pumpWorkMin"), nullptr, F_(pumpWorkMin), F_(min), json);
create_value_json(root, F("pumpWorkMintxt"), nullptr, F_(pumpWorkMintxt), F_(min), json);
if (Helpers::hasValue(pumpWorkMin_)) {
JsonObject dataElement = root.createNestedObject();
dataElement["n"] = F_(pumpWorkMin);
char time_str[60];
snprintf_P(time_str, sizeof(time_str), PSTR("%d days %d hours %d minutes"), pumpWorkMin_ / 1440, (pumpWorkMin_ % 1440) / 60, pumpWorkMin_ % 60);
dataElement["v"] = time_str;
}
}
// display all values into the shell console
void Solar::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header
// fetch the values into a JSON document
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
JsonObject json = doc.to<JsonObject>();
if (!export_values(json)) {
return; // empty
}
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("tank1MaxTempCurrent"), nullptr, F_(tank1MaxTempCurrent), 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);
print_value_json(shell, F("pumpWorkMin"), nullptr, F_(pumpWorkMin), F_(min), json);
if (Helpers::hasValue(pumpWorkMin_)) {
shell.printfln(F(" %s: %d days %d hours %d minutes"),
uuid::read_flash_string(F_(pumpWorkMin)).c_str(),
pumpWorkMin_ / 1440,
(pumpWorkMin_ % 1440) / 60,
pumpWorkMin_ % 60);
}
} }
// publish values via MQTT // publish values via MQTT
@@ -168,9 +125,9 @@ void Solar::register_mqtt_ha_config() {
snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/solar_data"), System::hostname().c_str()); snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/solar_data"), System::hostname().c_str());
doc["stat_t"] = stat_t; doc["stat_t"] = stat_t;
doc["val_tpl"] = F("{{value_json.solarPump}}"); doc["val_tpl"] = FJSON("{{value_json.solarPump}}");
JsonObject dev = doc.createNestedObject("dev"); JsonObject dev = doc.createNestedObject("dev");
dev["name"] = F("EMS-ESP Solar"); dev["name"] = FJSON("EMS-ESP Solar");
dev["sw"] = EMSESP_APP_VERSION; dev["sw"] = EMSESP_APP_VERSION;
dev["mf"] = brand_to_string(); dev["mf"] = brand_to_string();
dev["mdl"] = name(); dev["mdl"] = name();
@@ -240,6 +197,8 @@ bool Solar::export_values(JsonObject & json) {
if (Helpers::hasValue(pumpWorkMin_)) { if (Helpers::hasValue(pumpWorkMin_)) {
json["pumpWorkMin"] = pumpWorkMin_; json["pumpWorkMin"] = pumpWorkMin_;
char slong[40];
json["pumpWorkMintxt"] = Helpers::render_value(slong, pumpWorkMin_, EMS_VALUE_TIME);
} }
if (Helpers::hasValue(tankHeated_, EMS_VALUE_BOOL)) { if (Helpers::hasValue(tankHeated_, EMS_VALUE_BOOL)) {

View File

@@ -36,7 +36,6 @@ class Solar : public EMSdevice {
public: public:
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); 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 & json, bool force); virtual void publish_values(JsonObject & json, bool force);
virtual bool export_values(JsonObject & json); virtual bool export_values(JsonObject & json);
virtual void device_info_web(JsonArray & root); virtual void device_info_web(JsonArray & root);

View File

@@ -39,20 +39,9 @@ void Switch::device_info_web(JsonArray & root) {
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc; StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
JsonObject json = doc.to<JsonObject>(); JsonObject json = doc.to<JsonObject>();
if (export_values(json)) { if (export_values(json)) {
print_value_json(root, F("activated"), nullptr, F_(activated), nullptr, json); create_value_json(root, F("activated"), nullptr, F_(activated), nullptr, json);
print_value_json(root, F("flowTemp"), nullptr, F_(flowTemp), F_(degrees), json); create_value_json(root, F("flowTemp"), nullptr, F_(flowTemp), F_(degrees), json);
print_value_json(root, F("status"), nullptr, F_(status), nullptr, json); create_value_json(root, F("status"), nullptr, F_(status), nullptr, json);
}
}
// display all values into the shell console
void Switch::show_values(uuid::console::Shell & shell) {
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
JsonObject json = doc.to<JsonObject>();
if (export_values(json)) {
print_value_json(shell, F("activated"), nullptr, F_(activated), nullptr, json);
print_value_json(shell, F("flowTemp"), F_(2spaces), F_(flowTemp), F_(degrees), json);
print_value_json(shell, F("status"), nullptr, F_(status), nullptr, json);
} }
} }
@@ -121,16 +110,16 @@ void Switch::register_mqtt_ha_config() {
snprintf_P(uniq_id, sizeof(uniq_id), PSTR("switch")); snprintf_P(uniq_id, sizeof(uniq_id), PSTR("switch"));
doc["uniq_id"] = uniq_id; doc["uniq_id"] = uniq_id;
doc["ic"] = F("mdi:home-thermometer-outline"); doc["ic"] = FJSON("mdi:home-thermometer-outline");
char stat_t[50]; char stat_t[50];
snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/switch_data"), System::hostname().c_str()); snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/switch_data"), System::hostname().c_str());
doc["stat_t"] = stat_t; 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 doc["val_tpl"] = FJSON("{{value_json.type}}"); // HA needs a single value. We take the type which is wwc or hc
JsonObject dev = doc.createNestedObject("dev"); JsonObject dev = doc.createNestedObject("dev");
dev["name"] = F("EMS-ESP Switch"); dev["name"] = FJSON("EMS-ESP Switch");
dev["sw"] = EMSESP_APP_VERSION; dev["sw"] = EMSESP_APP_VERSION;
dev["mf"] = brand_to_string(); dev["mf"] = brand_to_string();
dev["mdl"] = this->name(); dev["mdl"] = this->name();

View File

@@ -36,7 +36,6 @@ class Switch : public EMSdevice {
public: public:
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); 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 & json, bool force); virtual void publish_values(JsonObject & json, bool force);
virtual bool export_values(JsonObject & json); virtual bool export_values(JsonObject & json);
virtual void device_info_web(JsonArray & root); virtual void device_info_web(JsonArray & root);

View File

@@ -185,25 +185,25 @@ void Thermostat::device_info_web(JsonArray & root) {
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_LARGE> doc; StaticJsonDocument<EMSESP_MAX_JSON_SIZE_LARGE> doc;
JsonObject json_main = doc.to<JsonObject>(); JsonObject json_main = doc.to<JsonObject>();
if (export_values_main(json_main)) { if (export_values_main(json_main)) {
print_value_json(root, F("time"), nullptr, F_(time), nullptr, json_main); create_value_json(root, F("time"), nullptr, F_(time), nullptr, json_main);
print_value_json(root, F("errorcode"), nullptr, F_(error), nullptr, json_main); create_value_json(root, F("errorcode"), nullptr, F_(error), nullptr, json_main);
print_value_json(root, F("lastcode"), nullptr, F_(lastCode), nullptr, json_main); create_value_json(root, F("lastcode"), nullptr, F_(lastCode), nullptr, json_main);
print_value_json(root, F("display"), nullptr, F_(display), nullptr, json_main); create_value_json(root, F("display"), nullptr, F_(display), nullptr, json_main);
print_value_json(root, F("language"), nullptr, F_(language), nullptr, json_main); create_value_json(root, F("language"), nullptr, F_(language), nullptr, json_main);
print_value_json(root, F("offsetclock"), nullptr, F_(offsetclock), nullptr, json_main); create_value_json(root, F("offsetclock"), nullptr, F_(offsetclock), nullptr, json_main);
print_value_json(root, F("dampedtemp"), nullptr, F_(dampedtemp), F_(degrees), json_main); create_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); create_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); create_value_json(root, F("inttemp2"), nullptr, F_(inttemp2), F_(degrees), json_main);
print_value_json(root, F("intoffset"), nullptr, F_(intoffset), nullptr, json_main); create_value_json(root, F("intoffset"), nullptr, F_(intoffset), nullptr, json_main);
print_value_json(root, F("minexttemp"), nullptr, F_(minexttemp), F_(degrees), json_main); create_value_json(root, F("minexttemp"), nullptr, F_(minexttemp), F_(degrees), json_main);
print_value_json(root, F("building"), nullptr, F_(building), nullptr, json_main); create_value_json(root, F("building"), nullptr, F_(building), nullptr, json_main);
print_value_json(root, F("floordry"), nullptr, F_(floordry), nullptr, json_main); create_value_json(root, F("floordry"), nullptr, F_(floordry), nullptr, json_main);
print_value_json(root, F("floordrytemp"), nullptr, F_(floordrytemp), F_(degrees), json_main); create_value_json(root, F("floordrytemp"), nullptr, F_(floordrytemp), F_(degrees), json_main);
print_value_json(root, F("wwmode"), nullptr, F_(wwmode), nullptr, json_main); create_value_json(root, F("wwmode"), nullptr, F_(wwmode), nullptr, json_main);
print_value_json(root, F("wwtemp"), nullptr, F_(wwtemp), nullptr, json_main); create_value_json(root, F("wwtemp"), nullptr, F_(wwtemp), nullptr, json_main);
print_value_json(root, F("wwtemplow"), nullptr, F_(wwtemplow), nullptr, json_main); create_value_json(root, F("wwtemplow"), nullptr, F_(wwtemplow), nullptr, json_main);
print_value_json(root, F("wwextra1"), nullptr, F_(wwextra1), nullptr, json_main); create_value_json(root, F("wwextra1"), nullptr, F_(wwextra1), nullptr, json_main);
print_value_json(root, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, json_main); create_value_json(root, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, json_main);
} }
doc.clear(); doc.clear();
JsonObject json_hc = doc.to<JsonObject>(); JsonObject json_hc = doc.to<JsonObject>();
@@ -218,28 +218,28 @@ void Thermostat::device_info_web(JsonArray & root) {
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(hc %d) "), hc->hc_num()); 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), json); create_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); create_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); create_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); create_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); create_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); create_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); create_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); create_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); create_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); create_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); create_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); create_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); create_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); create_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); create_value_json(root, F("roominfluence"), FPSTR(prefix_str), F_(roominfluence), F_(degrees), json);
print_value_json(root, F("flowtempoffset"), FPSTR(prefix_str), F_(flowtempoffset), F_(degrees), json); create_value_json(root, F("flowtempoffset"), FPSTR(prefix_str), F_(flowtempoffset), F_(degrees), json);
print_value_json(root, F("minflowtemp"), FPSTR(prefix_str), F_(minflowtemp), F_(degrees), json); create_value_json(root, F("minflowtemp"), FPSTR(prefix_str), F_(minflowtemp), F_(degrees), json);
print_value_json(root, F("maxflowtemp"), FPSTR(prefix_str), F_(maxflowtemp), F_(degrees), json); create_value_json(root, F("maxflowtemp"), FPSTR(prefix_str), F_(maxflowtemp), F_(degrees), json);
print_value_json(root, F("summertemp"), FPSTR(prefix_str), F_(summertemp), F_(degrees), json); create_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); create_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); create_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); create_value_json(root, F("modetype"), FPSTR(prefix_str), F_(modetype), nullptr, json);
} }
} }
} }
@@ -265,75 +265,6 @@ bool Thermostat::export_values(JsonObject & json) {
return has_value; return has_value;
} }
// display all thermostat values into the shell console
void Thermostat::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_LARGE> doc;
JsonObject json_main = doc.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("lastcode"), nullptr, F_(lastCode), 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("floordry"), nullptr, F_(floordry), nullptr, json_main);
print_value_json(shell, F("floordrytemp"), nullptr, F_(floordrytemp), F_(degrees), 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("wwextra1"), nullptr, F_(wwextra1), nullptr, json_main);
print_value_json(shell, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, json_main);
}
doc.clear(); // reuse the doc
JsonObject json_hc = doc.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, json_hc)) {
// display for each active heating circuit
for (const auto & hc : heating_circuits_) {
if (hc->is_active()) {
shell.printfln(F_(hc), hc->hc_num());
char hc_name[10]; // hc{1-4}
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc->hc_num());
JsonObject json = json_hc[hc_name];
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("flowtempoffset"), F_(2spaces), F_(flowtempoffset), F_(degrees), json);
print_value_json(shell, F("minflowtemp"), F_(2spaces), F_(minflowtemp), F_(degrees), json);
print_value_json(shell, F("maxflowtemp"), F_(2spaces), F_(maxflowtemp), 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);
}
}
}
shell.println();
}
// publish values via MQTT // publish values via MQTT
void Thermostat::publish_values(JsonObject & json, bool force) { void Thermostat::publish_values(JsonObject & json, bool force) {
if (EMSESP::actual_master_thermostat() != device_id()) { if (EMSESP::actual_master_thermostat() != device_id()) {
@@ -394,36 +325,36 @@ bool Thermostat::export_values_main(JsonObject & rootThermostat) {
// Display // Display
if (Helpers::hasValue(ibaMainDisplay_)) { if (Helpers::hasValue(ibaMainDisplay_)) {
if (ibaMainDisplay_ == 0) { if (ibaMainDisplay_ == 0) {
rootThermostat["display"] = F("internal temperature"); rootThermostat["display"] = FJSON("internal temperature");
} else if (ibaMainDisplay_ == 1) { } else if (ibaMainDisplay_ == 1) {
rootThermostat["display"] = F("internal setpoint"); rootThermostat["display"] = FJSON("internal setpoint");
} else if (ibaMainDisplay_ == 2) { } else if (ibaMainDisplay_ == 2) {
rootThermostat["display"] = F("external temperature"); rootThermostat["display"] = FJSON("external temperature");
} else if (ibaMainDisplay_ == 3) { } else if (ibaMainDisplay_ == 3) {
rootThermostat["display"] = F("burner temperature"); rootThermostat["display"] = FJSON("burner temperature");
} else if (ibaMainDisplay_ == 4) { } else if (ibaMainDisplay_ == 4) {
rootThermostat["display"] = F("WW temperature"); rootThermostat["display"] = FJSON("WW temperature");
} else if (ibaMainDisplay_ == 5) { } else if (ibaMainDisplay_ == 5) {
rootThermostat["display"] = F("functioning mode"); rootThermostat["display"] = FJSON("functioning mode");
} else if (ibaMainDisplay_ == 6) { } else if (ibaMainDisplay_ == 6) {
rootThermostat["display"] = F("time"); rootThermostat["display"] = FJSON("time");
} else if (ibaMainDisplay_ == 7) { } else if (ibaMainDisplay_ == 7) {
rootThermostat["display"] = F("date"); rootThermostat["display"] = FJSON("date");
} else if (ibaMainDisplay_ == 8) { } else if (ibaMainDisplay_ == 8) {
rootThermostat["display"] = F("smoke temperature"); rootThermostat["display"] = FJSON("smoke temperature");
} }
} }
// Language // Language
if (Helpers::hasValue(ibaLanguage_)) { if (Helpers::hasValue(ibaLanguage_)) {
if (ibaLanguage_ == 0) { if (ibaLanguage_ == 0) {
rootThermostat["language"] = F("German"); rootThermostat["language"] = FJSON("German");
} else if (ibaLanguage_ == 1) { } else if (ibaLanguage_ == 1) {
rootThermostat["language"] = F("Dutch"); rootThermostat["language"] = FJSON("Dutch");
} else if (ibaLanguage_ == 2) { } else if (ibaLanguage_ == 2) {
rootThermostat["language"] = F("French"); rootThermostat["language"] = FJSON("French");
} else if (ibaLanguage_ == 3) { } else if (ibaLanguage_ == 3) {
rootThermostat["language"] = F("Italian"); rootThermostat["language"] = FJSON("Italian");
} }
} }
@@ -687,9 +618,9 @@ bool Thermostat::export_values_hc(uint8_t mqtt_format, JsonObject & rootThermost
// https://github.com/proddy/EMS-ESP/issues/373#issuecomment-619810209 // https://github.com/proddy/EMS-ESP/issues/373#issuecomment-619810209
// Mode Type // Mode Type
if (Helpers::hasValue(hc->summer_mode) && hc->summer_mode) { if (Helpers::hasValue(hc->summer_mode) && hc->summer_mode) {
dataThermostat["modetype"] = F("summer"); dataThermostat["modetype"] = FJSON("summer");
} else if (Helpers::hasValue(hc->holiday_mode) && hc->holiday_mode) { } else if (Helpers::hasValue(hc->holiday_mode) && hc->holiday_mode) {
dataThermostat["modetype"] = F("holiday"); dataThermostat["modetype"] = FJSON("holiday");
} else if (Helpers::hasValue(hc->mode_type)) { } else if (Helpers::hasValue(hc->mode_type)) {
dataThermostat["modetype"] = mode_tostring(hc->get_mode_type(model)); dataThermostat["modetype"] = mode_tostring(hc->get_mode_type(model));
} }
@@ -867,17 +798,17 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::sha
// homeassistant/sensor/ems-esp/thermostat/config // homeassistant/sensor/ems-esp/thermostat/config
void Thermostat::register_mqtt_ha_config() { void Thermostat::register_mqtt_ha_config() {
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_HA_CONFIG> doc; StaticJsonDocument<EMSESP_MAX_JSON_SIZE_HA_CONFIG> doc;
doc["uniq_id"] = F("thermostat"); doc["uniq_id"] = FJSON("thermostat");
doc["ic"] = F("mdi:home-thermometer-outline"); doc["ic"] = FJSON("mdi:home-thermometer-outline");
char stat_t[50]; char stat_t[50];
snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/thermostat_data"), System::hostname().c_str()); snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/thermostat_data"), System::hostname().c_str());
doc["stat_t"] = stat_t; doc["stat_t"] = stat_t;
doc["name"] = F("Thermostat Status"); doc["name"] = FJSON("Thermostat Status");
doc["val_tpl"] = F("{{value_json.errorcode}}"); // default value - must have one, so we use errorcode doc["val_tpl"] = FJSON("{{value_json.errorcode}}"); // default value - must have one, so we use errorcode
JsonObject dev = doc.createNestedObject("dev"); JsonObject dev = doc.createNestedObject("dev");
dev["name"] = F("EMS-ESP Thermostat"); dev["name"] = FJSON("EMS-ESP Thermostat");
dev["sw"] = EMSESP_APP_VERSION; dev["sw"] = EMSESP_APP_VERSION;
dev["mf"] = brand_to_string(); dev["mf"] = brand_to_string();
dev["mdl"] = name(); dev["mdl"] = name();
@@ -936,9 +867,9 @@ void Thermostat::register_mqtt_ha_config(uint8_t hc_num) {
doc["mode_cmd_t"] = str3; doc["mode_cmd_t"] = str3;
doc["temp_cmd_t"] = str3; doc["temp_cmd_t"] = str3;
doc["~"] = System::hostname(); // ems-esp doc["~"] = System::hostname(); // ems-esp
doc["mode_stat_t"] = "~/thermostat_data"; doc["mode_stat_t"] = FJSON("~/thermostat_data");
doc["temp_stat_t"] = "~/thermostat_data"; doc["temp_stat_t"] = FJSON("~/thermostat_data");
doc["curr_temp_t"] = "~/thermostat_data"; doc["curr_temp_t"] = FJSON("~/thermostat_data");
char mode_str[30]; char mode_str[30];
snprintf_P(mode_str, sizeof(mode_str), PSTR("{{value_json.hc%d.mode}}"), hc_num); snprintf_P(mode_str, sizeof(mode_str), PSTR("{{value_json.hc%d.mode}}"), hc_num);
@@ -952,9 +883,9 @@ void Thermostat::register_mqtt_ha_config(uint8_t hc_num) {
snprintf_P(currtemp_str, sizeof(currtemp_str), PSTR("{{value_json.hc%d.currtemp}}"), hc_num); snprintf_P(currtemp_str, sizeof(currtemp_str), PSTR("{{value_json.hc%d.currtemp}}"), hc_num);
doc["curr_temp_tpl"] = currtemp_str; doc["curr_temp_tpl"] = currtemp_str;
doc["min_temp"] = "5"; doc["min_temp"] = FJSON("5");
doc["max_temp"] = "30"; doc["max_temp"] = FJSON("30");
doc["temp_step"] = "0.5"; doc["temp_step"] = FJSON("0.5");
// the HA climate component only responds to auto, heat and off // the HA climate component only responds to auto, heat and off
JsonArray modes = doc.createNestedArray("modes"); JsonArray modes = doc.createNestedArray("modes");
@@ -963,7 +894,7 @@ void Thermostat::register_mqtt_ha_config(uint8_t hc_num) {
modes.add("off"); modes.add("off");
JsonObject dev = doc.createNestedObject("dev"); JsonObject dev = doc.createNestedObject("dev");
dev["name"] = "EMS-ESP Thermostat"; dev["name"] = FJSON("EMS-ESP Thermostat");
dev["sw"] = EMSESP_APP_VERSION; dev["sw"] = EMSESP_APP_VERSION;
dev["mf"] = brand_to_string(); dev["mf"] = brand_to_string();
dev["mdl"] = name(); dev["mdl"] = name();

View File

@@ -121,7 +121,6 @@ class Thermostat : public EMSdevice {
static std::string mode_tostring(uint8_t mode); static std::string mode_tostring(uint8_t mode);
virtual void show_values(uuid::console::Shell & shell);
virtual void publish_values(JsonObject & json, bool force); virtual void publish_values(JsonObject & json, bool force);
virtual bool export_values(JsonObject & json); virtual bool export_values(JsonObject & json);
virtual void device_info_web(JsonArray & root); virtual void device_info_web(JsonArray & root);

View File

@@ -208,11 +208,6 @@ std::string EMSdevice::to_string_short() const {
return str; return str;
} }
// prints the header for the section
void EMSdevice::show_values(uuid::console::Shell & shell) {
shell.printfln(F("%s: %s"), device_type_name().c_str(), to_string().c_str());
}
// for each telegram that has the fetch value set (true) do a read request // for each telegram that has the fetch value set (true) do a read request
void EMSdevice::fetch_values() { void EMSdevice::fetch_values() {
EMSESP::logger().debug(F("Fetching values for device ID 0x%02X"), device_id()); EMSESP::logger().debug(F("Fetching values for device ID 0x%02X"), device_id());
@@ -360,61 +355,8 @@ void EMSdevice::read_command(const uint16_t type_id) {
EMSESP::send_read_request(type_id, device_id()); EMSESP::send_read_request(type_id, device_id());
} }
// prints a string value to the console
void EMSdevice::print_value(uuid::console::Shell & shell, uint8_t padding, const __FlashStringHelper * name, const __FlashStringHelper * value) {
print_value(shell, padding, name, uuid::read_flash_string(value).c_str());
}
// print string value, value is not in flash
void EMSdevice::print_value(uuid::console::Shell & shell, uint8_t padding, const __FlashStringHelper * name, const char * value) {
uint8_t i = padding;
while (i-- > 0) {
shell.print(F_(1space));
}
shell.printfln(PSTR("%s: %s"), uuid::read_flash_string(name).c_str(), value);
}
// print value to shell from the json doc
void EMSdevice::print_value_json(uuid::console::Shell & shell,
const __FlashStringHelper * key,
const __FlashStringHelper * prefix,
const __FlashStringHelper * name,
const __FlashStringHelper * suffix,
JsonObject & json) {
JsonVariant data = json[uuid::read_flash_string(key)];
if (data == nullptr) {
return; // doesn't exist
}
if (prefix != nullptr) {
shell.printf(PSTR(" %s%s: "), uuid::read_flash_string(prefix).c_str(), uuid::read_flash_string(name).c_str());
} else {
shell.printf(PSTR(" %s: "), uuid::read_flash_string(name).c_str());
}
if (data.is<char *>()) {
shell.printf(PSTR("%s"), data.as<char *>());
} else if (data.is<int>()) {
shell.printf(PSTR("%d"), data.as<int>());
} else if (data.is<float>()) {
char data_str[10];
shell.printf(PSTR("%s"), Helpers::render_value(data_str, (float)data.as<float>(), 1));
} else if (data.is<bool>()) {
char data_str[10];
shell.printf(PSTR("%s"), Helpers::render_boolean(data_str, data.as<bool>()));
}
if (suffix != nullptr) {
shell.print(' ');
shell.print(uuid::read_flash_string(suffix).c_str());
}
shell.println();
}
// create json key/value pair // create json key/value pair
void EMSdevice::print_value_json(JsonArray & root, void EMSdevice::create_value_json(JsonArray & root,
const __FlashStringHelper * key, const __FlashStringHelper * key,
const __FlashStringHelper * prefix, const __FlashStringHelper * prefix,
const __FlashStringHelper * name, const __FlashStringHelper * name,
@@ -425,14 +367,13 @@ void EMSdevice::print_value_json(JsonArray & root,
return; // doesn't exist return; // doesn't exist
} }
JsonObject dataElement = root.createNestedObject();
// add prefix to name // add prefix to name
if (prefix != nullptr) { if (prefix != nullptr) {
char name_text[100]; char name_text[100];
snprintf_P(name_text, sizeof(name_text), PSTR("%s%s"), uuid::read_flash_string(prefix).c_str(), uuid::read_flash_string(name).c_str()); snprintf_P(name_text, sizeof(name_text), PSTR("%s%s"), uuid::read_flash_string(prefix).c_str(), uuid::read_flash_string(name).c_str());
dataElement["n"] = name_text; root.add(name_text);
} else { } else {
dataElement["n"] = name; root.add(name);
} }
// convert to string and add the suffix, this is to save space when sending to the web as json // convert to string and add the suffix, this is to save space when sending to the web as json
@@ -444,7 +385,7 @@ void EMSdevice::print_value_json(JsonArray & root,
suffix_string = " " + uuid::read_flash_string(suffix); suffix_string = " " + uuid::read_flash_string(suffix);
} }
char data_string[20]; char data_string[40];
if (data.is<char *>()) { if (data.is<char *>()) {
snprintf_P(data_string, sizeof(data_string), PSTR("%s%s"), data.as<char *>(), suffix_string.c_str()); snprintf_P(data_string, sizeof(data_string), PSTR("%s%s"), data.as<char *>(), suffix_string.c_str());
} else if (data.is<int>()) { } else if (data.is<int>()) {
@@ -457,7 +398,7 @@ void EMSdevice::print_value_json(JsonArray & root,
snprintf_P(data_string, sizeof(data_string), PSTR("%s%s"), Helpers::render_boolean(s, data.as<bool>()), suffix_string.c_str()); snprintf_P(data_string, sizeof(data_string), PSTR("%s%s"), Helpers::render_boolean(s, data.as<bool>()), suffix_string.c_str());
} }
dataElement["v"] = data_string; root.add(data_string);
} }
} // namespace emsesp } // namespace emsesp

View File

@@ -140,7 +140,6 @@ class EMSdevice {
void register_mqtt_cmd(const __FlashStringHelper * cmd, cmdfunction_p f); void register_mqtt_cmd(const __FlashStringHelper * cmd, cmdfunction_p f);
// virtual functions overrules by derived classes // virtual functions overrules by derived classes
virtual void show_values(uuid::console::Shell & shell) = 0;
virtual void publish_values(JsonObject & json, bool force = false) = 0; virtual void publish_values(JsonObject & json, bool force = false) = 0;
virtual bool export_values(JsonObject & json) = 0; virtual bool export_values(JsonObject & json) = 0;
virtual bool updated_values() = 0; virtual bool updated_values() = 0;
@@ -156,58 +155,13 @@ class EMSdevice {
telegram_functions_.reserve(n); telegram_functions_.reserve(n);
} }
static void print_value_json(uuid::console::Shell & shell, static void create_value_json(JsonArray & root,
const __FlashStringHelper * key, const __FlashStringHelper * key,
const __FlashStringHelper * prefix, const __FlashStringHelper * prefix,
const __FlashStringHelper * name, const __FlashStringHelper * name,
const __FlashStringHelper * suffix, const __FlashStringHelper * suffix,
JsonObject & json); JsonObject & json);
static void print_value_json(JsonArray & root,
const __FlashStringHelper * key,
const __FlashStringHelper * prefix,
const __FlashStringHelper * name,
const __FlashStringHelper * suffix,
JsonObject & json);
// prints an EMS device value to the console, handling the correct rendering of the type
// padding is # white space
// name is the name of the parameter
// suffix is any string to be appended after the value
// format:
// for ints its 0=no division, 255=handle as boolean, other divide by the value given and render with a decimal point
// for floats its the precision in number of decimal places from 0 to 8
// for bools its EMS_VALUE_BOOL (0xFF)
template <typename Value>
static void print_value(uuid::console::Shell & shell,
uint8_t padding,
const __FlashStringHelper * name,
Value & value,
const __FlashStringHelper * suffix,
const uint8_t format = 0) {
char buffer[15];
if (Helpers::render_value(buffer, value, format) == nullptr) {
return;
}
uint8_t i = padding;
while (i-- > 0) {
shell.print(F_(1space));
}
shell.printf(PSTR("%s: %s"), uuid::read_flash_string(name).c_str(), buffer);
if (suffix != nullptr) {
shell.print(F_(1space));
shell.println(uuid::read_flash_string(suffix).c_str());
} else {
shell.println();
}
}
static void print_value(uuid::console::Shell & shell, uint8_t padding, const __FlashStringHelper * name, const __FlashStringHelper * value);
static void print_value(uuid::console::Shell & shell, uint8_t padding, const __FlashStringHelper * name, const char * value);
enum Brand : uint8_t { enum Brand : uint8_t {
NO_BRAND = 0, // 0 NO_BRAND = 0, // 0
BOSCH, // 1 BOSCH, // 1

View File

@@ -264,11 +264,26 @@ void EMSESP::show_device_values(uuid::console::Shell & shell) {
return; return;
} }
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE_DYN);
// do this in the order of factory classes to keep a consistent order when displaying // do this in the order of factory classes to keep a consistent order when displaying
for (const auto & device_class : EMSFactory::device_handlers()) { for (const auto & device_class : EMSFactory::device_handlers()) {
for (const auto & emsdevice : emsdevices) { for (const auto & emsdevice : emsdevices) {
if ((emsdevice) && (emsdevice->device_type() == device_class.first)) { if ((emsdevice) && (emsdevice->device_type() == device_class.first)) {
emsdevice->show_values(shell); // print header
shell.printfln(F("%s: %s"), emsdevice->device_type_name().c_str(), emsdevice->to_string().c_str());
doc.clear(); // clear so we can re-use for each device
JsonArray root = doc.to<JsonArray>();
emsdevice->device_info_web(root); // create array
// iterate values and print to shell
uint8_t key_value = 0;
for (const JsonVariant & value : root) {
shell.printf((++key_value & 1) ? " %s: " : "%s\r\n", value.as<const char *>());
}
shell.println();
} }
} }
} }
@@ -358,7 +373,6 @@ void EMSESP::publish_device_values(uint8_t device_type, bool force) {
emsdevice->publish_values(json, force); emsdevice->publish_values(json, force);
} }
} }
// doc.shrinkToFit();
Mqtt::publish("mixer_data", doc.as<JsonObject>()); Mqtt::publish("mixer_data", doc.as<JsonObject>());
return; return;
} }
@@ -663,7 +677,7 @@ void EMSESP::device_info_web(const uint8_t unique_id, JsonObject & root) {
for (const auto & emsdevice : emsdevices) { for (const auto & emsdevice : emsdevices) {
if (emsdevice) { if (emsdevice) {
if (emsdevice->unique_id() == unique_id) { if (emsdevice->unique_id() == unique_id) {
root["deviceName"] = emsdevice->to_string_short(); // can;t use c_str() because of scope root["deviceName"] = emsdevice->to_string_short(); // can't use c_str() because of scope
JsonArray data = root.createNestedArray("deviceData"); JsonArray data = root.createNestedArray("deviceData");
emsdevice->device_info_web(data); emsdevice->device_info_web(data);
return; return;

View File

@@ -193,12 +193,16 @@ MAKE_PSTR(wWSetPumpPower, "Warm water pump set power")
MAKE_PSTR(wwMixTemperature, "Warm water mix temperature") MAKE_PSTR(wwMixTemperature, "Warm water mix temperature")
MAKE_PSTR(wwBufferTemperature, "Warm water buffer temperature") MAKE_PSTR(wwBufferTemperature, "Warm water buffer temperature")
MAKE_PSTR(wWStarts, "Warm water starts") MAKE_PSTR(wWStarts, "Warm water starts")
MAKE_PSTR(wWWorkM, "Warm water active time") MAKE_PSTR(wWWorkM, "Warm water active time (min)")
MAKE_PSTR(wWWorkMtxt, "Warm water active time")
MAKE_PSTR(setBurnPow, "Burner set power") MAKE_PSTR(setBurnPow, "Burner set power")
MAKE_PSTR(burnStarts, "Burner starts") MAKE_PSTR(burnStarts, "Burner starts")
MAKE_PSTR(burnWorkMin, "Burner active time") MAKE_PSTR(burnWorkMin, "Burner active time (min)")
MAKE_PSTR(heatWorkMin, "Heating active time") MAKE_PSTR(heatWorkMin, "Heating active time (min)")
MAKE_PSTR(UBAuptime, "Boiler total uptime") MAKE_PSTR(burnWorkMintxt, "Burner active time")
MAKE_PSTR(heatWorkMintxt, "Heating active time")
MAKE_PSTR(UBAuptime, "Boiler total uptime (min)")
MAKE_PSTR(UBAuptimetxt, "Boiler total uptime")
// solar // solar
MAKE_PSTR(collectorTemp, "Collector temperature (TS1)") MAKE_PSTR(collectorTemp, "Collector temperature (TS1)")
@@ -208,7 +212,8 @@ MAKE_PSTR(tank1MaxTempCurrent, "Maximum Tank temperature")
MAKE_PSTR(heatExchangerTemp, "Heat exchanger temperature (TS6)") MAKE_PSTR(heatExchangerTemp, "Heat exchanger temperature (TS6)")
MAKE_PSTR(solarPumpModulation, "Solar pump modulation (PS1)") MAKE_PSTR(solarPumpModulation, "Solar pump modulation (PS1)")
MAKE_PSTR(cylinderPumpModulation, "Cylinder pump modulation (PS5)") MAKE_PSTR(cylinderPumpModulation, "Cylinder pump modulation (PS5)")
MAKE_PSTR(pumpWorkMin, "Pump working time") MAKE_PSTR(pumpWorkMin, "Pump working time (min)")
MAKE_PSTR(pumpWorkMintxt, "Pump working time")
MAKE_PSTR(energyLastHour, "Energy last hour") MAKE_PSTR(energyLastHour, "Energy last hour")
MAKE_PSTR(energyToday, "Energy today") MAKE_PSTR(energyToday, "Energy today")
MAKE_PSTR(energyTotal, "Energy total") MAKE_PSTR(energyTotal, "Energy total")

View File

@@ -40,6 +40,8 @@ static constexpr uint8_t EMS_VALUE_BOOL = 0xFF; // used to mark that somethi
static constexpr uint8_t EMS_VALUE_BOOL_OFF = 0x00; // boolean false static constexpr uint8_t EMS_VALUE_BOOL_OFF = 0x00; // boolean false
static constexpr uint8_t EMS_VALUE_BOOL_ON = 0x01; // boolean true. True can be 0x01 or 0xFF sometimes static constexpr uint8_t EMS_VALUE_BOOL_ON = 0x01; // boolean true. True can be 0x01 or 0xFF sometimes
static constexpr uint8_t EMS_VALUE_TIME = 0xFD; // for converting uint32 to time strings
static constexpr uint8_t EMS_VALUE_BOOL_NOTSET = 0xFE; // random number for booleans, that's not 0, 1 or FF static constexpr uint8_t EMS_VALUE_BOOL_NOTSET = 0xFE; // random number for booleans, that's not 0, 1 or FF
static constexpr uint8_t EMS_VALUE_UINT_NOTSET = 0xFF; // for 8-bit unsigned ints/bytes static constexpr uint8_t EMS_VALUE_UINT_NOTSET = 0xFF; // for 8-bit unsigned ints/bytes
static constexpr int8_t EMS_VALUE_INT_NOTSET = 0x7F; // for signed 8-bit ints/bytes static constexpr int8_t EMS_VALUE_INT_NOTSET = 0x7F; // for signed 8-bit ints/bytes

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "2.1.1b5" #define EMSESP_APP_VERSION "2.1.1b6"