newer CT200 temperatures, #2277

This commit is contained in:
MichaelDvP
2024-12-05 10:09:26 +01:00
parent 812911ffbb
commit 5ec0f657a0
2 changed files with 29 additions and 3 deletions

View File

@@ -133,6 +133,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
monitor_typeids = {0x0A};
set_typeids = {};
register_telegram_type(monitor_typeids[0], "EasyMonitor", true, MAKE_PF_CB(process_EasyMonitor));
register_telegram_type(0x02A5, "EasyMonitor", false, MAKE_PF_CB(process_EasyMonitor));
// CRF
} else if (model == EMSdevice::EMS_DEVICE_FLAG_CRF) {
@@ -840,13 +841,30 @@ void Thermostat::process_RC20Monitor(std::shared_ptr<const Telegram> telegram) {
// type 0x0A - data from the Nefit Easy/TC100 thermostat (0x18) - 31 bytes long
void Thermostat::process_EasyMonitor(std::shared_ptr<const Telegram> telegram) {
auto hc = heating_circuit(telegram);
monitor_typeids[0] = telegram->type_id;
auto hc = heating_circuit(telegram);
if (hc == nullptr) {
return;
}
has_update(telegram, hc->roomTemp, 8); // is * 100
has_update(telegram, hc->selTemp, 10); // is * 100
if (telegram->type_id == 0x0A) {
int16_t temp = hc->roomTemp;
if (telegram->read_value(temp, 8) && temp != 0) {
has_update(telegram, hc->roomTemp, 8); // is * 100
has_update(telegram, hc->selTemp, 10); // is * 100
toggle_fetch(0x0A, true);
}
} else if (telegram->type_id == 0x02A5) { // see #2277
int16_t temp = hc->roomTemp / 10;
if (telegram->read_value(temp, 0)) { // is * 10
has_update(hc->roomTemp, temp * 10); // * 100
toggle_fetch(0x0A, false);
}
int16_t sel = hc->selTemp / 50;
if (telegram->read_value(sel, 6, 1)) { // is * 2
has_update(hc->selTemp, sel * 50); // * 100
}
}
add_ha_climate(hc);
}

View File

@@ -174,6 +174,14 @@ class EMSdevice {
}
}
void has_update(int16_t & value, int16_t newvalue) {
if (value != newvalue) {
value = newvalue;
has_update_ = true;
publish_value((void *)&value);
}
}
void has_update(uint32_t & value, uint32_t newvalue) {
if (value != newvalue) {
value = newvalue;