mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
auto-formatting
This commit is contained in:
@@ -258,7 +258,8 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
||||
register_device_value(TAG_BOILER_DATA_WW, &wwCurFlow_, DeviceValueType::UINT, FL_(div10), FL_(wwCurFlow), DeviceValueUOM::LMIN);
|
||||
register_device_value(TAG_BOILER_DATA_WW, &wwStorageTemp1_, DeviceValueType::USHORT, FL_(div10), FL_(wwStorageTemp1), DeviceValueUOM::DEGREES);
|
||||
register_device_value(TAG_BOILER_DATA_WW, &wwStorageTemp2_, DeviceValueType::USHORT, FL_(div10), FL_(wwStorageTemp2), DeviceValueUOM::DEGREES);
|
||||
register_device_value(TAG_BOILER_DATA_WW, &wwActivated_, DeviceValueType::BOOL, nullptr, FL_(wwActivated), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_warmwater_activated));
|
||||
register_device_value(
|
||||
TAG_BOILER_DATA_WW, &wwActivated_, DeviceValueType::BOOL, nullptr, FL_(wwActivated), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_warmwater_activated));
|
||||
register_device_value(TAG_BOILER_DATA_WW, &wwOneTime_, DeviceValueType::BOOL, nullptr, FL_(wwOneTime), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_warmwater_onetime));
|
||||
register_device_value(TAG_BOILER_DATA_WW, &wwDisinfecting_, DeviceValueType::BOOL, nullptr, FL_(wwDisinfecting), DeviceValueUOM::BOOLEAN);
|
||||
register_device_value(TAG_BOILER_DATA_WW, &wwCharging_, DeviceValueType::BOOL, nullptr, FL_(wwCharging), DeviceValueUOM::BOOLEAN);
|
||||
@@ -688,28 +689,29 @@ void Boiler::process_HpPower(std::shared_ptr<const Telegram> telegram) {
|
||||
|
||||
hpHeatingOn_ = 0;
|
||||
hpCoolingOn_ = 0;
|
||||
hpWwOn_ = 0;
|
||||
hpPoolOn_ = 0;
|
||||
hpWwOn_ = 0;
|
||||
hpPoolOn_ = 0;
|
||||
|
||||
switch (hpActivity_) {
|
||||
case 1: {
|
||||
hpHeatingOn_ = 0xFF;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
hpCoolingOn_ = 0xFF;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
hpWwOn_ = 0xFF;;
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
hpPoolOn_ = 0xFF;;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
hpHeatingOn_ = 0xFF;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
hpCoolingOn_ = 0xFF;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
hpWwOn_ = 0xFF;
|
||||
;
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
hpPoolOn_ = 0xFF;
|
||||
;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Heatpump outdoor unit - type 0x48F
|
||||
@@ -1460,15 +1462,15 @@ bool Boiler::set_maintenancedate(const char * value, const int8_t id) {
|
||||
|
||||
// Set the pool temperature 0x48A
|
||||
bool Boiler::set_pool_temp(const char * value, const int8_t id) {
|
||||
float v = 0;
|
||||
float v = 0;
|
||||
uint8_t v2 = 0;
|
||||
if (!Helpers::value2float(value, v)) {
|
||||
LOG_WARNING(F("Set pool water temperature: Invalid value"));
|
||||
return false;
|
||||
}
|
||||
v2 = (int( (v * 2) + 0.5) & 0xFF);
|
||||
v2 = (int((v * 2) + 0.5) & 0xFF);
|
||||
|
||||
LOG_INFO(F("Setting pool temperature to %d C"), v2/2);
|
||||
LOG_INFO(F("Setting pool temperature to %d C"), v2 / 2);
|
||||
write_command(0x48A, 1, v2, 0x48A);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -166,36 +166,36 @@ class Boiler : public EMSdevice {
|
||||
uint16_t maintenanceTime_;
|
||||
|
||||
// heatpump
|
||||
uint8_t hpPower_;
|
||||
uint8_t hpCompOn_;
|
||||
uint8_t hpBrinePumpSpd_;
|
||||
uint8_t hpCompSpd_;
|
||||
uint8_t hpCircSpd_;
|
||||
uint8_t hpPower_;
|
||||
uint8_t hpCompOn_;
|
||||
uint8_t hpBrinePumpSpd_;
|
||||
uint8_t hpCompSpd_;
|
||||
uint8_t hpCircSpd_;
|
||||
uint16_t hpBrineIn_;
|
||||
uint16_t hpBrineOut_;
|
||||
uint16_t hpSuctionGas_;
|
||||
uint16_t hpHotGas_;
|
||||
uint8_t hpSwitchValve_;
|
||||
uint8_t hpActivity_;
|
||||
uint8_t hpHeatingOn_;
|
||||
uint8_t hpCoolingOn_;
|
||||
uint8_t hpWwOn_;
|
||||
uint8_t hpPoolOn_;
|
||||
uint8_t hpHeatingOn;
|
||||
int16_t hpTc0_;
|
||||
int16_t hpTc1_;
|
||||
int16_t hpTc3_;
|
||||
int16_t hpTr3_;
|
||||
int16_t hpTr4_;
|
||||
int16_t hpTr5_;
|
||||
int16_t hpTr6_;
|
||||
int16_t hpTr7_;
|
||||
int16_t hpTl2_;
|
||||
int16_t hpPl1_;
|
||||
int16_t hpPh1_;
|
||||
uint8_t hpSwitchValve_;
|
||||
uint8_t hpActivity_;
|
||||
uint8_t hpHeatingOn_;
|
||||
uint8_t hpCoolingOn_;
|
||||
uint8_t hpWwOn_;
|
||||
uint8_t hpPoolOn_;
|
||||
uint8_t hpHeatingOn;
|
||||
int16_t hpTc0_;
|
||||
int16_t hpTc1_;
|
||||
int16_t hpTc3_;
|
||||
int16_t hpTr3_;
|
||||
int16_t hpTr4_;
|
||||
int16_t hpTr5_;
|
||||
int16_t hpTr6_;
|
||||
int16_t hpTr7_;
|
||||
int16_t hpTl2_;
|
||||
int16_t hpPl1_;
|
||||
int16_t hpPh1_;
|
||||
|
||||
// Pool unit
|
||||
int8_t poolSetTemp_;
|
||||
int8_t poolSetTemp_;
|
||||
|
||||
void process_UBAParameterWW(std::shared_ptr<const Telegram> telegram);
|
||||
void process_UBAMonitorFast(std::shared_ptr<const Telegram> telegram);
|
||||
|
||||
@@ -26,7 +26,6 @@ uuid::log::Logger Mixer::logger_{F_(mixer), uuid::log::Facility::CONSOLE};
|
||||
|
||||
Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand)
|
||||
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
|
||||
|
||||
LOG_DEBUG(F("Adding new Mixer with device ID 0x%02X"), device_id);
|
||||
|
||||
if (flags == EMSdevice::EMS_DEVICE_FLAG_MP) {
|
||||
@@ -36,9 +35,7 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s
|
||||
register_device_value(TAG_NONE, &poolShuntStatus_, DeviceValueType::ENUM, FL_(enum_shunt), FL_(poolShuntStatus), DeviceValueUOM::LIST);
|
||||
register_device_value(TAG_NONE, &poolShunt_, DeviceValueType::UINT, nullptr, FL_(poolShunt), DeviceValueUOM::PERCENT);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
} else {
|
||||
if (flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS) {
|
||||
if (device_id <= 0x27) {
|
||||
// telegram handlers 0x20 - 0x27 for HC
|
||||
@@ -97,8 +94,10 @@ bool Mixer::publish_ha_config() {
|
||||
StaticJsonDocument<EMSESP_JSON_SIZE_HA_CONFIG> doc;
|
||||
|
||||
char uniq_id[20];
|
||||
if (type_ == Type::MP) snprintf_P(uniq_id, sizeof(uniq_id), PSTR("MixerMP"));
|
||||
else snprintf_P(uniq_id, sizeof(uniq_id), PSTR("Mixer%02X"), device_id() - 0x20 + 1);
|
||||
if (type_ == Type::MP)
|
||||
snprintf_P(uniq_id, sizeof(uniq_id), PSTR("MixerMP"));
|
||||
else
|
||||
snprintf_P(uniq_id, sizeof(uniq_id), PSTR("Mixer%02X"), device_id() - 0x20 + 1);
|
||||
doc["uniq_id"] = uniq_id;
|
||||
|
||||
doc["ic"] = F_(icondevice);
|
||||
@@ -108,8 +107,10 @@ bool Mixer::publish_ha_config() {
|
||||
doc["stat_t"] = stat_t;
|
||||
|
||||
char name[20];
|
||||
if (type_ == Type::MP) snprintf_P(name, sizeof(name), PSTR("Mixer MP"));
|
||||
else snprintf_P(name, sizeof(name), PSTR("Mixer %02X"), device_id() - 0x20 + 1);
|
||||
if (type_ == Type::MP)
|
||||
snprintf_P(name, sizeof(name), PSTR("Mixer MP"));
|
||||
else
|
||||
snprintf_P(name, sizeof(name), PSTR("Mixer %02X"), device_id() - 0x20 + 1);
|
||||
|
||||
doc["name"] = name;
|
||||
|
||||
@@ -137,8 +138,7 @@ bool Mixer::publish_ha_config() {
|
||||
snprintf_P(&topic[0], topic.capacity() + 1, PSTR("sensor/%s/mixer_hc%d/config"), Mqtt::base().c_str(), hc_);
|
||||
} else if (type_ == Type::WWC) {
|
||||
snprintf_P(&topic[0], topic.capacity() + 1, PSTR("sensor/%s/mixer_wwc%d/config"), Mqtt::base().c_str(), hc_); // WWC
|
||||
}
|
||||
else if (type_ == Type::MP) {
|
||||
} else if (type_ == Type::MP) {
|
||||
snprintf_P(&topic[0], topic.capacity() + 1, PSTR("sensor/%s/mixer_mp/config"), Mqtt::base().c_str());
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ void Mixer::process_IPMSetMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
void Mixer::process_HpPoolStatus(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram->read_value(poolTemp_, 0));
|
||||
has_update(telegram->read_value(poolShuntStatus__, 2));
|
||||
has_update(telegram->read_value(poolShunt_, 3)); // 0-100% how much is the shunt open?
|
||||
has_update(telegram->read_value(poolShunt_, 3)); // 0-100% how much is the shunt open?
|
||||
poolShuntStatus_ = poolShunt_ == 100 ? 3 : (poolShunt_ == 0 ? 4 : poolShuntStatus__);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ class Mixer : public EMSdevice {
|
||||
|
||||
enum class Type {
|
||||
NONE,
|
||||
HC, // heating circuit
|
||||
HC, // heating circuit
|
||||
WWC, // warm water circuit
|
||||
MP // pool
|
||||
MP // pool
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1082,11 +1082,11 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
||||
snprintf_P(dateTime_,
|
||||
sizeof(dateTime_),
|
||||
PSTR("%s:%s:%s %s/%s/%s"),
|
||||
Helpers::smallitoa(buf1, telegram->message_data[2]), // hour
|
||||
Helpers::smallitoa(buf2, telegram->message_data[4]), // minute
|
||||
Helpers::smallitoa(buf3, telegram->message_data[5]), // second
|
||||
Helpers::smallitoa(buf4, telegram->message_data[3]), // day
|
||||
Helpers::smallitoa(buf5, telegram->message_data[1]), // month
|
||||
Helpers::smallitoa(buf1, telegram->message_data[2]), // hour
|
||||
Helpers::smallitoa(buf2, telegram->message_data[4]), // minute
|
||||
Helpers::smallitoa(buf3, telegram->message_data[5]), // second
|
||||
Helpers::smallitoa(buf4, telegram->message_data[3]), // day
|
||||
Helpers::smallitoa(buf5, telegram->message_data[1]), // month
|
||||
Helpers::itoa(buf6, (telegram->message_data[0] & 0x7F) + 2000) // year
|
||||
);
|
||||
|
||||
@@ -2388,8 +2388,7 @@ void Thermostat::register_device_values() {
|
||||
FL_(wwChargeDuration),
|
||||
DeviceValueUOM::LIST,
|
||||
MAKE_CF_CB(set_wwchargeduration));
|
||||
register_device_value(
|
||||
TAG_THERMOSTAT_DATA, &wwCharge_, DeviceValueType::BOOL, nullptr, FL_(wwCharge), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_wwcharge));
|
||||
register_device_value(TAG_THERMOSTAT_DATA, &wwCharge_, DeviceValueType::BOOL, nullptr, FL_(wwCharge), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_wwcharge));
|
||||
register_device_value(TAG_THERMOSTAT_DATA, &wwExtra1_, DeviceValueType::UINT, nullptr, FL_(wwExtra1), DeviceValueUOM::DEGREES);
|
||||
register_device_value(TAG_THERMOSTAT_DATA, &wwExtra2_, DeviceValueType::UINT, nullptr, FL_(wwExtra2), DeviceValueUOM::DEGREES);
|
||||
break;
|
||||
@@ -2587,7 +2586,8 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
|
||||
tag, &hc->controlmode, DeviceValueType::ENUM, FL_(enum_controlmode), FL_(controlmode), DeviceValueUOM::LIST, MAKE_CF_CB(set_controlmode));
|
||||
register_device_value(tag, &hc->program, DeviceValueType::UINT, nullptr, FL_(program), DeviceValueUOM::NONE, MAKE_CF_CB(set_program));
|
||||
register_device_value(tag, &hc->tempautotemp, DeviceValueType::UINT, FL_(div2), FL_(tempautotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_tempautotemp));
|
||||
register_device_value(tag, &hc->fastHeatupFactor, DeviceValueType::UINT, nullptr, FL_(fastheatupfactor), DeviceValueUOM::NONE, MAKE_CF_CB(set_fastheatupfactor));
|
||||
register_device_value(
|
||||
tag, &hc->fastHeatupFactor, DeviceValueType::UINT, nullptr, FL_(fastheatupfactor), DeviceValueUOM::NONE, MAKE_CF_CB(set_fastheatupfactor));
|
||||
break;
|
||||
case EMS_DEVICE_FLAG_CRF:
|
||||
register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode5), FL_(mode), DeviceValueUOM::LIST);
|
||||
@@ -2622,7 +2622,8 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
|
||||
register_device_value(tag, &hc->minflowtemp, DeviceValueType::UINT, nullptr, FL_(minflowtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_minflowtemp));
|
||||
register_device_value(tag, &hc->maxflowtemp, DeviceValueType::UINT, nullptr, FL_(maxflowtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_maxflowtemp));
|
||||
register_device_value(tag, &hc->flowtempoffset, DeviceValueType::UINT, nullptr, FL_(flowtempoffset), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_flowtempoffset));
|
||||
register_device_value(tag, &hc->heatingtype, DeviceValueType::ENUM, FL_(enum_heatingtype), FL_(heatingtype), DeviceValueUOM::LIST, MAKE_CF_CB(set_heatingtype));
|
||||
register_device_value(
|
||||
tag, &hc->heatingtype, DeviceValueType::ENUM, FL_(enum_heatingtype), FL_(heatingtype), DeviceValueUOM::LIST, MAKE_CF_CB(set_heatingtype));
|
||||
register_device_value(tag, &hc->reducemode, DeviceValueType::ENUM, FL_(enum_reducemode), FL_(reducemode), DeviceValueUOM::LIST, MAKE_CF_CB(set_reducemode));
|
||||
register_device_value(
|
||||
tag, &hc->controlmode, DeviceValueType::ENUM, FL_(enum_controlmode2), FL_(controlmode), DeviceValueUOM::LIST, MAKE_CF_CB(set_controlmode));
|
||||
|
||||
14
src/emsesp.h
14
src/emsesp.h
@@ -55,13 +55,13 @@
|
||||
|
||||
#define WATCH_ID_NONE 0 // no watch id set
|
||||
|
||||
#define EMSESP_JSON_SIZE_HA_CONFIG 768 // for HA config payloads, using StaticJsonDocument
|
||||
#define EMSESP_JSON_SIZE_SMALL 256 // for smaller json docs, using StaticJsonDocument
|
||||
#define EMSESP_JSON_SIZE_MEDIUM 768 // for medium json docs from ems devices, using StaticJsonDocument
|
||||
#define EMSESP_JSON_SIZE_LARGE 1024 // for large json docs from ems devices, like boiler or thermostat data, using StaticJsonDocument
|
||||
#define EMSESP_JSON_SIZE_MEDIUM_DYN 1024 // for large json docs, using DynamicJsonDocument
|
||||
#define EMSESP_JSON_SIZE_LARGE_DYN 2048 // for very large json docs, using DynamicJsonDocument
|
||||
#define EMSESP_JSON_SIZE_XLARGE_DYN 4096 // for very very large json docs, using DynamicJsonDocument
|
||||
#define EMSESP_JSON_SIZE_HA_CONFIG 768 // for HA config payloads, using StaticJsonDocument
|
||||
#define EMSESP_JSON_SIZE_SMALL 256 // for smaller json docs, using StaticJsonDocument
|
||||
#define EMSESP_JSON_SIZE_MEDIUM 768 // for medium json docs from ems devices, using StaticJsonDocument
|
||||
#define EMSESP_JSON_SIZE_LARGE 1024 // for large json docs from ems devices, like boiler or thermostat data, using StaticJsonDocument
|
||||
#define EMSESP_JSON_SIZE_MEDIUM_DYN 1024 // for large json docs, using DynamicJsonDocument
|
||||
#define EMSESP_JSON_SIZE_LARGE_DYN 2048 // for very large json docs, using DynamicJsonDocument
|
||||
#define EMSESP_JSON_SIZE_XLARGE_DYN 4096 // for very very large json docs, using DynamicJsonDocument
|
||||
#define EMSESP_JSON_SIZE_XXLARGE_DYN 16384 // for extra very very large json docs, using DynamicJsonDocument
|
||||
|
||||
// helpers for callback functions
|
||||
|
||||
@@ -251,10 +251,10 @@ MAKE_PSTR_LIST(enum_reset, F_(maintenance), F_(error))
|
||||
MAKE_PSTR_LIST(enum_bool, F_(off), F_(on))
|
||||
|
||||
//heatpump
|
||||
MAKE_PSTR_LIST(enum_hpactivity, F("none"), F("heating"), F("cooling"), F("warm water"), F("pool") )
|
||||
MAKE_PSTR_LIST(enum_hpactivity, F("none"), F("heating"), F("cooling"), F("warm water"), F("pool"))
|
||||
|
||||
// mixer
|
||||
MAKE_PSTR_LIST(enum_shunt, F("stopped"), F("opening"), F("closing"), F("open"), F("close") )
|
||||
MAKE_PSTR_LIST(enum_shunt, F("stopped"), F("opening"), F("closing"), F("open"), F("close"))
|
||||
|
||||
// thermostat
|
||||
MAKE_PSTR_WORD(light)
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "3.2.2b2"
|
||||
#define EMSESP_APP_VERSION "3.2.2b3"
|
||||
|
||||
Reference in New Issue
Block a user