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) {
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPumpMod_, DeviceValueType::UINT, nullptr, FL_(solarPumpMod), DeviceValueUOM::PERCENT);
|
||||
register_device_value(
|
||||
DeviceValueTAG::TAG_DEVICE_DATA, &solarPumpMinMod_, DeviceValueType::UINT, nullptr, FL_(pumpMinMod), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_PumpMinMod));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&solarPumpMinMod_,
|
||||
DeviceValueType::UINT,
|
||||
nullptr,
|
||||
FL_(pumpMinMod),
|
||||
DeviceValueUOM::PERCENT,
|
||||
MAKE_CF_CB(set_PumpMinMod));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&solarPumpTurnonDiff_,
|
||||
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));
|
||||
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, &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,
|
||||
&wwMinTemp_,
|
||||
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, &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, &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, &valveStatus_, DeviceValueType::BOOL, nullptr, FL_(valveStatus), 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),
|
||||
DeviceValueUOM::NONE,
|
||||
MAKE_CF_CB(set_heatTransferSystem));
|
||||
register_device_value(
|
||||
DeviceValueTAG::TAG_DEVICE_DATA, &externalCyl_, DeviceValueType::BOOL, nullptr, FL_(externalCyl), DeviceValueUOM::NONE, MAKE_CF_CB(set_externalCyl));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&externalCyl_,
|
||||
DeviceValueType::BOOL,
|
||||
nullptr,
|
||||
FL_(externalCyl),
|
||||
DeviceValueUOM::NONE,
|
||||
MAKE_CF_CB(set_externalCyl));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&thermalDisinfect_,
|
||||
DeviceValueType::BOOL,
|
||||
@@ -261,10 +277,20 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
|
||||
FL_(thermalDisinfect),
|
||||
DeviceValueUOM::NONE,
|
||||
MAKE_CF_CB(set_thermalDisinfect));
|
||||
register_device_value(
|
||||
DeviceValueTAG::TAG_DEVICE_DATA, &heatMetering_, DeviceValueType::BOOL, 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));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&heatMetering_,
|
||||
DeviceValueType::BOOL,
|
||||
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
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
|
||||
@@ -2887,12 +2887,7 @@ void Thermostat::register_device_values() {
|
||||
FL_(enum_ibaMainDisplay),
|
||||
FL_(ibaMainDisplay),
|
||||
DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&ibaLanguage_,
|
||||
DeviceValueType::ENUM,
|
||||
FL_(enum_ibaLanguage),
|
||||
FL_(ibaLanguage),
|
||||
DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ibaLanguage_, DeviceValueType::ENUM, FL_(enum_ibaLanguage), FL_(ibaLanguage), DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&ibaClockOffset_,
|
||||
DeviceValueType::INT,
|
||||
@@ -2908,12 +2903,7 @@ void Thermostat::register_device_values() {
|
||||
FL_(enum_ibaMainDisplay),
|
||||
FL_(ibaMainDisplay),
|
||||
DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&ibaLanguage_,
|
||||
DeviceValueType::ENUM,
|
||||
FL_(enum_ibaLanguage),
|
||||
FL_(ibaLanguage),
|
||||
DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ibaLanguage_, DeviceValueType::ENUM, FL_(enum_ibaLanguage), FL_(ibaLanguage), DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&ibaClockOffset_,
|
||||
DeviceValueType::INT,
|
||||
|
||||
@@ -505,7 +505,7 @@ void EMSdevice::register_device_value(uint8_t tag,
|
||||
flags |= CommandFlag::MQTT_SUB_FLAG_HC;
|
||||
} else if (tag >= DeviceValueTAG::TAG_WWC1 && tag <= DeviceValueTAG::TAG_WWC4) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ void EMSdevice::publish_value(void * value_p) {
|
||||
if (dv.value_p == value_p && dv.has_state(DeviceValueState::DV_VISIBLE)) {
|
||||
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
||||
if (Mqtt::publish_single2cmd()) {
|
||||
if ((dv.tag >= DeviceValueTAG::TAG_HC1 && dv.tag <= DeviceValueTAG::TAG_WWC4)) {
|
||||
if (dv.tag >= DeviceValueTAG::TAG_HC1) {
|
||||
snprintf(topic,
|
||||
sizeof(topic),
|
||||
"%s/%s/%s",
|
||||
@@ -903,11 +903,9 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8
|
||||
JsonObject json = output;
|
||||
int8_t tag = id;
|
||||
|
||||
// check if we have hc or wwc
|
||||
if (id >= 1 && id <= 8) {
|
||||
// check if we have hc or wwc or hs
|
||||
if (id >= 1 && id <= 29) {
|
||||
tag = DeviceValueTAG::TAG_HC1 + id - 1;
|
||||
} else if (id >= 9 && id <= 12) {
|
||||
tag = DeviceValueTAG::TAG_WWC1 + id - 9;
|
||||
} else if (id != -1) {
|
||||
return false; // error
|
||||
}
|
||||
|
||||
@@ -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 has_value = false;
|
||||
uint8_t tag;
|
||||
if (id >= 1 && id <= 8) {
|
||||
tag = DeviceValueTAG::TAG_HC1 + id - 1;
|
||||
} else if (id >= 9 && id <= 12) {
|
||||
tag = DeviceValueTAG::TAG_WWC1 + id - 9;
|
||||
if (id >= 1 && id <= 29) {
|
||||
tag = DeviceValueTAG::TAG_HC1 + id - 1; // this sets also WWC and HS
|
||||
} else if (id == -1 || id == 0) {
|
||||
tag = DeviceValueTAG::TAG_NONE;
|
||||
} else {
|
||||
|
||||
@@ -52,7 +52,6 @@ char * Helpers::hextoa(char * result, const uint16_t value) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// same as above but to a hex string
|
||||
std::string Helpers::hextoa(const uint16_t value, bool prefix) {
|
||||
char buf[5];
|
||||
|
||||
Reference in New Issue
Block a user