mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
add boiler_data_ww
This commit is contained in:
@@ -279,47 +279,47 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dhw - DEVICE_DATA_ww topic
|
// dhw - DEVICE_DATA_ww topic
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwTapActivated_,
|
&wwTapActivated_,
|
||||||
DeviceValueType::BOOL,
|
DeviceValueType::BOOL,
|
||||||
nullptr,
|
nullptr,
|
||||||
FL_(wwtapactivated),
|
FL_(wwtapactivated),
|
||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_tapwarmwater_activated));
|
MAKE_CF_CB(set_tapwarmwater_activated));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwSetTemp_, DeviceValueType::UINT, nullptr, FL_(wwSetTemp), DeviceValueUOM::DEGREES);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwSetTemp_, DeviceValueType::UINT, nullptr, FL_(wwSetTemp), DeviceValueUOM::DEGREES);
|
||||||
register_device_value(
|
register_device_value(
|
||||||
DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwSelTemp_, DeviceValueType::UINT, nullptr, FL_(wwSelTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_ww_temp));
|
DeviceValueTAG::TAG_BOILER_DATA_WW, &wwSelTemp_, DeviceValueType::UINT, nullptr, FL_(wwSelTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_ww_temp));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwSelTempLow_,
|
&wwSelTempLow_,
|
||||||
DeviceValueType::UINT,
|
DeviceValueType::UINT,
|
||||||
nullptr,
|
nullptr,
|
||||||
FL_(wwSelTempLow),
|
FL_(wwSelTempLow),
|
||||||
DeviceValueUOM::DEGREES,
|
DeviceValueUOM::DEGREES,
|
||||||
MAKE_CF_CB(set_ww_temp_low));
|
MAKE_CF_CB(set_ww_temp_low));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwSelTempOff_, DeviceValueType::UINT, nullptr, FL_(wwSelTempOff), DeviceValueUOM::DEGREES);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwSelTempOff_, DeviceValueType::UINT, nullptr, FL_(wwSelTempOff), DeviceValueUOM::DEGREES);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwSelTempSingle_,
|
&wwSelTempSingle_,
|
||||||
DeviceValueType::UINT,
|
DeviceValueType::UINT,
|
||||||
nullptr,
|
nullptr,
|
||||||
FL_(wwSelTempSingle),
|
FL_(wwSelTempSingle),
|
||||||
DeviceValueUOM::DEGREES,
|
DeviceValueUOM::DEGREES,
|
||||||
MAKE_CF_CB(set_ww_temp_single));
|
MAKE_CF_CB(set_ww_temp_single));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwType_, DeviceValueType::ENUM, FL_(enum_flow), FL_(wwType), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwType_, DeviceValueType::ENUM, FL_(enum_flow), FL_(wwType), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwComfort_,
|
&wwComfort_,
|
||||||
DeviceValueType::ENUM,
|
DeviceValueType::ENUM,
|
||||||
FL_(enum_comfort),
|
FL_(enum_comfort),
|
||||||
FL_(wwComfort),
|
FL_(wwComfort),
|
||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_ww_mode));
|
MAKE_CF_CB(set_ww_mode));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwFlowTempOffset_,
|
&wwFlowTempOffset_,
|
||||||
DeviceValueType::UINT,
|
DeviceValueType::UINT,
|
||||||
nullptr,
|
nullptr,
|
||||||
FL_(wwFlowTempOffset),
|
FL_(wwFlowTempOffset),
|
||||||
DeviceValueUOM::DEGREES_R,
|
DeviceValueUOM::DEGREES_R,
|
||||||
MAKE_CF_CB(set_ww_flowTempOffset));
|
MAKE_CF_CB(set_ww_flowTempOffset));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwMaxPower_,
|
&wwMaxPower_,
|
||||||
DeviceValueType::UINT,
|
DeviceValueType::UINT,
|
||||||
nullptr,
|
nullptr,
|
||||||
@@ -328,26 +328,26 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
MAKE_CF_CB(set_ww_maxpower),
|
MAKE_CF_CB(set_ww_maxpower),
|
||||||
0,
|
0,
|
||||||
130);
|
130);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwCircPump_,
|
&wwCircPump_,
|
||||||
DeviceValueType::BOOL,
|
DeviceValueType::BOOL,
|
||||||
nullptr,
|
nullptr,
|
||||||
FL_(wwCircPump),
|
FL_(wwCircPump),
|
||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_ww_circulation_pump));
|
MAKE_CF_CB(set_ww_circulation_pump));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwChargeType_, DeviceValueType::ENUM, FL_(enum_charge), FL_(wwChargeType), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwChargeType_, DeviceValueType::ENUM, FL_(enum_charge), FL_(wwChargeType), DeviceValueUOM::NONE);
|
||||||
register_device_value(
|
register_device_value(
|
||||||
DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwHystOn_, DeviceValueType::INT, nullptr, FL_(wwHystOn), DeviceValueUOM::DEGREES_R, MAKE_CF_CB(set_ww_hyst_on));
|
DeviceValueTAG::TAG_BOILER_DATA_WW, &wwHystOn_, DeviceValueType::INT, nullptr, FL_(wwHystOn), DeviceValueUOM::DEGREES_R, MAKE_CF_CB(set_ww_hyst_on));
|
||||||
register_device_value(
|
register_device_value(
|
||||||
DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwHystOff_, DeviceValueType::INT, nullptr, FL_(wwHystOff), DeviceValueUOM::DEGREES_R, MAKE_CF_CB(set_ww_hyst_off));
|
DeviceValueTAG::TAG_BOILER_DATA_WW, &wwHystOff_, DeviceValueType::INT, nullptr, FL_(wwHystOff), DeviceValueUOM::DEGREES_R, MAKE_CF_CB(set_ww_hyst_off));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwDisinfectionTemp_,
|
&wwDisinfectionTemp_,
|
||||||
DeviceValueType::UINT,
|
DeviceValueType::UINT,
|
||||||
nullptr,
|
nullptr,
|
||||||
FL_(wwDisinfectionTemp),
|
FL_(wwDisinfectionTemp),
|
||||||
DeviceValueUOM::DEGREES,
|
DeviceValueUOM::DEGREES,
|
||||||
MAKE_CF_CB(set_ww_disinfect_temp));
|
MAKE_CF_CB(set_ww_disinfect_temp));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwCircMode_,
|
&wwCircMode_,
|
||||||
DeviceValueType::ENUM,
|
DeviceValueType::ENUM,
|
||||||
FL_(enum_freq),
|
FL_(enum_freq),
|
||||||
@@ -355,13 +355,13 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_ww_circulation_mode));
|
MAKE_CF_CB(set_ww_circulation_mode));
|
||||||
register_device_value(
|
register_device_value(
|
||||||
DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwCirc_, DeviceValueType::BOOL, nullptr, FL_(wwCirc), DeviceValueUOM::NONE, MAKE_CF_CB(set_ww_circulation));
|
DeviceValueTAG::TAG_BOILER_DATA_WW, &wwCirc_, DeviceValueType::BOOL, nullptr, FL_(wwCirc), DeviceValueUOM::NONE, MAKE_CF_CB(set_ww_circulation));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwCurTemp_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp), DeviceValueUOM::DEGREES);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwCurTemp_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp), DeviceValueUOM::DEGREES);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwCurTemp2_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp2), DeviceValueUOM::DEGREES);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwCurTemp2_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp2), DeviceValueUOM::DEGREES);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwCurFlow_, DeviceValueType::UINT, FL_(div10), FL_(wwCurFlow), DeviceValueUOM::LMIN);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwCurFlow_, DeviceValueType::UINT, FL_(div10), FL_(wwCurFlow), DeviceValueUOM::LMIN);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwStorageTemp1_, DeviceValueType::USHORT, FL_(div10), FL_(wwStorageTemp1), DeviceValueUOM::DEGREES);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwStorageTemp1_, DeviceValueType::USHORT, FL_(div10), FL_(wwStorageTemp1), DeviceValueUOM::DEGREES);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwStorageTemp2_, DeviceValueType::USHORT, FL_(div10), FL_(wwStorageTemp2), DeviceValueUOM::DEGREES);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwStorageTemp2_, DeviceValueType::USHORT, FL_(div10), FL_(wwStorageTemp2), DeviceValueUOM::DEGREES);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwActivated_,
|
&wwActivated_,
|
||||||
DeviceValueType::BOOL,
|
DeviceValueType::BOOL,
|
||||||
nullptr,
|
nullptr,
|
||||||
@@ -369,24 +369,24 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_ww_activated));
|
MAKE_CF_CB(set_ww_activated));
|
||||||
register_device_value(
|
register_device_value(
|
||||||
DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwOneTime_, DeviceValueType::BOOL, nullptr, FL_(wwOneTime), DeviceValueUOM::NONE, MAKE_CF_CB(set_ww_onetime));
|
DeviceValueTAG::TAG_BOILER_DATA_WW, &wwOneTime_, DeviceValueType::BOOL, nullptr, FL_(wwOneTime), DeviceValueUOM::NONE, MAKE_CF_CB(set_ww_onetime));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
&wwDisinfect_,
|
&wwDisinfect_,
|
||||||
DeviceValueType::BOOL,
|
DeviceValueType::BOOL,
|
||||||
nullptr,
|
nullptr,
|
||||||
FL_(wwDisinfecting),
|
FL_(wwDisinfecting),
|
||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_ww_disinfect));
|
MAKE_CF_CB(set_ww_disinfect));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwCharging_, DeviceValueType::BOOL, nullptr, FL_(wwCharging), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwCharging_, DeviceValueType::BOOL, nullptr, FL_(wwCharging), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwRecharging_, DeviceValueType::BOOL, nullptr, FL_(wwRecharging), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwRecharging_, DeviceValueType::BOOL, nullptr, FL_(wwRecharging), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwTempOK_, DeviceValueType::BOOL, nullptr, FL_(wwTempOK), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwTempOK_, DeviceValueType::BOOL, nullptr, FL_(wwTempOK), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwActive_, DeviceValueType::BOOL, nullptr, FL_(wwActive), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwActive_, DeviceValueType::BOOL, nullptr, FL_(wwActive), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &ww3wayValve_, DeviceValueType::BOOL, nullptr, FL_(ww3wayValve), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &ww3wayValve_, DeviceValueType::BOOL, nullptr, FL_(ww3wayValve), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwSetPumpPower_, DeviceValueType::UINT, nullptr, FL_(wwSetPumpPower), DeviceValueUOM::PERCENT);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwSetPumpPower_, DeviceValueType::UINT, nullptr, FL_(wwSetPumpPower), DeviceValueUOM::PERCENT);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwMixerTemp_, DeviceValueType::USHORT, FL_(div10), FL_(wwMixerTemp), DeviceValueUOM::DEGREES);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwMixerTemp_, DeviceValueType::USHORT, FL_(div10), FL_(wwMixerTemp), DeviceValueUOM::DEGREES);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwCylMiddleTemp_, DeviceValueType::USHORT, FL_(div10), FL_(wwCylMiddleTemp), DeviceValueUOM::DEGREES);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwCylMiddleTemp_, DeviceValueType::USHORT, FL_(div10), FL_(wwCylMiddleTemp), DeviceValueUOM::DEGREES);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwStarts_, DeviceValueType::ULONG, nullptr, FL_(wwStarts), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwStarts_, DeviceValueType::ULONG, nullptr, FL_(wwStarts), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwWorkM_, DeviceValueType::TIME, nullptr, FL_(wwWorkM), DeviceValueUOM::MINUTES);
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &wwWorkM_, DeviceValueType::TIME, nullptr, FL_(wwWorkM), DeviceValueUOM::MINUTES);
|
||||||
|
|
||||||
// fetch some initial data
|
// fetch some initial data
|
||||||
EMSESP::send_read_request(0x10, device_id); // read last errorcode on start (only published on errors)
|
EMSESP::send_read_request(0x10, device_id); // read last errorcode on start (only published on errors)
|
||||||
|
|||||||
@@ -55,8 +55,9 @@ const __FlashStringHelper * const DeviceValue::DeviceValueTAG_s[] PROGMEM = {
|
|||||||
|
|
||||||
F_(tag_none), // ""
|
F_(tag_none), // ""
|
||||||
F_(tag_heartbeat), // ""
|
F_(tag_heartbeat), // ""
|
||||||
|
F_(tag_boiler_data_ww), // "dhw"
|
||||||
F_(tag_device_data), // ""
|
F_(tag_device_data), // ""
|
||||||
F_(tag_device_data_ww), // "ww"
|
F_(tag_device_data_ww), // "dhw"
|
||||||
F_(tag_hc1), // "hc1"
|
F_(tag_hc1), // "hc1"
|
||||||
F_(tag_hc2), // "hc2"
|
F_(tag_hc2), // "hc2"
|
||||||
F_(tag_hc3), // "hc3"
|
F_(tag_hc3), // "hc3"
|
||||||
@@ -93,8 +94,9 @@ const __FlashStringHelper * const DeviceValue::DeviceValueTAG_mqtt[] PROGMEM = {
|
|||||||
|
|
||||||
F_(tag_none), // ""
|
F_(tag_none), // ""
|
||||||
F_(heartbeat), // "heartbeat"
|
F_(heartbeat), // "heartbeat"
|
||||||
|
F_(tag_boiler_data_ww_mqtt), // "ww"
|
||||||
F_(tag_device_data), // ""
|
F_(tag_device_data), // ""
|
||||||
F_(tag_device_data_ww_mqtt), // "ww"
|
F_(tag_device_data_ww_mqtt), // ""
|
||||||
F_(tag_hc1), // "hc1"
|
F_(tag_hc1), // "hc1"
|
||||||
F_(tag_hc2), // "hc2"
|
F_(tag_hc2), // "hc2"
|
||||||
F_(tag_hc3), // "hc3"
|
F_(tag_hc3), // "hc3"
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class DeviceValue {
|
|||||||
enum DeviceValueTAG : uint8_t {
|
enum DeviceValueTAG : uint8_t {
|
||||||
TAG_NONE = 0, // wild card
|
TAG_NONE = 0, // wild card
|
||||||
TAG_HEARTBEAT,
|
TAG_HEARTBEAT,
|
||||||
|
TAG_BOILER_DATA_WW,
|
||||||
TAG_DEVICE_DATA,
|
TAG_DEVICE_DATA,
|
||||||
TAG_DEVICE_DATA_WW,
|
TAG_DEVICE_DATA_WW,
|
||||||
TAG_HC1,
|
TAG_HC1,
|
||||||
|
|||||||
@@ -517,45 +517,7 @@ void EMSESP::publish_device_values(uint8_t device_type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
for (uint8_t tag = DeviceValueTAG::TAG_BOILER_DATA_WW; tag <= DeviceValueTAG::TAG_HS16; tag++) {
|
||||||
// collect all data tagged for device, add to ww-data from before
|
|
||||||
for (const auto & emsdevice : emsdevices) {
|
|
||||||
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
|
||||||
need_publish |= emsdevice->generate_values(json, DeviceValueTAG::TAG_DEVICE_DATA, false, EMSdevice::OUTPUT_TARGET::MQTT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((!nested || device_type == DeviceType::BOILER) && need_publish) {
|
|
||||||
Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_DEVICE_DATA), json);
|
|
||||||
json = doc.to<JsonObject>();
|
|
||||||
need_publish = false;
|
|
||||||
}
|
|
||||||
for (const auto & emsdevice : emsdevices) {
|
|
||||||
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
|
||||||
// collect all data tagged with WW
|
|
||||||
need_publish |= emsdevice->generate_values(json, DeviceValueTAG::TAG_DEVICE_DATA_WW, false, EMSdevice::OUTPUT_TARGET::MQTT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// for boiler WW is an extra topic, publish now
|
|
||||||
if (need_publish && device_type == DeviceType::BOILER) {
|
|
||||||
Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_DEVICE_DATA_WW), json);
|
|
||||||
json = doc.to<JsonObject>();
|
|
||||||
need_publish = false;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// boiler have ww always extra
|
|
||||||
if (device_type == DeviceType::BOILER) {
|
|
||||||
for (const auto & emsdevice : emsdevices) {
|
|
||||||
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
|
||||||
need_publish |= emsdevice->generate_values(json, DeviceValueTAG::TAG_DEVICE_DATA_WW, false, EMSdevice::OUTPUT_TARGET::MQTT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (need_publish) {
|
|
||||||
Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_DEVICE_DATA_WW), json);
|
|
||||||
json = doc.to<JsonObject>();
|
|
||||||
need_publish = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (uint8_t tag = DeviceValueTAG::TAG_DEVICE_DATA; tag <= DeviceValueTAG::TAG_HS16; tag++) {
|
|
||||||
JsonObject json_hc = json;
|
JsonObject json_hc = json;
|
||||||
bool nest_created = false;
|
bool nest_created = false;
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
@@ -564,13 +526,10 @@ void EMSESP::publish_device_values(uint8_t device_type) {
|
|||||||
json_hc = doc.createNestedObject(EMSdevice::tag_to_string(tag));
|
json_hc = doc.createNestedObject(EMSdevice::tag_to_string(tag));
|
||||||
nest_created = true;
|
nest_created = true;
|
||||||
}
|
}
|
||||||
// exclude boiler ww
|
need_publish |= emsdevice->generate_values(json_hc, tag, false, EMSdevice::OUTPUT_TARGET::MQTT);
|
||||||
if (device_type != DeviceType::BOILER || tag != DeviceValueTAG::TAG_DEVICE_DATA_WW) {
|
|
||||||
need_publish |= emsdevice->generate_values(json_hc, tag, false, EMSdevice::OUTPUT_TARGET::MQTT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (need_publish && !nested && (tag >= DeviceValueTAG::TAG_DEVICE_DATA_WW || device_type == DeviceType::BOILER)) { // data and ww in one topic
|
if (need_publish && ((!nested && tag >= DeviceValueTAG::TAG_DEVICE_DATA_WW) || (tag == DeviceValueTAG::TAG_BOILER_DATA_WW))) {
|
||||||
Mqtt::publish(Mqtt::tag_to_topic(device_type, tag), json);
|
Mqtt::publish(Mqtt::tag_to_topic(device_type, tag), json);
|
||||||
json = doc.to<JsonObject>();
|
json = doc.to<JsonObject>();
|
||||||
need_publish = false;
|
need_publish = false;
|
||||||
@@ -1163,7 +1122,7 @@ bool EMSESP::command_info(uint8_t device_type, JsonObject & output, const int8_t
|
|||||||
return has_value;
|
return has_value;
|
||||||
}
|
}
|
||||||
// for nested output add for each tag
|
// for nested output add for each tag
|
||||||
for (tag = DeviceValueTAG::TAG_DEVICE_DATA; tag <= DeviceValueTAG::TAG_HS16; tag++) {
|
for (tag = DeviceValueTAG::TAG_BOILER_DATA_WW; tag <= DeviceValueTAG::TAG_HS16; tag++) {
|
||||||
JsonObject output_hc = output;
|
JsonObject output_hc = output;
|
||||||
bool nest_created = false;
|
bool nest_created = false;
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
|
|||||||
@@ -203,9 +203,9 @@ MAKE_PSTR(l, "l")
|
|||||||
// mqtt tags must not have spaces
|
// mqtt tags must not have spaces
|
||||||
MAKE_PSTR(tag_none, "")
|
MAKE_PSTR(tag_none, "")
|
||||||
MAKE_PSTR(tag_heartbeat, "")
|
MAKE_PSTR(tag_heartbeat, "")
|
||||||
MAKE_PSTR(tag_boiler_data, "")
|
MAKE_PSTR(tag_boiler_data_ww, "ww")
|
||||||
MAKE_PSTR(tag_device_data_ww, "Warmwasser")
|
MAKE_PSTR(tag_device_data, "")
|
||||||
MAKE_PSTR(tag_thermostat_data, "")
|
MAKE_PSTR(tag_device_data_ww, "ww")
|
||||||
MAKE_PSTR(tag_hc1, "hc1")
|
MAKE_PSTR(tag_hc1, "hc1")
|
||||||
MAKE_PSTR(tag_hc2, "hc2")
|
MAKE_PSTR(tag_hc2, "hc2")
|
||||||
MAKE_PSTR(tag_hc3, "hc3")
|
MAKE_PSTR(tag_hc3, "hc3")
|
||||||
@@ -237,8 +237,8 @@ MAKE_PSTR(tag_hs16, "hs16")
|
|||||||
|
|
||||||
// MQTT topic names
|
// MQTT topic names
|
||||||
// MAKE_PSTR(tag_heartbeat_mqtt, "heartbeat")
|
// MAKE_PSTR(tag_heartbeat_mqtt, "heartbeat")
|
||||||
MAKE_PSTR(tag_boiler_data_mqtt, "")
|
MAKE_PSTR(tag_boiler_data_ww_mqtt, "ww")
|
||||||
MAKE_PSTR(tag_device_data_ww_mqtt, "ww")
|
MAKE_PSTR(tag_device_data_ww_mqtt, "")
|
||||||
|
|
||||||
// boiler
|
// boiler
|
||||||
MAKE_PSTR(time, "Zeit")
|
MAKE_PSTR(time, "Zeit")
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ MAKE_PSTR(l, "l")
|
|||||||
// mqtt tags must not have spaces
|
// mqtt tags must not have spaces
|
||||||
MAKE_PSTR(tag_none, "")
|
MAKE_PSTR(tag_none, "")
|
||||||
MAKE_PSTR(tag_heartbeat, "")
|
MAKE_PSTR(tag_heartbeat, "")
|
||||||
|
MAKE_PSTR(tag_boiler_data_ww, "dhw")
|
||||||
MAKE_PSTR(tag_device_data, "")
|
MAKE_PSTR(tag_device_data, "")
|
||||||
MAKE_PSTR(tag_device_data_ww, "dhw")
|
MAKE_PSTR(tag_device_data_ww, "dhw")
|
||||||
MAKE_PSTR(tag_hc1, "hc1")
|
MAKE_PSTR(tag_hc1, "hc1")
|
||||||
@@ -237,7 +238,8 @@ MAKE_PSTR(tag_hs16, "hs16")
|
|||||||
// MQTT topic names
|
// MQTT topic names
|
||||||
// MAKE_PSTR(tag_heartbeat_mqtt, "heartbeat")
|
// MAKE_PSTR(tag_heartbeat_mqtt, "heartbeat")
|
||||||
// MAKE_PSTR(tag_boiler_data_mqtt, "")
|
// MAKE_PSTR(tag_boiler_data_mqtt, "")
|
||||||
MAKE_PSTR(tag_device_data_ww_mqtt, "ww")
|
MAKE_PSTR(tag_boiler_data_ww_mqtt, "ww")
|
||||||
|
MAKE_PSTR(tag_device_data_ww_mqtt, "")
|
||||||
|
|
||||||
// boiler
|
// boiler
|
||||||
MAKE_PSTR_WORD(time)
|
MAKE_PSTR_WORD(time)
|
||||||
|
|||||||
@@ -1320,8 +1320,7 @@ const std::string Mqtt::tag_to_topic(uint8_t device_type, uint8_t tag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if there is a tag add it
|
// if there is a tag add it
|
||||||
if (!EMSdevice::tag_to_mqtt(tag).empty()
|
if (!EMSdevice::tag_to_mqtt(tag).empty() && ((tag == DeviceValueTAG::TAG_BOILER_DATA_WW) || (!is_nested() && tag >= DeviceValueTAG::TAG_HC1))) {
|
||||||
&& ((device_type == EMSdevice::DeviceType::BOILER && tag == DeviceValueTAG::TAG_DEVICE_DATA_WW) || (!is_nested() && tag >= DeviceValueTAG::TAG_HC1))) {
|
|
||||||
return EMSdevice::device_type_2_device_name(device_type) + "_data_" + EMSdevice::tag_to_mqtt(tag);
|
return EMSdevice::device_type_2_device_name(device_type) + "_data_" + EMSdevice::tag_to_mqtt(tag);
|
||||||
} else {
|
} else {
|
||||||
return EMSdevice::device_type_2_device_name(device_type) + "_data";
|
return EMSdevice::device_type_2_device_name(device_type) + "_data";
|
||||||
|
|||||||
Reference in New Issue
Block a user