mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-31 19:19:08 +03:00
fix telegram length check of remote
This commit is contained in:
@@ -34,13 +34,14 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
|
|||||||
// remote thermostats with humidity: RC100H remote, each thermostat is for one hc
|
// remote thermostats with humidity: RC100H remote, each thermostat is for one hc
|
||||||
if (device_id >= 0x38 && device_id <= 0x3F) {
|
if (device_id >= 0x38 && device_id <= 0x3F) {
|
||||||
register_telegram_type(0x042B + device_id - 0x38, "RemoteTemp", false, MAKE_PF_CB(process_RemoteTemp));
|
register_telegram_type(0x042B + device_id - 0x38, "RemoteTemp", false, MAKE_PF_CB(process_RemoteTemp));
|
||||||
register_telegram_type(0x047B + device_id - 0x38, "RemoteHumidity", false, MAKE_PF_CB(process_RemoteHumidity));
|
if (product_id != Roomctrl::RC200) {
|
||||||
register_telegram_type(0x0273 + device_id - 0x38, "RemoteCorrection", true, MAKE_PF_CB(process_RemoteCorrection));
|
register_telegram_type(0x047B + device_id - 0x38, "RemoteHumidity", false, MAKE_PF_CB(process_RemoteHumidity));
|
||||||
register_telegram_type(0x0A6A + device_id - 0x38, "RemoteBattery", true, MAKE_PF_CB(process_RemoteBattery));
|
register_telegram_type(0x0273 + device_id - 0x38, "RemoteCorrection", true, MAKE_PF_CB(process_RemoteCorrection));
|
||||||
// maybe fixed type for these telegrams?
|
register_telegram_type(0x0A6A + device_id - 0x38, "RemoteBattery", true, MAKE_PF_CB(process_RemoteBattery));
|
||||||
// register_telegram_type(0x0273, "RemoteCorrection", true, MAKE_PF_CB(process_RemoteCorrection));
|
// maybe fixed type for these telegrams?
|
||||||
// register_telegram_type(0x0A6B, "RemoteBattery", true, MAKE_PF_CB(process_RemoteBattery));
|
// register_telegram_type(0x0273, "RemoteCorrection", true, MAKE_PF_CB(process_RemoteCorrection));
|
||||||
|
// register_telegram_type(0x0A6B, "RemoteBattery", true, MAKE_PF_CB(process_RemoteBattery));
|
||||||
|
}
|
||||||
register_device_values(); // register device values for common values (not heating circuit)
|
register_device_values(); // register device values for common values (not heating circuit)
|
||||||
return; // no values to add
|
return; // no values to add
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void Roomctrl::send(const uint8_t addr) {
|
|||||||
humidity(addr, 0x10, hc);
|
humidity(addr, 0x10, hc);
|
||||||
sendcnt[hc] = 0;
|
sendcnt[hc] = 0;
|
||||||
} else { // temperature telegram
|
} else { // temperature telegram
|
||||||
if (remotehum_[hc] != EMS_VALUE_UINT_NOTSET && hc < 2) {
|
if (remotehum_[hc] != EMS_VALUE_UINT_NOTSET) {
|
||||||
sendcnt[hc] = 1;
|
sendcnt[hc] = 1;
|
||||||
} else {
|
} else {
|
||||||
rc_time_[hc] = uuid::get_uptime();
|
rc_time_[hc] = uuid::get_uptime();
|
||||||
@@ -148,21 +148,21 @@ void Roomctrl::check(const uint8_t addr, const uint8_t * data, const uint8_t len
|
|||||||
// empty message back if temperature not set or unknown message type
|
// empty message back if temperature not set or unknown message type
|
||||||
if (data[2] == EMSdevice::EMS_TYPE_VERSION) {
|
if (data[2] == EMSdevice::EMS_TYPE_VERSION) {
|
||||||
version(addr, data[0]);
|
version(addr, data[0]);
|
||||||
} else if (length == 5 && remotetemp_[hc] == EMS_VALUE_SHORT_NOTSET) {
|
} else if (length == 6 && remotetemp_[hc] == EMS_VALUE_SHORT_NOTSET) {
|
||||||
unknown(addr, data[0], data[2], data[3]);
|
unknown(addr, data[0], data[2], data[3]);
|
||||||
} else if (length == 7 && remotetemp_[hc] == EMS_VALUE_SHORT_NOTSET) {
|
} else if (length == 8 && remotetemp_[hc] == EMS_VALUE_SHORT_NOTSET) {
|
||||||
unknown(addr, data[0], data[3], data[5], data[6]);
|
unknown(addr, data[0], data[3], data[5], data[6]);
|
||||||
} else if (data[2] == 0xAF && data[3] == 0) {
|
} else if (data[2] == 0xAF && data[3] == 0) {
|
||||||
temperature(addr, data[0], hc);
|
temperature(addr, data[0], hc);
|
||||||
} else if (length == 7 && data[2] == 0xFF && data[3] == 0 && data[5] == 0 && data[6] == 0x23) { // Junkers
|
} else if (length == 8 && data[2] == 0xFF && data[3] == 0 && data[5] == 0 && data[6] == 0x23) { // Junkers
|
||||||
temperature(addr, data[0], hc);
|
temperature(addr, data[0], hc);
|
||||||
} else if (length == 7 && data[2] == 0xFF && data[3] == 0 && data[5] == 3 && data[6] == 0x2B + hc) { // EMS+ temperature
|
} else if (length == 8 && data[2] == 0xFF && data[3] == 0 && data[5] == 3 && data[6] == 0x2B + hc) { // EMS+ temperature
|
||||||
temperature(addr, data[0], hc);
|
temperature(addr, data[0], hc);
|
||||||
} else if (length == 7 && data[2] == 0xFF && data[3] == 0 && data[5] == 3 && data[6] == 0x7B + hc && remotehum_[hc] != EMS_VALUE_UINT_NOTSET) { // EMS+ humidity
|
} else if (length == 8 && data[2] == 0xFF && data[3] == 0 && data[5] == 3 && data[6] == 0x7B + hc && remotehum_[hc] != EMS_VALUE_UINT_NOTSET) { // EMS+ humidity
|
||||||
humidity(addr, data[0], hc);
|
humidity(addr, data[0], hc);
|
||||||
} else if (length == 5) { // ems query
|
} else if (length == 6) { // ems query
|
||||||
unknown(addr, data[0], data[2], data[3]);
|
unknown(addr, data[0], data[2], data[3]);
|
||||||
} else if (length == 7 && data[2] == 0xFF) { // ems+ query
|
} else if (length == 8 && data[2] == 0xFF) { // ems+ query
|
||||||
unknown(addr, data[0], data[3], data[5], data[6]);
|
unknown(addr, data[0], data[3], data[5], data[6]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) {
|
|||||||
data[5] = 0x2B + hc;
|
data[5] = 0x2B + hc;
|
||||||
data[6] = (uint8_t)(remotetemp_[hc] >> 8);
|
data[6] = (uint8_t)(remotetemp_[hc] >> 8);
|
||||||
data[7] = (uint8_t)(remotetemp_[hc] & 0xFF);
|
data[7] = (uint8_t)(remotetemp_[hc] & 0xFF);
|
||||||
uint16_t t1 = remotetemp_[hc] * 10;
|
uint16_t t1 = remotetemp_[hc] * 10 + 5;
|
||||||
data[8] = (uint8_t)(t1 >> 8);
|
data[8] = (uint8_t)(t1 >> 8);
|
||||||
data[9] = (uint8_t)(t1 & 0xFF);
|
data[9] = (uint8_t)(t1 & 0xFF);
|
||||||
data[10] = 1; // not sure what this is and if we need it, maybe mode?
|
data[10] = 1; // not sure what this is and if we need it, maybe mode?
|
||||||
|
|||||||
Reference in New Issue
Block a user