mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
Helpers::hasValue()
This commit is contained in:
@@ -68,6 +68,8 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
register_telegram_type(0xE5, F("UBAMonitorSlowPlus"), false, std::bind(&Boiler::process_UBAMonitorSlowPlus, this, _1));
|
register_telegram_type(0xE5, F("UBAMonitorSlowPlus"), false, std::bind(&Boiler::process_UBAMonitorSlowPlus, this, _1));
|
||||||
|
|
||||||
register_telegram_type(0xE9, F("UBADHWStatus"), false, std::bind(&Boiler::process_UBADHWStatus, this, _1));
|
register_telegram_type(0xE9, F("UBADHWStatus"), false, std::bind(&Boiler::process_UBADHWStatus, this, _1));
|
||||||
|
|
||||||
|
// HeatPump specific
|
||||||
register_telegram_type(0xE3, F("HeatPumpMonitor1"), false, std::bind(&Boiler::process_HPMonitor1, this, _1));
|
register_telegram_type(0xE3, F("HeatPumpMonitor1"), false, std::bind(&Boiler::process_HPMonitor1, this, _1));
|
||||||
register_telegram_type(0xE5, F("HeatPumpMonitor2"), false, std::bind(&Boiler::process_HPMonitor2, this, _1));
|
register_telegram_type(0xE5, F("HeatPumpMonitor2"), false, std::bind(&Boiler::process_HPMonitor2, this, _1));
|
||||||
|
|
||||||
@@ -166,154 +168,157 @@ void Boiler::publish_values() {
|
|||||||
|
|
||||||
char s[10]; // for formatting strings
|
char s[10]; // for formatting strings
|
||||||
|
|
||||||
if (wWComfort_ == 0x00) {
|
if (Helpers::hasValue(wWComfort_)) {
|
||||||
doc["wWComfort"] = "Hot";
|
if (wWComfort_ == 0x00) {
|
||||||
} else if (wWComfort_ == 0xD8) {
|
doc["wWComfort"] = "Hot";
|
||||||
doc["wWComfort"] = "Eco";
|
} else if (wWComfort_ == 0xD8) {
|
||||||
} else if (wWComfort_ == 0xEC) {
|
doc["wWComfort"] = "Eco";
|
||||||
doc["wWComfort"] = "Intelligent";
|
} else if (wWComfort_ == 0xEC) {
|
||||||
|
doc["wWComfort"] = "Intelligent";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wWSelTemp_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(wWSelTemp_)) {
|
||||||
doc["wWSelTemp"] = wWSelTemp_;
|
doc["wWSelTemp"] = wWSelTemp_;
|
||||||
}
|
}
|
||||||
if (wWDisinfectTemp_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(wWDisinfectTemp_)) {
|
||||||
doc["wWDisinfectionTemp"] = wWDisinfectTemp_;
|
doc["wWDisinfectionTemp"] = wWDisinfectTemp_;
|
||||||
}
|
}
|
||||||
if (selFlowTemp_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(selFlowTemp_)) {
|
||||||
doc["selFlowTemp"] = selFlowTemp_;
|
doc["selFlowTemp"] = selFlowTemp_;
|
||||||
}
|
}
|
||||||
if (selBurnPow_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(selBurnPow_)) {
|
||||||
doc["selBurnPow"] = selBurnPow_;
|
doc["selBurnPow"] = selBurnPow_;
|
||||||
}
|
}
|
||||||
if (curBurnPow_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(curBurnPow_)) {
|
||||||
doc["curBurnPow"] = curBurnPow_;
|
doc["curBurnPow"] = curBurnPow_;
|
||||||
}
|
}
|
||||||
if (pumpMod_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(pumpMod_)) {
|
||||||
doc["pumpMod"] = pumpMod_;
|
doc["pumpMod"] = pumpMod_;
|
||||||
}
|
}
|
||||||
if (wWCircPump_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWCircPump_, true)) {
|
||||||
doc["wWCircPump"] = Helpers::render_value(s, wWCircPump_, EMS_VALUE_BOOL);
|
doc["wWCircPump"] = Helpers::render_value(s, wWCircPump_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (wWCircPumpType_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWCircPumpType_)) {
|
||||||
doc["wWCiPuType"] = wWCircPumpType_ ? "valve" : "pump";
|
doc["wWCiPuType"] = wWCircPumpType_ ? "valve" : "pump";
|
||||||
}
|
}
|
||||||
if (wWCircPumpMode_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(wWCircPumpMode_)) {
|
||||||
doc["wWCiPuMode"] = wWCircPumpMode_;
|
doc["wWCiPuMode"] = wWCircPumpMode_;
|
||||||
}
|
}
|
||||||
if (wWCirc_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWCirc_)) {
|
||||||
doc["wWCirc"] = Helpers::render_value(s, wWCirc_, EMS_VALUE_BOOL);
|
doc["wWCirc"] = Helpers::render_value(s, wWCirc_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (extTemp_ != EMS_VALUE_SHORT_NOTSET) {
|
if (Helpers::hasValue(extTemp_)) {
|
||||||
doc["outdoorTemp"] = (float)extTemp_ / 10;
|
doc["outdoorTemp"] = (float)extTemp_ / 10;
|
||||||
}
|
}
|
||||||
if (wWCurTmp_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(wWCurTmp_)) {
|
||||||
doc["wWCurTmp"] = (float)wWCurTmp_ / 10;
|
doc["wWCurTmp"] = (float)wWCurTmp_ / 10;
|
||||||
}
|
}
|
||||||
if (wWCurFlow_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(wWCurFlow_)) {
|
||||||
doc["wWCurFlow"] = (float)wWCurFlow_ / 10;
|
doc["wWCurFlow"] = (float)wWCurFlow_ / 10;
|
||||||
}
|
}
|
||||||
if (curFlowTemp_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(curFlowTemp_)) {
|
||||||
doc["curFlowTemp"] = (float)curFlowTemp_ / 10;
|
doc["curFlowTemp"] = (float)curFlowTemp_ / 10;
|
||||||
}
|
}
|
||||||
if (retTemp_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(retTemp_)) {
|
||||||
doc["retTemp"] = (float)retTemp_ / 10;
|
doc["retTemp"] = (float)retTemp_ / 10;
|
||||||
}
|
}
|
||||||
if (switchTemp_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(switchTemp_)) {
|
||||||
doc["switchTemp"] = (float)switchTemp_ / 10;
|
doc["switchTemp"] = (float)switchTemp_ / 10;
|
||||||
}
|
}
|
||||||
if (sysPress_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(sysPress_)) {
|
||||||
doc["sysPress"] = (float)sysPress_ / 10;
|
doc["sysPress"] = (float)sysPress_ / 10;
|
||||||
}
|
}
|
||||||
if (boilTemp_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(boilTemp_)) {
|
||||||
doc["boilTemp"] = (float)boilTemp_ / 10;
|
doc["boilTemp"] = (float)boilTemp_ / 10;
|
||||||
}
|
}
|
||||||
if (wwStorageTemp1_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(wwStorageTemp1_)) {
|
||||||
doc["wwStorageTemp1"] = (float)wwStorageTemp1_ / 10;
|
doc["wwStorageTemp1"] = (float)wwStorageTemp1_ / 10;
|
||||||
}
|
}
|
||||||
if (wwStorageTemp2_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(wwStorageTemp2_)) {
|
||||||
doc["wwStorageTemp2"] = (float)wwStorageTemp2_ / 10;
|
doc["wwStorageTemp2"] = (float)wwStorageTemp2_ / 10;
|
||||||
}
|
}
|
||||||
if (exhaustTemp_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(exhaustTemp_)) {
|
||||||
doc["exhaustTemp"] = (float)exhaustTemp_ / 10;
|
doc["exhaustTemp"] = (float)exhaustTemp_ / 10;
|
||||||
}
|
}
|
||||||
if (wWActivated_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWActivated_, true)) {
|
||||||
doc["wWActivated"] = Helpers::render_value(s, wWActivated_, EMS_VALUE_BOOL);
|
doc["wWActivated"] = Helpers::render_value(s, wWActivated_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (wWOneTime_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWOneTime_, true)) {
|
||||||
doc["wWOnetime"] = Helpers::render_value(s, wWOneTime_, EMS_VALUE_BOOL);
|
doc["wWOnetime"] = Helpers::render_value(s, wWOneTime_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (wWDesinfecting_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWDesinfecting_, true)) {
|
||||||
doc["wWDesinfecting"] = Helpers::render_value(s, wWDesinfecting_, EMS_VALUE_BOOL);
|
doc["wWDesinfecting"] = Helpers::render_value(s, wWDesinfecting_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (wWReadiness_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWReadiness_, true)) {
|
||||||
doc["wWReady"] = Helpers::render_value(s, wWReadiness_, EMS_VALUE_BOOL);
|
doc["wWReady"] = Helpers::render_value(s, wWReadiness_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (wWRecharging_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWRecharging_, true)) {
|
||||||
doc["wWRecharge"] = Helpers::render_value(s, wWRecharging_, EMS_VALUE_BOOL);
|
doc["wWRecharge"] = Helpers::render_value(s, wWRecharging_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (wWTemperatureOK_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWTemperatureOK_, true)) {
|
||||||
doc["wWTempOK"] = Helpers::render_value(s, wWTemperatureOK_, EMS_VALUE_BOOL);
|
doc["wWTempOK"] = Helpers::render_value(s, wWTemperatureOK_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (wWCirc_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWCirc_, true)) {
|
||||||
doc["wWCirc"] = Helpers::render_value(s, wWCirc_, EMS_VALUE_BOOL);
|
doc["wWCirc"] = Helpers::render_value(s, wWCirc_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (burnGas_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(burnGas_, true)) {
|
||||||
doc["burnGas"] = Helpers::render_value(s, burnGas_, EMS_VALUE_BOOL);
|
doc["burnGas"] = Helpers::render_value(s, burnGas_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (flameCurr_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(flameCurr_)) {
|
||||||
doc["flameCurr"] = (float)(int16_t)flameCurr_ / 10;
|
doc["flameCurr"] = (float)(int16_t)flameCurr_ / 10;
|
||||||
}
|
}
|
||||||
if (heatPmp_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(heatPmp_, true)) {
|
||||||
doc["heatPmp"] = Helpers::render_value(s, heatPmp_, EMS_VALUE_BOOL);
|
doc["heatPmp"] = Helpers::render_value(s, heatPmp_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (fanWork_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(fanWork_, true)) {
|
||||||
doc["fanWork"] = Helpers::render_value(s, fanWork_, EMS_VALUE_BOOL);
|
doc["fanWork"] = Helpers::render_value(s, fanWork_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (ignWork_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(ignWork_, true)) {
|
||||||
doc["ignWork"] = Helpers::render_value(s, ignWork_, EMS_VALUE_BOOL);
|
doc["ignWork"] = Helpers::render_value(s, ignWork_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (wWHeat_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(wWHeat_, true)) {
|
||||||
doc["wWHeat"] = Helpers::render_value(s, wWHeat_, EMS_VALUE_BOOL);
|
doc["wWHeat"] = Helpers::render_value(s, wWHeat_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (heating_temp_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(heating_temp_)) {
|
||||||
doc["heating_temp"] = heating_temp_;
|
doc["heating_temp"] = heating_temp_;
|
||||||
}
|
}
|
||||||
if (pump_mod_max_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(pump_mod_max_)) {
|
||||||
doc["pump_mod_max"] = pump_mod_max_;
|
doc["pump_mod_max"] = pump_mod_max_;
|
||||||
}
|
}
|
||||||
if (pump_mod_min_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(pump_mod_min_)) {
|
||||||
doc["pump_mod_min"] = pump_mod_min_;
|
doc["pump_mod_min"] = pump_mod_min_;
|
||||||
}
|
}
|
||||||
if (wWStarts_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(wWStarts_)) {
|
||||||
doc["wWStarts"] = wWStarts_;
|
doc["wWStarts"] = wWStarts_;
|
||||||
}
|
}
|
||||||
if (wWWorkM_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(wWWorkM_)) {
|
||||||
doc["wWWorkM"] = wWWorkM_;
|
doc["wWWorkM"] = wWWorkM_;
|
||||||
}
|
}
|
||||||
if (UBAuptime_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(UBAuptime_)) {
|
||||||
doc["UBAuptime"] = UBAuptime_;
|
doc["UBAuptime"] = UBAuptime_;
|
||||||
}
|
}
|
||||||
if (burnStarts_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(burnStarts_)) {
|
||||||
doc["burnStarts"] = burnStarts_;
|
doc["burnStarts"] = burnStarts_;
|
||||||
}
|
}
|
||||||
if (burnWorkMin_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(burnWorkMin_)) {
|
||||||
doc["burnWorkMin"] = burnWorkMin_;
|
doc["burnWorkMin"] = burnWorkMin_;
|
||||||
}
|
}
|
||||||
if (heatWorkMin_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(heatWorkMin_)) {
|
||||||
doc["heatWorkMin"] = heatWorkMin_;
|
doc["heatWorkMin"] = heatWorkMin_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serviceCode_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(serviceCode_)) {
|
||||||
doc["serviceCode"] = serviceCodeChar_;
|
doc["serviceCode"] = serviceCodeChar_;
|
||||||
doc["serviceCodeNumber"] = serviceCode_;
|
doc["serviceCodeNumber"] = serviceCode_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// heatpump specific
|
// heatpump specific
|
||||||
if (hpModulation_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hpModulation_)) {
|
||||||
doc["pumpmodulation"] = hpModulation_;
|
doc["pumpmodulation"] = hpModulation_;
|
||||||
}
|
}
|
||||||
if (hpSpeed_ != EMS_VALUE_UINT_NOTSET) {
|
|
||||||
|
if (Helpers::hasValue(hpSpeed_)) {
|
||||||
doc["pumpspeed"] = hpSpeed_;
|
doc["pumpspeed"] = hpSpeed_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,11 +343,11 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
|||||||
|
|
||||||
char buffer[10]; // used for formatting
|
char buffer[10]; // used for formatting
|
||||||
|
|
||||||
if (tap_water_active_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(tap_water_active_, true)) {
|
||||||
print_value(shell, 2, F("Hot tap water"), tap_water_active_ ? "running" : "off");
|
print_value(shell, 2, F("Hot tap water"), tap_water_active_ ? "running" : "off");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (heating_active_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(heating_active_, true)) {
|
||||||
print_value(shell, 2, F("Central heating"), heating_active_ ? "active" : "off");
|
print_value(shell, 2, F("Central heating"), heating_active_ ? "active" : "off");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +387,7 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
|||||||
print_value(shell, 2, F("Warm water storage temperature (extern)"), F_(degrees), Helpers::render_value(buffer, wwStorageTemp2_, 10));
|
print_value(shell, 2, F("Warm water storage temperature (extern)"), F_(degrees), Helpers::render_value(buffer, wwStorageTemp2_, 10));
|
||||||
print_value(shell, 2, F("Warm Water current tap water flow"), F("l/min"), Helpers::render_value(buffer, wWCurFlow_, 10));
|
print_value(shell, 2, F("Warm Water current tap water flow"), F("l/min"), Helpers::render_value(buffer, wWCurFlow_, 10));
|
||||||
print_value(shell, 2, F("Warm Water # starts"), Helpers::render_value(buffer, wWStarts_, 1));
|
print_value(shell, 2, F("Warm Water # starts"), Helpers::render_value(buffer, wWStarts_, 1));
|
||||||
if (wWWorkM_ != EMS_VALUE_ULONG_NOTSET) {
|
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.printfln(F(" Warm Water active time: %d days %d hours %d minutes"), wWWorkM_ / 1440, (wWWorkM_ % 1440) / 60, wWWorkM_ % 60);
|
||||||
}
|
}
|
||||||
print_value(shell, 2, F("Warm Water charging"), Helpers::render_value(buffer, wWHeat_, EMS_VALUE_BOOL));
|
print_value(shell, 2, F("Warm Water charging"), Helpers::render_value(buffer, wWHeat_, EMS_VALUE_BOOL));
|
||||||
@@ -400,7 +405,7 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
|||||||
print_value(shell, 2, F("Burner current power"), F_(percent), Helpers::render_value(buffer, curBurnPow_, 1));
|
print_value(shell, 2, F("Burner current power"), F_(percent), Helpers::render_value(buffer, curBurnPow_, 1));
|
||||||
print_value(shell, 2, F("Flame current"), F("uA"), Helpers::render_value(buffer, flameCurr_, 10));
|
print_value(shell, 2, F("Flame current"), F("uA"), Helpers::render_value(buffer, flameCurr_, 10));
|
||||||
print_value(shell, 2, F("System pressure"), F("bar"), Helpers::render_value(buffer, sysPress_, 10));
|
print_value(shell, 2, F("System pressure"), F("bar"), Helpers::render_value(buffer, sysPress_, 10));
|
||||||
if (serviceCode_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(serviceCode_)) {
|
||||||
shell.printfln(F(" System service code: %s (%d)"), serviceCodeChar_, serviceCode_);
|
shell.printfln(F(" System service code: %s (%d)"), serviceCodeChar_, serviceCode_);
|
||||||
} else if (serviceCodeChar_[0] != '\0') {
|
} else if (serviceCodeChar_[0] != '\0') {
|
||||||
shell.printfln(F(" System service code: %s"), serviceCodeChar_);
|
shell.printfln(F(" System service code: %s"), serviceCodeChar_);
|
||||||
@@ -412,28 +417,28 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
|||||||
print_value(shell, 2, F("Boiler circuit pump modulation min power"), F_(percent), Helpers::render_value(buffer, pump_mod_min_, 1));
|
print_value(shell, 2, F("Boiler circuit pump modulation min power"), F_(percent), Helpers::render_value(buffer, pump_mod_min_, 1));
|
||||||
|
|
||||||
// UBAMonitorSlow
|
// UBAMonitorSlow
|
||||||
if (extTemp_ != EMS_VALUE_SHORT_NOTSET) {
|
if (Helpers::hasValue(extTemp_)) {
|
||||||
print_value(shell, 2, F("Outside temperature"), F_(degrees), Helpers::render_value(buffer, extTemp_, 10));
|
print_value(shell, 2, F("Outside temperature"), F_(degrees), Helpers::render_value(buffer, extTemp_, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
print_value(shell, 2, F("Exhaust temperature"), F_(degrees), Helpers::render_value(buffer, exhaustTemp_, 10));
|
print_value(shell, 2, F("Exhaust temperature"), F_(degrees), Helpers::render_value(buffer, exhaustTemp_, 10));
|
||||||
print_value(shell, 2, F("Pump modulation"), F_(percent), Helpers::render_value(buffer, pumpMod_, 1));
|
print_value(shell, 2, F("Pump modulation"), F_(percent), Helpers::render_value(buffer, pumpMod_, 1));
|
||||||
print_value(shell, 2, F("Burner # starts"), Helpers::render_value(buffer, burnStarts_, 1));
|
print_value(shell, 2, F("Burner # starts"), Helpers::render_value(buffer, burnStarts_, 1));
|
||||||
if (burnWorkMin_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(burnWorkMin_)) {
|
||||||
shell.printfln(F(" Total burner operating time: %d days %d hours %d minutes"), burnWorkMin_ / 1440, (burnWorkMin_ % 1440) / 60, burnWorkMin_ % 60);
|
shell.printfln(F(" Total burner operating time: %d days %d hours %d minutes"), burnWorkMin_ / 1440, (burnWorkMin_ % 1440) / 60, burnWorkMin_ % 60);
|
||||||
}
|
}
|
||||||
if (heatWorkMin_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(heatWorkMin_)) {
|
||||||
shell.printfln(F(" Total heat operating time: %d days %d hours %d minutes"), heatWorkMin_ / 1440, (heatWorkMin_ % 1440) / 60, heatWorkMin_ % 60);
|
shell.printfln(F(" Total heat operating time: %d days %d hours %d minutes"), heatWorkMin_ / 1440, (heatWorkMin_ % 1440) / 60, heatWorkMin_ % 60);
|
||||||
}
|
}
|
||||||
if (UBAuptime_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(UBAuptime_)) {
|
||||||
shell.printfln(F(" Total UBA working time: %d days %d hours %d minutes"), UBAuptime_ / 1440, (UBAuptime_ % 1440) / 60, UBAuptime_ % 60);
|
shell.printfln(F(" Total UBA working time: %d days %d hours %d minutes"), UBAuptime_ / 1440, (UBAuptime_ % 1440) / 60, UBAuptime_ % 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hpModulation_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hpModulation_)) {
|
||||||
print_value(shell, 2, F("Heat Pump modulation"), F_(percent), Helpers::render_value(buffer, hpModulation_, 1));
|
print_value(shell, 2, F("Heat Pump modulation"), F_(percent), Helpers::render_value(buffer, hpModulation_, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hpSpeed_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hpSpeed_)) {
|
||||||
print_value(shell, 2, F("Heat Pump speed"), F_(percent), Helpers::render_value(buffer, hpSpeed_, 1));
|
print_value(shell, 2, F("Heat Pump speed"), F_(percent), Helpers::render_value(buffer, hpSpeed_, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -445,20 +450,20 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
|||||||
void Boiler::check_active() {
|
void Boiler::check_active() {
|
||||||
// hot tap water, using flow to check instead of the burner power
|
// hot tap water, using flow to check instead of the burner power
|
||||||
// send these values back to the main EMSESP, so other classes (e.g. Shower) can use it
|
// send these values back to the main EMSESP, so other classes (e.g. Shower) can use it
|
||||||
if (wWCurFlow_ != EMS_VALUE_UINT_NOTSET && burnGas_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(wWCurFlow_) && Helpers::hasValue(burnGas_)) {
|
||||||
tap_water_active_ = ((wWCurFlow_ != 0) && (burnGas_ != EMS_VALUE_BOOL_OFF));
|
tap_water_active_ = ((wWCurFlow_ != 0) && (burnGas_ != EMS_VALUE_BOOL_OFF));
|
||||||
EMSESP::tap_water_active(tap_water_active_);
|
EMSESP::tap_water_active(tap_water_active_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// heating
|
// heating
|
||||||
// using a quick hack for checking the heating by looking at the Selected Flow Temp, but doesn't work for all boilers apparently
|
// using a quick hack for checking the heating by looking at the Selected Flow Temp, but doesn't work for all boilers apparently
|
||||||
if (selFlowTemp_ != EMS_VALUE_UINT_NOTSET && burnGas_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(selFlowTemp_) && Helpers::hasValue(burnGas_)) {
|
||||||
heating_active_ = (!tap_water_active_ && ((selFlowTemp_ >= EMS_BOILER_SELFLOWTEMP_HEATING) && (burnGas_ != EMS_VALUE_BOOL_OFF)));
|
heating_active_ = (!tap_water_active_ && ((selFlowTemp_ >= EMS_BOILER_SELFLOWTEMP_HEATING) && (burnGas_ != EMS_VALUE_BOOL_OFF)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if the heating or hot tap water has changed, if so send
|
// see if the heating or hot tap water has changed, if so send
|
||||||
// last_boilerActive stores heating in bit 1 and tap water in bit 2
|
// last_boilerActive stores heating in bit 1 and tap water in bit 2
|
||||||
if ((tap_water_active_ != EMS_VALUE_BOOL_NOTSET) && (heating_active_ != EMS_VALUE_BOOL_NOTSET)) {
|
if (Helpers::hasValue(tap_water_active_, true) && Helpers::hasValue(heating_active_, true)) {
|
||||||
uint8_t latest_boilerState = (tap_water_active_ << 1) + heating_active_;
|
uint8_t latest_boilerState = (tap_water_active_ << 1) + heating_active_;
|
||||||
if (latest_boilerState != last_boilerState) {
|
if (latest_boilerState != last_boilerState) {
|
||||||
last_boilerState = latest_boilerState;
|
last_boilerState = latest_boilerState;
|
||||||
|
|||||||
@@ -100,19 +100,19 @@ void Mixing::publish_values() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flowTemp_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(flowTemp_)) {
|
||||||
doc["flowTemp"] = (float)flowTemp_ / 10;
|
doc["flowTemp"] = (float)flowTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pumpMod_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(pumpMod_)) {
|
||||||
doc["pumpMod"] = pumpMod_;
|
doc["pumpMod"] = pumpMod_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(status_)) {
|
||||||
doc["status"] = status_;
|
doc["status"] = status_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flowSetTemp_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(flowSetTemp_)) {
|
||||||
doc["flowSetTemp"] = flowSetTemp_;
|
doc["flowSetTemp"] = flowSetTemp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void Solar::show_values(uuid::console::Shell & shell) {
|
|||||||
print_value(shell, 2, F("Valve (VS2) status"), Helpers::render_value(buffer, valveStatus_, EMS_VALUE_BOOL));
|
print_value(shell, 2, F("Valve (VS2) status"), Helpers::render_value(buffer, valveStatus_, EMS_VALUE_BOOL));
|
||||||
print_value(shell, 2, F("Pump (PS1) active"), Helpers::render_value(buffer, pump_, EMS_VALUE_BOOL));
|
print_value(shell, 2, F("Pump (PS1) active"), Helpers::render_value(buffer, pump_, EMS_VALUE_BOOL));
|
||||||
|
|
||||||
if (pumpWorkMin_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(pumpWorkMin_)) {
|
||||||
shell.printfln(F(" Pump working time: %d days %d hours %d minutes"), pumpWorkMin_ / 1440, (pumpWorkMin_ % 1440) / 60, pumpWorkMin_ % 60);
|
shell.printfln(F(" Pump working time: %d days %d hours %d minutes"), pumpWorkMin_ / 1440, (pumpWorkMin_ % 1440) / 60, pumpWorkMin_ % 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,34 +81,34 @@ void Solar::publish_values() {
|
|||||||
|
|
||||||
char s[10]; // for formatting strings
|
char s[10]; // for formatting strings
|
||||||
|
|
||||||
if (collectorTemp_ != EMS_VALUE_SHORT_NOTSET) {
|
if (Helpers::hasValue(collectorTemp_)) {
|
||||||
doc["collectortemp"] = (float)collectorTemp_ / 10;
|
doc["collectortemp"] = (float)collectorTemp_ / 10;
|
||||||
}
|
}
|
||||||
if (bottomTemp_ != EMS_VALUE_SHORT_NOTSET) {
|
if (Helpers::hasValue(bottomTemp_)) {
|
||||||
doc["bottomtemp"] = (float)bottomTemp_ / 10;
|
doc["bottomtemp"] = (float)bottomTemp_ / 10;
|
||||||
}
|
}
|
||||||
if (bottomTemp2_ != EMS_VALUE_SHORT_NOTSET) {
|
if (Helpers::hasValue(bottomTemp2_)) {
|
||||||
doc["bottomtemp2"] = (float)bottomTemp2_ / 10;
|
doc["bottomtemp2"] = (float)bottomTemp2_ / 10;
|
||||||
}
|
}
|
||||||
if (pumpModulation_ != EMS_VALUE_INT_NOTSET) {
|
if (Helpers::hasValue(pumpModulation_)) {
|
||||||
doc["pumpmodulation"] = pumpModulation_;
|
doc["pumpmodulation"] = pumpModulation_;
|
||||||
}
|
}
|
||||||
if (pump_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(pump_, true)) {
|
||||||
doc["pump"] = Helpers::render_value(s, pump_, EMS_VALUE_BOOL);
|
doc["pump"] = Helpers::render_value(s, pump_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (valveStatus_ != EMS_VALUE_BOOL_NOTSET) {
|
if (Helpers::hasValue(valveStatus_, true)) {
|
||||||
doc["valvestatus"] = Helpers::render_value(s, valveStatus_, EMS_VALUE_BOOL);
|
doc["valvestatus"] = Helpers::render_value(s, valveStatus_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (pumpWorkMin_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(pumpWorkMin_)) {
|
||||||
doc["pumpWorkMin"] = (float)pumpWorkMin_;
|
doc["pumpWorkMin"] = (float)pumpWorkMin_;
|
||||||
}
|
}
|
||||||
if (energyLastHour_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(energyLastHour_)) {
|
||||||
doc["energylasthour"] = (float)energyLastHour_ / 10;
|
doc["energylasthour"] = (float)energyLastHour_ / 10;
|
||||||
}
|
}
|
||||||
if (energyToday_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(energyToday_)) {
|
||||||
doc["energytoday"] = energyToday_;
|
doc["energytoday"] = energyToday_;
|
||||||
}
|
}
|
||||||
if (energyTotal_ != EMS_VALUE_ULONG_NOTSET) {
|
if (Helpers::hasValue(energyTotal_)) {
|
||||||
doc["energytotal"] = (float)energyTotal_ / 10;
|
doc["energytotal"] = (float)energyTotal_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -427,8 +427,7 @@ bool Thermostat::updated_values() {
|
|||||||
static uint16_t current_value_ = 0;
|
static uint16_t current_value_ = 0;
|
||||||
for (const auto & hc : heating_circuits_) {
|
for (const auto & hc : heating_circuits_) {
|
||||||
// don't publish if we haven't yet received some data
|
// don't publish if we haven't yet received some data
|
||||||
// if ((hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) || (hc->curr_roomTemp == EMS_VALUE_SHORT_NOTSET)) {
|
if (!Helpers::hasValue(hc->setpoint_roomTemp)) {
|
||||||
if (hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
new_value += hc->setpoint_roomTemp + hc->curr_roomTemp + hc->mode;
|
new_value += hc->setpoint_roomTemp + hc->curr_roomTemp + hc->mode;
|
||||||
@@ -464,22 +463,22 @@ void Thermostat::publish_values() {
|
|||||||
if (datetime_.size()) {
|
if (datetime_.size()) {
|
||||||
rootThermostat["time"] = datetime_.c_str();
|
rootThermostat["time"] = datetime_.c_str();
|
||||||
}
|
}
|
||||||
if (dampedoutdoortemp_ != EMS_VALUE_INT_NOTSET) {
|
if (Helpers::hasValue(dampedoutdoortemp_)) {
|
||||||
rootThermostat["dampedtemp"] = dampedoutdoortemp_;
|
rootThermostat["dampedtemp"] = dampedoutdoortemp_;
|
||||||
}
|
}
|
||||||
if (tempsensor1_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(tempsensor1_)) {
|
||||||
rootThermostat["inttemp1"] = (float)tempsensor1_ / 10;
|
rootThermostat["inttemp1"] = (float)tempsensor1_ / 10;
|
||||||
}
|
}
|
||||||
if (tempsensor2_ != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(tempsensor2_)) {
|
||||||
rootThermostat["inttemp2"] = (float)tempsensor2_ / 10;
|
rootThermostat["inttemp2"] = (float)tempsensor2_ / 10;
|
||||||
}
|
}
|
||||||
if (ibaCalIntTemperature_ != EMS_VALUE_INT_NOTSET) {
|
if (Helpers::hasValue(ibaCalIntTemperature_)) {
|
||||||
rootThermostat["intoffset"] = (float)ibaCalIntTemperature_ / 2;
|
rootThermostat["intoffset"] = (float)ibaCalIntTemperature_ / 2;
|
||||||
}
|
}
|
||||||
if (ibaMinExtTemperature_ != EMS_VALUE_INT_NOTSET) {
|
if (Helpers::hasValue(ibaMinExtTemperature_)) {
|
||||||
rootThermostat["minexttemp"] = (float)ibaMinExtTemperature_; // min ext temp for heating curve, in deg.
|
rootThermostat["minexttemp"] = (float)ibaMinExtTemperature_; // min ext temp for heating curve, in deg.
|
||||||
}
|
}
|
||||||
if (ibaBuildingType_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(ibaBuildingType_)) {
|
||||||
if (ibaBuildingType_ == 0) {
|
if (ibaBuildingType_ == 0) {
|
||||||
rootThermostat["building"] = "light";
|
rootThermostat["building"] = "light";
|
||||||
} else if (ibaBuildingType_ == 1) {
|
} else if (ibaBuildingType_ == 1) {
|
||||||
@@ -496,8 +495,7 @@ void Thermostat::publish_values() {
|
|||||||
|
|
||||||
// go through all the heating circuits
|
// go through all the heating circuits
|
||||||
for (const auto & hc : heating_circuits_) {
|
for (const auto & hc : heating_circuits_) {
|
||||||
// if ((hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) || (hc->curr_roomTemp == EMS_VALUE_SHORT_NOTSET)) {
|
if (!Helpers::hasValue(hc->setpoint_roomTemp)) {
|
||||||
if (hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) {
|
|
||||||
break; // skip this HC
|
break; // skip this HC
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,45 +526,45 @@ void Thermostat::publish_values() {
|
|||||||
curr_temp_divider = 10;
|
curr_temp_divider = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hc->setpoint_roomTemp != EMS_VALUE_SHORT_NOTSET) {
|
if (Helpers::hasValue(hc->setpoint_roomTemp)) {
|
||||||
dataThermostat["seltemp"] = Helpers::round2((float)hc->setpoint_roomTemp / setpoint_temp_divider);
|
dataThermostat["seltemp"] = Helpers::round2((float)hc->setpoint_roomTemp / setpoint_temp_divider);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hc->curr_roomTemp != EMS_VALUE_SHORT_NOTSET && hc->curr_roomTemp != EMS_VALUE_USHORT_NOTSET) {
|
if (Helpers::hasValue(hc->curr_roomTemp)) {
|
||||||
dataThermostat["currtemp"] = Helpers::round2((float)hc->curr_roomTemp / curr_temp_divider);
|
dataThermostat["currtemp"] = Helpers::round2((float)hc->curr_roomTemp / curr_temp_divider);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hc->daytemp != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hc->daytemp)) {
|
||||||
dataThermostat["daytemp"] = (float)hc->daytemp / 2;
|
dataThermostat["daytemp"] = (float)hc->daytemp / 2;
|
||||||
}
|
}
|
||||||
if (hc->nighttemp != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hc->nighttemp)) {
|
||||||
dataThermostat["nighttemp"] = (float)hc->nighttemp / 2;
|
dataThermostat["nighttemp"] = (float)hc->nighttemp / 2;
|
||||||
}
|
}
|
||||||
if (hc->holidaytemp != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hc->holidaytemp)) {
|
||||||
dataThermostat["holidaytemp"] = (float)hc->holidaytemp / 2;
|
dataThermostat["holidaytemp"] = (float)hc->holidaytemp / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hc->heatingtype != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hc->heatingtype)) {
|
||||||
dataThermostat["heatingtype"] = hc->heatingtype;
|
dataThermostat["heatingtype"] = hc->heatingtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hc->circuitcalctemp != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hc->circuitcalctemp)) {
|
||||||
dataThermostat["circuitcalctemp"] = hc->circuitcalctemp;
|
dataThermostat["circuitcalctemp"] = hc->circuitcalctemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hc->offsettemp != EMS_VALUE_INT_NOTSET) {
|
if (Helpers::hasValue(hc->offsettemp)) {
|
||||||
dataThermostat["offsettemp"] = hc->offsettemp / 2;
|
dataThermostat["offsettemp"] = hc->offsettemp / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hc->designtemp != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hc->designtemp)) {
|
||||||
dataThermostat["designtemp"] = hc->designtemp;
|
dataThermostat["designtemp"] = hc->designtemp;
|
||||||
}
|
}
|
||||||
if (hc->summertemp != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hc->summertemp)) {
|
||||||
dataThermostat["summertemp"] = hc->summertemp;
|
dataThermostat["summertemp"] = hc->summertemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// when using HA always send the mode otherwise it'll break the component/widget and report an error
|
// when using HA always send the mode otherwise it'll break the component/widget and report an error
|
||||||
if ((hc->mode != EMS_VALUE_UINT_NOTSET) || (mqtt_format_ == Settings::MQTT_format::HA)) {
|
if ((Helpers::hasValue(hc->mode)) || (mqtt_format_ == Settings::MQTT_format::HA)) {
|
||||||
uint8_t hc_mode = hc->get_mode(flags);
|
uint8_t hc_mode = hc->get_mode(flags);
|
||||||
// if we're sending to HA the only valid mode types are heat, auto and off
|
// if we're sending to HA the only valid mode types are heat, auto and off
|
||||||
if (mqtt_format_ == Settings::MQTT_format::HA) {
|
if (mqtt_format_ == Settings::MQTT_format::HA) {
|
||||||
@@ -588,10 +586,10 @@ void Thermostat::publish_values() {
|
|||||||
dataThermostat["modetype"] = F("summer");
|
dataThermostat["modetype"] = F("summer");
|
||||||
} else if (hc->holiday_mode) {
|
} else if (hc->holiday_mode) {
|
||||||
dataThermostat["modetype"] = F("holiday");
|
dataThermostat["modetype"] = F("holiday");
|
||||||
} else if (hc->mode_type != EMS_VALUE_UINT_NOTSET) {
|
} else if (Helpers::hasValue(hc->mode_type)) {
|
||||||
dataThermostat["modetype"] = mode_tostring(hc->get_mode_type(flags));
|
dataThermostat["modetype"] = mode_tostring(hc->get_mode_type(flags));
|
||||||
}
|
}
|
||||||
} else if (hc->mode_type != EMS_VALUE_UINT_NOTSET) {
|
} else if (Helpers::hasValue(hc->mode_type)) {
|
||||||
dataThermostat["modetype"] = mode_tostring(hc->get_mode_type(flags));
|
dataThermostat["modetype"] = mode_tostring(hc->get_mode_type(flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -683,7 +681,7 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::sha
|
|||||||
// decodes the thermostat mode for the heating circuit based on the thermostat type
|
// decodes the thermostat mode for the heating circuit based on the thermostat type
|
||||||
// modes are off, manual, auto, day and night
|
// modes are off, manual, auto, day and night
|
||||||
uint8_t Thermostat::HeatingCircuit::get_mode(uint8_t flags) const {
|
uint8_t Thermostat::HeatingCircuit::get_mode(uint8_t flags) const {
|
||||||
if (mode == EMS_VALUE_UINT_NOTSET) {
|
if (!Helpers::hasValue(mode)) {
|
||||||
return HeatingCircuit::Mode::UNKNOWN;
|
return HeatingCircuit::Mode::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -811,7 +809,7 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
|||||||
|
|
||||||
if (datetime_.size()) {
|
if (datetime_.size()) {
|
||||||
shell.printfln(F(" Clock: %s"), datetime_.c_str());
|
shell.printfln(F(" Clock: %s"), datetime_.c_str());
|
||||||
if (ibaClockOffset_ != EMS_VALUE_UINT_NOTSET && flags == EMS_DEVICE_FLAG_RC30_1) {
|
if (Helpers::hasValue(ibaClockOffset_) && flags == EMS_DEVICE_FLAG_RC30_1) {
|
||||||
print_value(shell, 2, F("Offset clock"), Helpers::render_value(buffer, ibaClockOffset_, 1)); // offset (in sec) to clock, 0xff = -1 s, 0x02 = 2 s
|
print_value(shell, 2, F("Offset clock"), Helpers::render_value(buffer, ibaClockOffset_, 1)); // offset (in sec) to clock, 0xff = -1 s, 0x02 = 2 s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -823,7 +821,7 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
if (flags == EMS_DEVICE_FLAG_RC30_1) {
|
if (flags == EMS_DEVICE_FLAG_RC30_1) {
|
||||||
// settings parameters
|
// settings parameters
|
||||||
if (ibaMainDisplay_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(ibaMainDisplay_)) {
|
||||||
if (ibaMainDisplay_ == 0) {
|
if (ibaMainDisplay_ == 0) {
|
||||||
shell.printfln(F(" Display: internal temperature"));
|
shell.printfln(F(" Display: internal temperature"));
|
||||||
} else if (ibaMainDisplay_ == 1) {
|
} else if (ibaMainDisplay_ == 1) {
|
||||||
@@ -845,7 +843,7 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ibaLanguage_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(ibaLanguage_)) {
|
||||||
if (ibaLanguage_ == 0) {
|
if (ibaLanguage_ == 0) {
|
||||||
shell.printfln(F(" Language: German"));
|
shell.printfln(F(" Language: German"));
|
||||||
} else if (ibaLanguage_ == 1) {
|
} else if (ibaLanguage_ == 1) {
|
||||||
@@ -858,15 +856,15 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flags == EMS_DEVICE_FLAG_RC35 || flags == EMS_DEVICE_FLAG_RC30_1) {
|
if (flags == EMS_DEVICE_FLAG_RC35 || flags == EMS_DEVICE_FLAG_RC30_1) {
|
||||||
if (ibaCalIntTemperature_ != EMS_VALUE_INT_NOTSET) {
|
if (Helpers::hasValue(ibaCalIntTemperature_)) {
|
||||||
print_value(shell, 2, F("Offset int. temperature"), F_(degrees), Helpers::render_value(buffer, ibaCalIntTemperature_, 2));
|
print_value(shell, 2, F("Offset int. temperature"), F_(degrees), Helpers::render_value(buffer, ibaCalIntTemperature_, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ibaMinExtTemperature_ != EMS_VALUE_INT_NOTSET) {
|
if (Helpers::hasValue(ibaMinExtTemperature_)) {
|
||||||
print_value(shell, 2, F("Min ext. temperature"), F_(degrees), Helpers::render_value(buffer, ibaMinExtTemperature_, 0)); // min ext temp for heating curve, in deg.
|
print_value(shell, 2, F("Min ext. temperature"), F_(degrees), Helpers::render_value(buffer, ibaMinExtTemperature_, 0)); // min ext temp for heating curve, in deg.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ibaBuildingType_ != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(ibaBuildingType_)) {
|
||||||
if (ibaBuildingType_ == 0) {
|
if (ibaBuildingType_ == 0) {
|
||||||
shell.printfln(F(" Building: light"));
|
shell.printfln(F(" Building: light"));
|
||||||
} else if (ibaBuildingType_ == 1) {
|
} else if (ibaBuildingType_ == 1) {
|
||||||
@@ -899,10 +897,10 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
|||||||
|
|
||||||
print_value(shell, 4, F("Current room temperature"), F_(degrees), Helpers::render_value(buffer, hc->curr_roomTemp, format_curr));
|
print_value(shell, 4, F("Current room temperature"), F_(degrees), Helpers::render_value(buffer, hc->curr_roomTemp, format_curr));
|
||||||
print_value(shell, 4, F("Setpoint room temperature"), F_(degrees), Helpers::render_value(buffer, hc->setpoint_roomTemp, format_setpoint));
|
print_value(shell, 4, F("Setpoint room temperature"), F_(degrees), Helpers::render_value(buffer, hc->setpoint_roomTemp, format_setpoint));
|
||||||
if (hc->mode != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hc->mode)) {
|
||||||
print_value(shell, 4, F("Mode"), mode_tostring(hc->get_mode(flags)).c_str());
|
print_value(shell, 4, F("Mode"), mode_tostring(hc->get_mode(flags)).c_str());
|
||||||
}
|
}
|
||||||
if (hc->mode_type != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hc->mode_type)) {
|
||||||
print_value(shell, 4, F("Mode Type"), mode_tostring(hc->get_mode_type(flags)).c_str());
|
print_value(shell, 4, F("Mode Type"), mode_tostring(hc->get_mode_type(flags)).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -923,7 +921,7 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// show flow temp if we have it
|
// show flow temp if we have it
|
||||||
if (hc->circuitcalctemp != EMS_VALUE_UINT_NOTSET) {
|
if (Helpers::hasValue(hc->circuitcalctemp)) {
|
||||||
print_value(shell, 4, F("Calculated flow temperature"), F_(degrees), Helpers::render_value(buffer, hc->circuitcalctemp, 1));
|
print_value(shell, 4, F("Calculated flow temperature"), F_(degrees), Helpers::render_value(buffer, hc->circuitcalctemp, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -303,5 +303,33 @@ double Helpers::round2(double value) {
|
|||||||
return (int)(value * 100 + 0.5) / 100.0;
|
return (int)(value * 100 + 0.5) / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Helpers::check_abs(const int32_t i) {
|
||||||
|
return ((i < 0 ? -i : i) != 0xFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
// for booleans, use isBool true
|
||||||
|
bool Helpers::hasValue(const uint8_t v, bool isBool) {
|
||||||
|
if (isBool) {
|
||||||
|
return (v != EMS_VALUE_BOOL_NOTSET);
|
||||||
|
}
|
||||||
|
return (v != EMS_VALUE_UINT_NOTSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Helpers::hasValue(const int8_t v) {
|
||||||
|
return (v != EMS_VALUE_INT_NOTSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Helpers::hasValue(const int16_t v) {
|
||||||
|
return (v != EMS_VALUE_SHORT_NOTSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Helpers::hasValue(const uint16_t v) {
|
||||||
|
return (v != EMS_VALUE_USHORT_NOTSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Helpers::hasValue(const uint32_t v) {
|
||||||
|
return (v != EMS_VALUE_ULONG_NOTSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -29,23 +29,26 @@ class Helpers {
|
|||||||
static char * hextoa(char * result, const uint8_t value);
|
static char * hextoa(char * result, const uint8_t value);
|
||||||
static std::string data_to_hex(const uint8_t * data, const uint8_t length);
|
static std::string data_to_hex(const uint8_t * data, const uint8_t length);
|
||||||
|
|
||||||
static char * render_value(char * result, const float value, const uint8_t format); // format is the precision
|
static char * render_value(char * result, const float value, const uint8_t format); // format is the precision
|
||||||
static char * render_value(char * result, const uint8_t value, const uint8_t format);
|
static char * render_value(char * result, const uint8_t value, const uint8_t format);
|
||||||
static char * render_value(char * result, const int8_t value, const uint8_t format);
|
static char * render_value(char * result, const int8_t value, const uint8_t format);
|
||||||
static char * render_value(char * result, const uint16_t value, const uint8_t format);
|
static char * render_value(char * result, const uint16_t value, const uint8_t format);
|
||||||
static char * render_value(char * result, const uint32_t value, const uint8_t format);
|
static char * render_value(char * result, const uint32_t value, const uint8_t format);
|
||||||
static char * render_value(char * result, const int16_t value, const uint8_t format);
|
static char * render_value(char * result, const int16_t value, const uint8_t format);
|
||||||
|
|
||||||
static char * smallitoa(char * result, const uint8_t value);
|
static char * smallitoa(char * result, const uint8_t value);
|
||||||
static char * smallitoa(char * result, const uint16_t value);
|
static char * smallitoa(char * result, const uint16_t value);
|
||||||
static char * itoa(char * result, int16_t value, const uint8_t base = 10);
|
static char * itoa(char * result, int16_t value, const uint8_t base = 10);
|
||||||
static uint32_t hextoint(const char * hex);
|
static uint32_t hextoint(const char * hex);
|
||||||
static uint16_t atoint(const char * value);
|
static uint16_t atoint(const char * value);
|
||||||
|
static bool check_abs(const int32_t i);
|
||||||
|
static double round2(double value);
|
||||||
|
|
||||||
static bool check_abs(const int32_t i) {
|
static bool hasValue(const uint8_t v, bool isBool = false); // use isBool=true for bool's
|
||||||
return ((i < 0 ? -i : i) != 0xFFFFFF); // UNSET value is from telegram.h
|
static bool hasValue(const int8_t v);
|
||||||
}
|
static bool hasValue(const int16_t v);
|
||||||
|
static bool hasValue(const uint16_t v);
|
||||||
static double round2(double value);
|
static bool hasValue(const uint32_t v);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
Reference in New Issue
Block a user