Skip to content

Commit 5ec0f65

Browse files
committed
newer CT200 temperatures, emsesp#2277
1 parent 812911f commit 5ec0f65

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

src/devices/thermostat.cpp

+21-3
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
133133
monitor_typeids = {0x0A};
134134
set_typeids = {};
135135
register_telegram_type(monitor_typeids[0], "EasyMonitor", true, MAKE_PF_CB(process_EasyMonitor));
136+
register_telegram_type(0x02A5, "EasyMonitor", false, MAKE_PF_CB(process_EasyMonitor));
136137

137138
// CRF
138139
} else if (model == EMSdevice::EMS_DEVICE_FLAG_CRF) {
@@ -840,13 +841,30 @@ void Thermostat::process_RC20Monitor(std::shared_ptr<const Telegram> telegram) {
840841

841842
// type 0x0A - data from the Nefit Easy/TC100 thermostat (0x18) - 31 bytes long
842843
void Thermostat::process_EasyMonitor(std::shared_ptr<const Telegram> telegram) {
843-
auto hc = heating_circuit(telegram);
844+
monitor_typeids[0] = telegram->type_id;
845+
auto hc = heating_circuit(telegram);
844846
if (hc == nullptr) {
845847
return;
846848
}
847849

848-
has_update(telegram, hc->roomTemp, 8); // is * 100
849-
has_update(telegram, hc->selTemp, 10); // is * 100
850+
if (telegram->type_id == 0x0A) {
851+
int16_t temp = hc->roomTemp;
852+
if (telegram->read_value(temp, 8) && temp != 0) {
853+
has_update(telegram, hc->roomTemp, 8); // is * 100
854+
has_update(telegram, hc->selTemp, 10); // is * 100
855+
toggle_fetch(0x0A, true);
856+
}
857+
} else if (telegram->type_id == 0x02A5) { // see #2277
858+
int16_t temp = hc->roomTemp / 10;
859+
if (telegram->read_value(temp, 0)) { // is * 10
860+
has_update(hc->roomTemp, temp * 10); // * 100
861+
toggle_fetch(0x0A, false);
862+
}
863+
int16_t sel = hc->selTemp / 50;
864+
if (telegram->read_value(sel, 6, 1)) { // is * 2
865+
has_update(hc->selTemp, sel * 50); // * 100
866+
}
867+
}
850868

851869
add_ha_climate(hc);
852870
}

src/emsdevice.h

+8
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ class EMSdevice {
174174
}
175175
}
176176

177+
void has_update(int16_t & value, int16_t newvalue) {
178+
if (value != newvalue) {
179+
value = newvalue;
180+
has_update_ = true;
181+
publish_value((void *)&value);
182+
}
183+
}
184+
177185
void has_update(uint32_t & value, uint32_t newvalue) {
178186
if (value != newvalue) {
179187
value = newvalue;

0 commit comments

Comments
 (0)