mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
autoformatting, check HS circuits
This commit is contained in:
@@ -139,8 +139,13 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
|
|||||||
|
|
||||||
if (flags == EMSdevice::EMS_DEVICE_FLAG_SM10) {
|
if (flags == EMSdevice::EMS_DEVICE_FLAG_SM10) {
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPumpMod_, DeviceValueType::UINT, nullptr, FL_(solarPumpMod), DeviceValueUOM::PERCENT);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPumpMod_, DeviceValueType::UINT, nullptr, FL_(solarPumpMod), DeviceValueUOM::PERCENT);
|
||||||
register_device_value(
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
DeviceValueTAG::TAG_DEVICE_DATA, &solarPumpMinMod_, DeviceValueType::UINT, nullptr, FL_(pumpMinMod), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_PumpMinMod));
|
&solarPumpMinMod_,
|
||||||
|
DeviceValueType::UINT,
|
||||||
|
nullptr,
|
||||||
|
FL_(pumpMinMod),
|
||||||
|
DeviceValueUOM::PERCENT,
|
||||||
|
MAKE_CF_CB(set_PumpMinMod));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
&solarPumpTurnonDiff_,
|
&solarPumpTurnonDiff_,
|
||||||
DeviceValueType::UINT,
|
DeviceValueType::UINT,
|
||||||
@@ -157,7 +162,8 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
|
|||||||
MAKE_CF_CB(set_TurnoffDiff));
|
MAKE_CF_CB(set_TurnoffDiff));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPower_, DeviceValueType::SHORT, nullptr, FL_(solarPower), DeviceValueUOM::W);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPower_, DeviceValueType::SHORT, nullptr, FL_(solarPower), DeviceValueUOM::W);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &energyLastHour_, DeviceValueType::ULONG, FL_(div10), FL_(energyLastHour), DeviceValueUOM::WH);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &energyLastHour_, DeviceValueType::ULONG, FL_(div10), FL_(energyLastHour), DeviceValueUOM::WH);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &maxFlow_, DeviceValueType::UINT, FL_(div10), FL_(maxFlow), DeviceValueUOM::LMIN, MAKE_CF_CB(set_SM10MaxFlow));
|
register_device_value(
|
||||||
|
DeviceValueTAG::TAG_DEVICE_DATA, &maxFlow_, DeviceValueType::UINT, FL_(div10), FL_(maxFlow), DeviceValueUOM::LMIN, MAKE_CF_CB(set_SM10MaxFlow));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
||||||
&wwMinTemp_,
|
&wwMinTemp_,
|
||||||
DeviceValueType::UINT,
|
DeviceValueType::UINT,
|
||||||
@@ -219,7 +225,12 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
|
|||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPump2_, DeviceValueType::BOOL, nullptr, FL_(solarPump2), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPump2_, DeviceValueType::BOOL, nullptr, FL_(solarPump2), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPump2Mod_, DeviceValueType::UINT, nullptr, FL_(solarPump2Mod), DeviceValueUOM::PERCENT);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPump2Mod_, DeviceValueType::UINT, nullptr, FL_(solarPump2Mod), DeviceValueUOM::PERCENT);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cylBottomTemp2_, DeviceValueType::SHORT, FL_(div10), FL_(cyl2BottomTemp), DeviceValueUOM::DEGREES);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cylBottomTemp2_, DeviceValueType::SHORT, FL_(div10), FL_(cyl2BottomTemp), DeviceValueUOM::DEGREES);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &heatExchangerTemp_, DeviceValueType::SHORT, FL_(div10), FL_(heatExchangerTemp), DeviceValueUOM::DEGREES);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
|
&heatExchangerTemp_,
|
||||||
|
DeviceValueType::SHORT,
|
||||||
|
FL_(div10),
|
||||||
|
FL_(heatExchangerTemp),
|
||||||
|
DeviceValueUOM::DEGREES);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cylPumpMod_, DeviceValueType::UINT, nullptr, FL_(cylPumpMod), DeviceValueUOM::PERCENT);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cylPumpMod_, DeviceValueType::UINT, nullptr, FL_(cylPumpMod), DeviceValueUOM::PERCENT);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &valveStatus_, DeviceValueType::BOOL, nullptr, FL_(valveStatus), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &valveStatus_, DeviceValueType::BOOL, nullptr, FL_(valveStatus), DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cylHeated_, DeviceValueType::BOOL, nullptr, FL_(cylHeated), DeviceValueUOM::NONE);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cylHeated_, DeviceValueType::BOOL, nullptr, FL_(cylHeated), DeviceValueUOM::NONE);
|
||||||
@@ -252,8 +263,13 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
|
|||||||
FL_(heatTransferSystem),
|
FL_(heatTransferSystem),
|
||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_heatTransferSystem));
|
MAKE_CF_CB(set_heatTransferSystem));
|
||||||
register_device_value(
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
DeviceValueTAG::TAG_DEVICE_DATA, &externalCyl_, DeviceValueType::BOOL, nullptr, FL_(externalCyl), DeviceValueUOM::NONE, MAKE_CF_CB(set_externalCyl));
|
&externalCyl_,
|
||||||
|
DeviceValueType::BOOL,
|
||||||
|
nullptr,
|
||||||
|
FL_(externalCyl),
|
||||||
|
DeviceValueUOM::NONE,
|
||||||
|
MAKE_CF_CB(set_externalCyl));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
&thermalDisinfect_,
|
&thermalDisinfect_,
|
||||||
DeviceValueType::BOOL,
|
DeviceValueType::BOOL,
|
||||||
@@ -261,10 +277,20 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
|
|||||||
FL_(thermalDisinfect),
|
FL_(thermalDisinfect),
|
||||||
DeviceValueUOM::NONE,
|
DeviceValueUOM::NONE,
|
||||||
MAKE_CF_CB(set_thermalDisinfect));
|
MAKE_CF_CB(set_thermalDisinfect));
|
||||||
register_device_value(
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
DeviceValueTAG::TAG_DEVICE_DATA, &heatMetering_, DeviceValueType::BOOL, nullptr, FL_(heatMetering), DeviceValueUOM::NONE, MAKE_CF_CB(set_heatMetering));
|
&heatMetering_,
|
||||||
register_device_value(
|
DeviceValueType::BOOL,
|
||||||
DeviceValueTAG::TAG_DEVICE_DATA, &solarIsEnabled_, DeviceValueType::BOOL, nullptr, FL_(activated), DeviceValueUOM::NONE, MAKE_CF_CB(set_solarEnabled));
|
nullptr,
|
||||||
|
FL_(heatMetering),
|
||||||
|
DeviceValueUOM::NONE,
|
||||||
|
MAKE_CF_CB(set_heatMetering));
|
||||||
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
|
&solarIsEnabled_,
|
||||||
|
DeviceValueType::BOOL,
|
||||||
|
nullptr,
|
||||||
|
FL_(activated),
|
||||||
|
DeviceValueUOM::NONE,
|
||||||
|
MAKE_CF_CB(set_solarEnabled));
|
||||||
|
|
||||||
// telegram 0x035A
|
// telegram 0x035A
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
|
|||||||
@@ -2887,12 +2887,7 @@ void Thermostat::register_device_values() {
|
|||||||
FL_(enum_ibaMainDisplay),
|
FL_(enum_ibaMainDisplay),
|
||||||
FL_(ibaMainDisplay),
|
FL_(ibaMainDisplay),
|
||||||
DeviceValueUOM::NONE);
|
DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ibaLanguage_, DeviceValueType::ENUM, FL_(enum_ibaLanguage), FL_(ibaLanguage), DeviceValueUOM::NONE);
|
||||||
&ibaLanguage_,
|
|
||||||
DeviceValueType::ENUM,
|
|
||||||
FL_(enum_ibaLanguage),
|
|
||||||
FL_(ibaLanguage),
|
|
||||||
DeviceValueUOM::NONE);
|
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
&ibaClockOffset_,
|
&ibaClockOffset_,
|
||||||
DeviceValueType::INT,
|
DeviceValueType::INT,
|
||||||
@@ -2908,12 +2903,7 @@ void Thermostat::register_device_values() {
|
|||||||
FL_(enum_ibaMainDisplay),
|
FL_(enum_ibaMainDisplay),
|
||||||
FL_(ibaMainDisplay),
|
FL_(ibaMainDisplay),
|
||||||
DeviceValueUOM::NONE);
|
DeviceValueUOM::NONE);
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ibaLanguage_, DeviceValueType::ENUM, FL_(enum_ibaLanguage), FL_(ibaLanguage), DeviceValueUOM::NONE);
|
||||||
&ibaLanguage_,
|
|
||||||
DeviceValueType::ENUM,
|
|
||||||
FL_(enum_ibaLanguage),
|
|
||||||
FL_(ibaLanguage),
|
|
||||||
DeviceValueUOM::NONE);
|
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
&ibaClockOffset_,
|
&ibaClockOffset_,
|
||||||
DeviceValueType::INT,
|
DeviceValueType::INT,
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ bool EMSdevice::is_fetch(uint16_t telegram_id) {
|
|||||||
bool EMSdevice::has_tag(const uint8_t tag) {
|
bool EMSdevice::has_tag(const uint8_t tag) {
|
||||||
for (const auto & dv : devicevalues_) {
|
for (const auto & dv : devicevalues_) {
|
||||||
if (dv.tag == tag && tag >= DeviceValueTAG::TAG_HC1) {
|
if (dv.tag == tag && tag >= DeviceValueTAG::TAG_HC1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -505,7 +505,7 @@ void EMSdevice::register_device_value(uint8_t tag,
|
|||||||
flags |= CommandFlag::MQTT_SUB_FLAG_HC;
|
flags |= CommandFlag::MQTT_SUB_FLAG_HC;
|
||||||
} else if (tag >= DeviceValueTAG::TAG_WWC1 && tag <= DeviceValueTAG::TAG_WWC4) {
|
} else if (tag >= DeviceValueTAG::TAG_WWC1 && tag <= DeviceValueTAG::TAG_WWC4) {
|
||||||
flags |= CommandFlag::MQTT_SUB_FLAG_WWC;
|
flags |= CommandFlag::MQTT_SUB_FLAG_WWC;
|
||||||
} else if (tag == DeviceValueTAG::TAG_DEVICE_DATA_WW) {
|
} else if (tag == DeviceValueTAG::TAG_DEVICE_DATA_WW || tag == DeviceValueTAG::TAG_BOILER_DATA_WW) {
|
||||||
flags |= CommandFlag::MQTT_SUB_FLAG_WW;
|
flags |= CommandFlag::MQTT_SUB_FLAG_WW;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,7 +554,7 @@ void EMSdevice::publish_value(void * value_p) {
|
|||||||
if (dv.value_p == value_p && dv.has_state(DeviceValueState::DV_VISIBLE)) {
|
if (dv.value_p == value_p && dv.has_state(DeviceValueState::DV_VISIBLE)) {
|
||||||
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
||||||
if (Mqtt::publish_single2cmd()) {
|
if (Mqtt::publish_single2cmd()) {
|
||||||
if ((dv.tag >= DeviceValueTAG::TAG_HC1 && dv.tag <= DeviceValueTAG::TAG_WWC4)) {
|
if (dv.tag >= DeviceValueTAG::TAG_HC1) {
|
||||||
snprintf(topic,
|
snprintf(topic,
|
||||||
sizeof(topic),
|
sizeof(topic),
|
||||||
"%s/%s/%s",
|
"%s/%s/%s",
|
||||||
@@ -903,11 +903,9 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8
|
|||||||
JsonObject json = output;
|
JsonObject json = output;
|
||||||
int8_t tag = id;
|
int8_t tag = id;
|
||||||
|
|
||||||
// check if we have hc or wwc
|
// check if we have hc or wwc or hs
|
||||||
if (id >= 1 && id <= 8) {
|
if (id >= 1 && id <= 29) {
|
||||||
tag = DeviceValueTAG::TAG_HC1 + id - 1;
|
tag = DeviceValueTAG::TAG_HC1 + id - 1;
|
||||||
} else if (id >= 9 && id <= 12) {
|
|
||||||
tag = DeviceValueTAG::TAG_WWC1 + id - 9;
|
|
||||||
} else if (id != -1) {
|
} else if (id != -1) {
|
||||||
return false; // error
|
return false; // error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,39 +53,39 @@ const __FlashStringHelper * DeviceValue::DeviceValueUOM_s[] __attribute__((__ali
|
|||||||
// must be an int of 4 bytes, 32bit aligned
|
// must be an int of 4 bytes, 32bit aligned
|
||||||
const __FlashStringHelper * const DeviceValue::DeviceValueTAG_s[] PROGMEM = {
|
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_boiler_data_ww), // "dhw"
|
||||||
F_(tag_device_data), // ""
|
F_(tag_device_data), // ""
|
||||||
F_(tag_device_data_ww), // "dhw"
|
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"
|
||||||
F_(tag_hc4), // "hc4"
|
F_(tag_hc4), // "hc4"
|
||||||
F_(tag_hc5), // "hc5"
|
F_(tag_hc5), // "hc5"
|
||||||
F_(tag_hc6), // "hc6"
|
F_(tag_hc6), // "hc6"
|
||||||
F_(tag_hc7), // "hc7"
|
F_(tag_hc7), // "hc7"
|
||||||
F_(tag_hc8), // "hc8"
|
F_(tag_hc8), // "hc8"
|
||||||
F_(tag_wwc1), // "wwc1"
|
F_(tag_wwc1), // "wwc1"
|
||||||
F_(tag_wwc2), // "Wwc2"
|
F_(tag_wwc2), // "Wwc2"
|
||||||
F_(tag_wwc3), // "wwc3"
|
F_(tag_wwc3), // "wwc3"
|
||||||
F_(tag_wwc4), // "wwc4"
|
F_(tag_wwc4), // "wwc4"
|
||||||
F_(tag_hs1), // "hs1"
|
F_(tag_hs1), // "hs1"
|
||||||
F_(tag_hs2), // "hs2"
|
F_(tag_hs2), // "hs2"
|
||||||
F_(tag_hs3), // "hs3"
|
F_(tag_hs3), // "hs3"
|
||||||
F_(tag_hs4), // "hs4"
|
F_(tag_hs4), // "hs4"
|
||||||
F_(tag_hs5), // "hs5"
|
F_(tag_hs5), // "hs5"
|
||||||
F_(tag_hs6), // "hs6"
|
F_(tag_hs6), // "hs6"
|
||||||
F_(tag_hs7), // "hs7"
|
F_(tag_hs7), // "hs7"
|
||||||
F_(tag_hs8), // "hs8"
|
F_(tag_hs8), // "hs8"
|
||||||
F_(tag_hs9), // "hs9"
|
F_(tag_hs9), // "hs9"
|
||||||
F_(tag_hs10), // "hs10"
|
F_(tag_hs10), // "hs10"
|
||||||
F_(tag_hs11), // "hs11"
|
F_(tag_hs11), // "hs11"
|
||||||
F_(tag_hs12), // "hs12"
|
F_(tag_hs12), // "hs12"
|
||||||
F_(tag_hs13), // "hs13"
|
F_(tag_hs13), // "hs13"
|
||||||
F_(tag_hs14), // "hs14"
|
F_(tag_hs14), // "hs14"
|
||||||
F_(tag_hs15), // "hs15"
|
F_(tag_hs15), // "hs15"
|
||||||
F_(tag_hs16) // "hs16"
|
F_(tag_hs16) // "hs16"
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1103,10 +1103,8 @@ bool EMSESP::command_commands(uint8_t device_type, JsonObject & output, const in
|
|||||||
bool EMSESP::command_info(uint8_t device_type, JsonObject & output, const int8_t id, const uint8_t output_target) {
|
bool EMSESP::command_info(uint8_t device_type, JsonObject & output, const int8_t id, const uint8_t output_target) {
|
||||||
bool has_value = false;
|
bool has_value = false;
|
||||||
uint8_t tag;
|
uint8_t tag;
|
||||||
if (id >= 1 && id <= 8) {
|
if (id >= 1 && id <= 29) {
|
||||||
tag = DeviceValueTAG::TAG_HC1 + id - 1;
|
tag = DeviceValueTAG::TAG_HC1 + id - 1; // this sets also WWC and HS
|
||||||
} else if (id >= 9 && id <= 12) {
|
|
||||||
tag = DeviceValueTAG::TAG_WWC1 + id - 9;
|
|
||||||
} else if (id == -1 || id == 0) {
|
} else if (id == -1 || id == 0) {
|
||||||
tag = DeviceValueTAG::TAG_NONE;
|
tag = DeviceValueTAG::TAG_NONE;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ char * Helpers::hextoa(char * result, const uint16_t value) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// same as above but to a hex string
|
// same as above but to a hex string
|
||||||
std::string Helpers::hextoa(const uint16_t value, bool prefix) {
|
std::string Helpers::hextoa(const uint16_t value, bool prefix) {
|
||||||
char buf[5];
|
char buf[5];
|
||||||
|
|||||||
Reference in New Issue
Block a user