mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +03:00
refactor device value rendering (to Web, Console or MQTT) to base class #632
This commit is contained in:
@@ -38,23 +38,14 @@ class Boiler : public EMSdevice {
|
||||
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);
|
||||
|
||||
virtual void publish_values(JsonObject & json, bool force);
|
||||
virtual bool export_values(JsonObject & json);
|
||||
virtual void device_info_web(JsonArray & root);
|
||||
virtual bool updated_values();
|
||||
virtual bool publish_ha_config();
|
||||
|
||||
private:
|
||||
static uuid::log::Logger logger_;
|
||||
|
||||
void register_mqtt_ha_config();
|
||||
void register_mqtt_ha_config_ww();
|
||||
void check_active(const bool force = false);
|
||||
bool export_values_main(JsonObject & doc, const bool textformat = false);
|
||||
bool export_values_ww(JsonObject & doc, const bool textformat = false);
|
||||
|
||||
bool changed_ = false;
|
||||
bool mqtt_ha_config_ = false; // HA MQTT Discovery
|
||||
bool mqtt_ha_config_ww_ = false; // HA MQTT Discovery
|
||||
uint8_t boilerState_ = EMS_VALUE_UINT_NOTSET; // Boiler state flag - FOR INTERNAL USE
|
||||
|
||||
static constexpr uint8_t EMS_TYPE_UBAParameterWW = 0x33;
|
||||
static constexpr uint8_t EMS_TYPE_UBAFunctionTest = 0x1D;
|
||||
@@ -68,120 +59,99 @@ class Boiler : public EMSdevice {
|
||||
|
||||
static constexpr uint8_t EMS_BOILER_SELFLOWTEMP_HEATING = 20; // was originally 70, changed to 30 for issue #193, then to 20 with issue #344
|
||||
|
||||
// UBAParameterWW
|
||||
uint8_t wWActivated_ = EMS_VALUE_BOOL_NOTSET; // Warm Water activated
|
||||
uint8_t wWSelTemp_ = EMS_VALUE_UINT_NOTSET; // Warm Water selected temperature
|
||||
uint8_t wWCircPump_ = EMS_VALUE_BOOL_NOTSET; // Warm Water circulation pump available
|
||||
uint8_t wWCircPumpMode_ = EMS_VALUE_UINT_NOTSET; // Warm Water circulation pump mode
|
||||
uint8_t wWChargeType_ = EMS_VALUE_BOOL_NOTSET; // Warm Water charge type (pump or 3-way-valve)
|
||||
uint8_t wWDisinfectionTemp_ = EMS_VALUE_UINT_NOTSET; // Warm Water disinfection temperature to prevent infection
|
||||
uint8_t wWComfort_ = EMS_VALUE_UINT_NOTSET; // WW comfort mode
|
||||
// ww
|
||||
uint8_t wWSetTemp_; // Warm Water set temperature
|
||||
uint8_t wWSelTemp_; // Warm Water selected temperature
|
||||
uint8_t wWType_; // 0-off, 1-flow, 2-flowbuffer, 3-buffer, 4-layered buffer
|
||||
uint8_t wWComfort_; // WW comfort mode
|
||||
uint8_t wWCircPump_; // Warm Water circulation pump available
|
||||
uint8_t wWChargeType_; // Warm Water charge type (pump or 3-way-valve)
|
||||
uint8_t wWDisinfectionTemp_; // Warm Water disinfection temperature to prevent infection
|
||||
uint8_t wWCircPumpMode_; // Warm Water circulation pump mode
|
||||
uint8_t wWCirc_; // Circulation on/off
|
||||
uint16_t wWCurTemp_; // Warm Water current temperature
|
||||
uint16_t wWCurTemp2_; // Warm Water current temperature storage
|
||||
uint8_t wWCurFlow_; // Warm Water current flow temp in l/min
|
||||
uint16_t wwStorageTemp1_; // warm water storage temp 1
|
||||
uint16_t wwStorageTemp2_; // warm water storage temp 2
|
||||
uint8_t wWActivated_; // Warm Water activated
|
||||
uint8_t wWOneTime_; // Warm Water one time function on/off
|
||||
uint8_t wWDisinfecting_; // Warm Water disinfection on/off
|
||||
uint8_t wWCharging_; // Warm Water charging on/off
|
||||
uint8_t wWRecharging_; // Warm Water recharge on/off
|
||||
uint8_t wWTempOK_; // Warm Water temperature ok on/off
|
||||
uint8_t wWActive_;
|
||||
uint8_t wWHeat_; // 3-way valve on WW
|
||||
uint8_t wWSetPumpPower_; // ww pump speed/power?
|
||||
uint16_t wwMixTemperature_; // mixing temperature
|
||||
uint16_t wwBufferTemperature_; // buffertemperature
|
||||
uint32_t wWStarts_; // Warm Water # starts
|
||||
uint32_t wWStarts2_; // Warm water starts (control)
|
||||
uint32_t wWWorkM_; // Warm Water # minutes
|
||||
|
||||
// MC10Status
|
||||
uint16_t wwMixTemperature_ = EMS_VALUE_USHORT_NOTSET; // mengertemperatuur
|
||||
uint16_t wwBufferTemperature_ = EMS_VALUE_USHORT_NOTSET; // buffertemperature
|
||||
|
||||
// UBAMonitorFast - 0x18 on EMS1
|
||||
uint8_t selFlowTemp_ = EMS_VALUE_UINT_NOTSET; // Selected flow temperature
|
||||
uint16_t curFlowTemp_ = EMS_VALUE_USHORT_NOTSET; // Current flow temperature
|
||||
uint16_t wwStorageTemp1_ = EMS_VALUE_USHORT_NOTSET; // warm water storage temp 1
|
||||
uint16_t wwStorageTemp2_ = EMS_VALUE_USHORT_NOTSET; // warm water storage temp 2
|
||||
uint16_t retTemp_ = EMS_VALUE_USHORT_NOTSET; // Return temperature
|
||||
uint8_t burnGas_ = EMS_VALUE_BOOL_NOTSET; // Gas on/off
|
||||
uint8_t fanWork_ = EMS_VALUE_BOOL_NOTSET; // Fan on/off
|
||||
uint8_t ignWork_ = EMS_VALUE_BOOL_NOTSET; // Ignition on/off
|
||||
uint8_t heatPump_ = EMS_VALUE_BOOL_NOTSET; // Boiler pump on/off
|
||||
uint8_t wWHeat_ = EMS_VALUE_BOOL_NOTSET; // 3-way valve on WW
|
||||
uint8_t wWCirc_ = EMS_VALUE_BOOL_NOTSET; // Circulation on/off
|
||||
uint8_t selBurnPow_ = EMS_VALUE_UINT_NOTSET; // Burner max power %
|
||||
uint8_t curBurnPow_ = EMS_VALUE_UINT_NOTSET; // Burner current power %
|
||||
uint16_t flameCurr_ = EMS_VALUE_USHORT_NOTSET; // Flame current in micro amps
|
||||
uint8_t sysPress_ = EMS_VALUE_UINT_NOTSET; // System pressure
|
||||
char serviceCode_[4] = {'\0'}; // 3 character status/service code
|
||||
uint16_t serviceCodeNumber_ = EMS_VALUE_USHORT_NOTSET; // error/service code
|
||||
uint8_t boilerState_ = EMS_VALUE_UINT_NOTSET; // Boiler state flag
|
||||
char lastCode_[30] = {'\0'};
|
||||
uint32_t lastCodeDate_ = 0;
|
||||
|
||||
// UBAMonitorSlow - 0x19 on EMS1
|
||||
int16_t outdoorTemp_ = EMS_VALUE_SHORT_NOTSET; // Outside temperature
|
||||
uint16_t boilTemp_ = EMS_VALUE_USHORT_NOTSET; // Boiler temperature
|
||||
uint16_t exhaustTemp_ = EMS_VALUE_USHORT_NOTSET; // Exhaust temperature
|
||||
uint8_t pumpMod_ = EMS_VALUE_UINT_NOTSET; // Pump modulation %
|
||||
uint32_t burnStarts_ = EMS_VALUE_ULONG_NOTSET; // # burner restarts
|
||||
uint32_t burnWorkMin_ = EMS_VALUE_ULONG_NOTSET; // Total burner operating time
|
||||
uint32_t heatWorkMin_ = EMS_VALUE_ULONG_NOTSET; // Total heat operating time
|
||||
uint16_t switchTemp_ = EMS_VALUE_USHORT_NOTSET; // Switch temperature
|
||||
|
||||
// UBAMonitorWW
|
||||
uint8_t wWSetTemp_ = EMS_VALUE_UINT_NOTSET; // Warm Water set temperature
|
||||
uint16_t wWCurTemp_ = EMS_VALUE_USHORT_NOTSET; // Warm Water current temperature
|
||||
uint16_t wWCurTemp2_ = EMS_VALUE_USHORT_NOTSET; // Warm Water current temperature storage
|
||||
uint32_t wWStarts_ = EMS_VALUE_ULONG_NOTSET; // Warm Water # starts
|
||||
uint32_t wWWorkM_ = EMS_VALUE_ULONG_NOTSET; // Warm Water # minutes
|
||||
uint8_t wWOneTime_ = EMS_VALUE_BOOL_NOTSET; // Warm Water one time function on/off
|
||||
uint8_t wWDisinfecting_ = EMS_VALUE_BOOL_NOTSET; // Warm Water disinfection on/off
|
||||
uint8_t wWCharging_ = EMS_VALUE_BOOL_NOTSET; // Warm Water charging on/off
|
||||
uint8_t wWRecharging_ = EMS_VALUE_BOOL_NOTSET; // Warm Water recharge on/off
|
||||
uint8_t wWTempOK_ = EMS_VALUE_BOOL_NOTSET; // Warm Water temperature ok on/off
|
||||
uint8_t wWCurFlow_ = EMS_VALUE_UINT_NOTSET; // Warm Water current flow temp in l/min
|
||||
uint8_t wWType_ = EMS_VALUE_UINT_NOTSET; // 0-off, 1-flow, 2-flowbuffer, 3-buffer, 4-layered buffer
|
||||
uint8_t wWActive_ = EMS_VALUE_BOOL_NOTSET;
|
||||
|
||||
// UBATotalUptime
|
||||
uint32_t UBAuptime_ = EMS_VALUE_ULONG_NOTSET; // Total UBA working hours
|
||||
|
||||
// UBAParameters
|
||||
uint8_t heatingActivated_ = EMS_VALUE_BOOL_NOTSET; // Heating activated on the boiler
|
||||
uint8_t heatingTemp_ = EMS_VALUE_UINT_NOTSET; // Heating temperature setting on the boiler
|
||||
uint8_t pumpModMax_ = EMS_VALUE_UINT_NOTSET; // Boiler circuit pump modulation max. power %
|
||||
uint8_t pumpModMin_ = EMS_VALUE_UINT_NOTSET; // Boiler circuit pump modulation min. power
|
||||
uint8_t burnMinPower_ = EMS_VALUE_UINT_NOTSET;
|
||||
uint8_t burnMaxPower_ = EMS_VALUE_UINT_NOTSET;
|
||||
int8_t boilHystOff_ = EMS_VALUE_INT_NOTSET;
|
||||
int8_t boilHystOn_ = EMS_VALUE_INT_NOTSET;
|
||||
uint8_t burnMinPeriod_ = EMS_VALUE_UINT_NOTSET;
|
||||
uint8_t pumpDelay_ = EMS_VALUE_UINT_NOTSET;
|
||||
|
||||
// UBASetPoint
|
||||
uint8_t setFlowTemp_ = EMS_VALUE_UINT_NOTSET; // boiler setpoint temp
|
||||
uint8_t setBurnPow_ = EMS_VALUE_UINT_NOTSET; // max output power in %
|
||||
uint8_t wWSetPumpPower_ = EMS_VALUE_UINT_NOTSET; // ww pump speed/power?
|
||||
|
||||
// other internal calculated params
|
||||
uint8_t tapwaterActive_ = EMS_VALUE_BOOL_NOTSET; // Hot tap water is on/off
|
||||
uint8_t heatingActive_ = EMS_VALUE_BOOL_NOTSET; // Central heating is on/off
|
||||
uint8_t pumpMod2_ = EMS_VALUE_UINT_NOTSET; // heatpump modulation from 0xE3 (heatpumps)
|
||||
|
||||
// UBAInformation
|
||||
uint32_t upTimeControl_ = EMS_VALUE_ULONG_NOTSET; // Operating time control
|
||||
uint32_t upTimeCompHeating_ = EMS_VALUE_ULONG_NOTSET; // Operating time compressor heating
|
||||
uint32_t upTimeCompCooling_ = EMS_VALUE_ULONG_NOTSET; // Operating time compressor cooling
|
||||
uint32_t upTimeCompWw_ = EMS_VALUE_ULONG_NOTSET; // Operating time compressor warm water
|
||||
uint32_t heatingStarts_ = EMS_VALUE_ULONG_NOTSET; // Heating starts (control)
|
||||
uint32_t coolingStarts_ = EMS_VALUE_ULONG_NOTSET; // Cooling starts (control)
|
||||
uint32_t wWStarts2_ = EMS_VALUE_ULONG_NOTSET; // Warm water starts (control)
|
||||
uint32_t nrgConsTotal_ = EMS_VALUE_ULONG_NOTSET; // Energy consumption total
|
||||
uint32_t auxElecHeatNrgConsTotal_ = EMS_VALUE_ULONG_NOTSET; // Auxiliary electrical heater energy consumption total
|
||||
uint32_t auxElecHeatNrgConsHeating_ = EMS_VALUE_ULONG_NOTSET; // Auxiliary electrical heater energy consumption heating
|
||||
uint32_t auxElecHeatNrgConsDHW_ = EMS_VALUE_ULONG_NOTSET; // Auxiliary electrical heater energ consumption DHW
|
||||
uint32_t nrgConsCompTotal_ = EMS_VALUE_ULONG_NOTSET; // Energy consumption compressor total
|
||||
uint32_t nrgConsCompHeating_ = EMS_VALUE_ULONG_NOTSET; // Energy consumption compressor heating
|
||||
uint32_t nrgConsCompWw_ = EMS_VALUE_ULONG_NOTSET; // Energy consumption compressor warm water
|
||||
uint32_t nrgConsCompCooling_ = EMS_VALUE_ULONG_NOTSET; // Energy consumption compressor cooling
|
||||
|
||||
// UBAEnergySupplied
|
||||
uint32_t nrgSuppTotal_ = EMS_VALUE_ULONG_NOTSET; // Energy supplied total
|
||||
uint32_t nrgSuppHeating_ = EMS_VALUE_ULONG_NOTSET; // Energy supplied heating
|
||||
uint32_t nrgSuppWw_ = EMS_VALUE_ULONG_NOTSET; // Energy supplied warm water
|
||||
uint32_t nrgSuppCooling_ = EMS_VALUE_ULONG_NOTSET; // Energy supplied cooling
|
||||
|
||||
// _UBAMaintenanceData
|
||||
uint8_t maintenanceMessage_ = EMS_VALUE_UINT_NOTSET;
|
||||
uint8_t maintenanceType_ = EMS_VALUE_UINT_NOTSET;
|
||||
uint8_t maintenanceTime_ = EMS_VALUE_UINT_NOTSET;
|
||||
char maintenanceDate_[12] = {'\0'};
|
||||
// main
|
||||
uint8_t heatingActive_; // Central heating is on/off
|
||||
uint8_t tapwaterActive_; // Hot tap water is on/off
|
||||
uint8_t selFlowTemp_; // Selected flow temperature
|
||||
uint8_t selBurnPow_; // Burner max power %
|
||||
uint8_t pumpMod2_; // heatpump modulation from 0xE3 (heatpumps)
|
||||
uint8_t pumpMod_; // Pump modulation %
|
||||
int16_t outdoorTemp_; // Outside temperature
|
||||
uint16_t curFlowTemp_; // Current flow temperature
|
||||
uint16_t retTemp_; // Return temperature
|
||||
uint16_t switchTemp_; // Switch temperature
|
||||
uint8_t sysPress_; // System pressure
|
||||
uint16_t boilTemp_; // Boiler temperature
|
||||
uint16_t exhaustTemp_; // Exhaust temperature
|
||||
uint8_t burnGas_; // Gas on/off
|
||||
uint16_t flameCurr_; // Flame current in micro amps
|
||||
uint8_t heatPump_; // Boiler pump on/off
|
||||
uint8_t fanWork_; // Fan on/off
|
||||
uint8_t ignWork_; // Ignition on/off
|
||||
uint8_t heatingActivated_; // Heating activated on the boiler
|
||||
uint8_t heatingTemp_; // Heating temperature setting on the boiler
|
||||
uint8_t pumpModMax_; // Boiler circuit pump modulation max. power %
|
||||
uint8_t pumpModMin_; // Boiler circuit pump modulation min. power
|
||||
uint8_t pumpDelay_;
|
||||
uint8_t burnMinPeriod_;
|
||||
uint8_t burnMinPower_;
|
||||
uint8_t burnMaxPower_;
|
||||
int8_t boilHystOn_;
|
||||
int8_t boilHystOff_;
|
||||
uint8_t setFlowTemp_; // boiler setpoint temp
|
||||
uint8_t curBurnPow_; // Burner current power %
|
||||
uint8_t setBurnPow_; // max output power in %
|
||||
uint32_t burnStarts_; // # burner restarts
|
||||
uint32_t burnWorkMin_; // Total burner operating time
|
||||
uint32_t heatWorkMin_; // Total heat operating time
|
||||
uint32_t UBAuptime_; // Total UBA working hours
|
||||
char lastCode_[30]; // last error code
|
||||
char serviceCode_[4]; // 3 character status/service code
|
||||
uint16_t serviceCodeNumber_; // error/service code
|
||||
|
||||
// info
|
||||
uint32_t upTimeControl_; // Operating time control
|
||||
uint32_t upTimeCompHeating_; // Operating time compressor heating
|
||||
uint32_t upTimeCompCooling_; // Operating time compressor cooling
|
||||
uint32_t upTimeCompWw_; // Operating time compressor warm water
|
||||
uint32_t heatingStarts_; // Heating starts (control)
|
||||
uint32_t coolingStarts_; // Cooling starts (control)
|
||||
uint32_t nrgConsTotal_; // Energy consumption total
|
||||
uint32_t nrgConsCompTotal_; // Energy consumption compressor total
|
||||
uint32_t nrgConsCompHeating_; // Energy consumption compressor heating
|
||||
uint32_t nrgConsCompWw_; // Energy consumption compressor warm water
|
||||
uint32_t nrgConsCompCooling_; // Energy consumption compressor cooling
|
||||
uint32_t nrgSuppTotal_; // Energy supplied total
|
||||
uint32_t nrgSuppHeating_; // Energy supplied heating
|
||||
uint32_t nrgSuppWw_; // Energy supplied warm water
|
||||
uint32_t nrgSuppCooling_; // Energy supplied cooling
|
||||
uint32_t auxElecHeatNrgConsTotal_; // Auxiliary electrical heater energy consumption total
|
||||
uint32_t auxElecHeatNrgConsHeating_; // Auxiliary electrical heater energy consumption heating
|
||||
uint32_t auxElecHeatNrgConsDHW_; // Auxiliary electrical heater energy consumption DHW
|
||||
char maintenanceMessage_[4];
|
||||
char maintenanceDate_[12];
|
||||
uint8_t maintenanceType_;
|
||||
uint8_t maintenanceTime_;
|
||||
|
||||
void process_UBAParameterWW(std::shared_ptr<const Telegram> telegram);
|
||||
void process_UBAMonitorFast(std::shared_ptr<const Telegram> telegram);
|
||||
|
||||
Reference in New Issue
Block a user