mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 01:09:51 +03:00
add TA4/TW1, fix decimal, add EM100 values, update
This commit is contained in:
@@ -24,36 +24,111 @@ REGISTER_FACTORY(Alert, EMSdevice::DeviceType::ALERT);
|
||||
|
||||
Alert::Alert(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand)
|
||||
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
|
||||
register_telegram_type(0x937, "EM100TempMessage", false, MAKE_PF_CB(process_EM100TempMessage));
|
||||
register_telegram_type(0x93A, "EM100SetMessage", false, MAKE_PF_CB(process_EM100SetMessage));
|
||||
register_telegram_type(0x936, "EM100MonitorMessage", false, MAKE_PF_CB(process_EM100MonitorMessage));
|
||||
if (device_id == 0x15) { // EM100
|
||||
register_telegram_type(0x935, "EM100SetMessage", true, MAKE_PF_CB(process_EM100SetMessage));
|
||||
register_telegram_type(0x937, "EM100TempMessage", false, MAKE_PF_CB(process_EM100TempMessage));
|
||||
register_telegram_type(0x938, "EM100InputMessage", false, MAKE_PF_CB(process_EM100InputMessage));
|
||||
register_telegram_type(0x939, "EM100MonitorMessage", false, MAKE_PF_CB(process_EM100MonitorMessage));
|
||||
register_telegram_type(0x93A, "EM100ConfigMessage", false, MAKE_PF_CB(process_EM100ConfigMessage));
|
||||
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&headerTemp_,
|
||||
DeviceValueType::SHORT,
|
||||
DeviceValueNumOp::DV_NUMOP_DIV10,
|
||||
FL_(flowTempVf),
|
||||
DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dip_, DeviceValueType::UINT, FL_(mode), DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &outPower_, DeviceValueType::UINT, FL_(power), DeviceValueUOM::PERCENT);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &errorState_, DeviceValueType::BOOL, FL_(error), DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&headerTemp_,
|
||||
DeviceValueType::SHORT,
|
||||
DeviceValueNumOp::DV_NUMOP_DIV10,
|
||||
FL_(flowTempVf),
|
||||
DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &input_, DeviceValueType::USHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(input), DeviceValueUOM::VOLTS);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &outPower_, DeviceValueType::BOOL, FL_(outPower), DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &setPower_, DeviceValueType::UINT, FL_(setPower), DeviceValueUOM::PERCENT);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &setPoint_, DeviceValueType::UINT, FL_(setPoint), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&minV_,
|
||||
DeviceValueType::UINT,
|
||||
DeviceValueNumOp::DV_NUMOP_DIV10,
|
||||
FL_(minV),
|
||||
DeviceValueUOM::VOLTS,
|
||||
MAKE_CF_CB(set_minV));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&maxV_,
|
||||
DeviceValueType::UINT,
|
||||
DeviceValueNumOp::DV_NUMOP_DIV10,
|
||||
FL_(maxV),
|
||||
DeviceValueUOM::VOLTS,
|
||||
MAKE_CF_CB(set_maxV));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &minT_, DeviceValueType::UINT, FL_(minT), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_minT));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &maxT_, DeviceValueType::UINT, FL_(maxT), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_maxT));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dip_, DeviceValueType::UINT, FL_(mode), DeviceValueUOM::NONE);
|
||||
// register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &errorState_, DeviceValueType::BOOL, FL_(error), DeviceValueUOM::NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 0x935 needs fetch
|
||||
void Alert::process_EM100SetMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, minV_, 1); // Input for off, is / 10
|
||||
has_update(telegram, maxV_, 2); // Input for 100%, is / 10
|
||||
has_update(telegram, minT_, 3); // min temp
|
||||
has_update(telegram, maxT_, 4); // max temp
|
||||
}
|
||||
|
||||
// alert(0x15) -B-> All(0x00), ?(0x093A), data: 00 00 00 00 00 00 00 00 00 03 01
|
||||
void Alert::process_EM100SetMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
void Alert::process_EM100ConfigMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, dip_, 9);
|
||||
}
|
||||
// one of 0x936, 0x937, 0x938, 0x939, 0x93A
|
||||
void Alert::process_EM100MonitorMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, errorState_, 0); // OE1
|
||||
has_update(telegram, errorPump_, 0); // IE0
|
||||
has_update(telegram, outPower_, 0); // IO1 percent
|
||||
has_update(telegram, input_, 0); //IO1
|
||||
|
||||
// alert(0x15) -B-> All(0x00), ?(0x0938), data: 01 62
|
||||
void Alert::process_EM100InputMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, outPower_, 0); // IO1
|
||||
has_update(telegram, input_, 1);
|
||||
}
|
||||
|
||||
// alert(0x15) -B-> All(0x00), ?(0x0939), data: 64 4E 00 00
|
||||
void Alert::process_EM100MonitorMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, setPower_, 0); // percent
|
||||
has_update(telegram, setPoint_, 1); // °C
|
||||
// has_update(telegram, errorState_, 2); // OE1
|
||||
// has_update(telegram, errorPump_, 3); // IE0
|
||||
}
|
||||
|
||||
// alert(0x15) -B-> All(0x00), ?(0x0937), data: 80 00
|
||||
void Alert::process_EM100TempMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, headerTemp_, 0);
|
||||
}
|
||||
|
||||
bool Alert::set_minV(const char * value, const int8_t id) {
|
||||
float v;
|
||||
if (!Helpers::value2float(value, v)) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x935, 1, (uint8_t)(v * 10));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Alert::set_maxV(const char * value, const int8_t id) {
|
||||
float v;
|
||||
if (!Helpers::value2float(value, v)) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x935, 2, (uint8_t)(v * 10));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Alert::set_minT(const char * value, const int8_t id) {
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x935, 3, v);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Alert::set_maxT(const char * value, const int8_t id) {
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x935, 4, v);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace emsesp
|
||||
@@ -31,13 +31,27 @@ class Alert : public EMSdevice {
|
||||
void process_EM100SetMessage(std::shared_ptr<const Telegram> telegram);
|
||||
void process_EM100MonitorMessage(std::shared_ptr<const Telegram> telegram);
|
||||
void process_EM100TempMessage(std::shared_ptr<const Telegram> telegram);
|
||||
void process_EM100InputMessage(std::shared_ptr<const Telegram> telegram);
|
||||
void process_EM100ConfigMessage(std::shared_ptr<const Telegram> telegram);
|
||||
|
||||
bool set_minV(const char * value, const int8_t id);
|
||||
bool set_maxV(const char * value, const int8_t id);
|
||||
bool set_minT(const char * value, const int8_t id);
|
||||
bool set_maxT(const char * value, const int8_t id);
|
||||
|
||||
|
||||
int16_t headerTemp_; // T0
|
||||
int16_t input_; // IO1
|
||||
uint8_t errorState_; // OE1
|
||||
uint8_t errorPump_; // IE0
|
||||
uint8_t outPower_; // IO1
|
||||
uint8_t dip_; // dip switch
|
||||
uint8_t setPower_; // request
|
||||
uint8_t setPoint_;
|
||||
uint8_t dip_; // dip switch
|
||||
uint8_t minV_;
|
||||
uint8_t maxV_;
|
||||
uint8_t minT_;
|
||||
uint8_t maxT_;
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
@@ -102,8 +102,8 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
||||
FL_(setReturnTemp),
|
||||
DeviceValueUOM::DEGREES,
|
||||
MAKE_CF_CB(set_returnTemp));
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cwFlowRate_, DeviceValueType::USHORT, FL_(cwFlowRate), DeviceValueUOM::LMIN);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &netFlowTemp_, DeviceValueType::USHORT, FL_(netFlowTemp), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cwFlowRate_, DeviceValueType::USHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(cwFlowRate), DeviceValueUOM::LMIN);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &netFlowTemp_, DeviceValueType::USHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(netFlowTemp), DeviceValueUOM::DEGREES);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -433,6 +433,8 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpTl2_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(hpTl2), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpPl1_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(hpPl1), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpPh1_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(hpPh1), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpTa4_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(hpTa4), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpTw1_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(hpTw1), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&poolSetTemp_,
|
||||
DeviceValueType::UINT,
|
||||
@@ -1446,6 +1448,8 @@ void Boiler::process_HpTemperatures(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, hpTr6_, 0);
|
||||
has_update(telegram, hpTr7_, 30);
|
||||
has_update(telegram, hpTl2_, 12);
|
||||
has_update(telegram, hpTa4_, 22);
|
||||
has_update(telegram, hpTw1_, 24);
|
||||
has_update(telegram, hpPl1_, 26);
|
||||
has_update(telegram, hpPh1_, 28);
|
||||
has_update(telegram, hpBrineIn_, 8);
|
||||
|
||||
@@ -207,6 +207,8 @@ class Boiler : public EMSdevice {
|
||||
int16_t hpTl2_;
|
||||
int16_t hpPl1_;
|
||||
int16_t hpPh1_;
|
||||
int16_t hpTa4_;
|
||||
int16_t hpTw1_;
|
||||
|
||||
// Pool unit
|
||||
int8_t poolSetTemp_;
|
||||
|
||||
Reference in New Issue
Block a user