fix #336, map Junkers hc3/4 to masterthermostat

This commit is contained in:
MichaelDvP
2022-01-31 10:12:50 +01:00
parent 3d1a050e22
commit eaf651a4e2
4 changed files with 20 additions and 3 deletions

View File

@@ -101,6 +101,8 @@
{106, DeviceType::THERMOSTAT, F("FW200"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS},
{107, DeviceType::THERMOSTAT, F("FR100"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
{108, DeviceType::THERMOSTAT, F("FR110"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
{109, DeviceType::THERMOSTAT, F("FB10"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS},
{110, DeviceType::THERMOSTAT, F("FB100"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS},
{111, DeviceType::THERMOSTAT, F("FR10"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
{147, DeviceType::THERMOSTAT, F("FR50"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD},
{191, DeviceType::THERMOSTAT, F("FR120"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model

View File

@@ -174,6 +174,9 @@ void EMSESP::scan_devices() {
* we send to right device and match all reads to 0x18
*/
uint8_t EMSESP::check_master_device(const uint8_t device_id, const uint16_t type_id, const bool read) {
if (device_id != 0x10 && (device_id < 0x18 || device_id > 0x1F)) {
return device_id;
}
if (actual_master_thermostat_ == 0x18) {
uint16_t mon_ids[] = {0x02A5, 0x02A6, 0x02A7, 0x02A8, 0x02A9, 0x02AA, 0x02AB, 0x02AC};
uint16_t set_ids[] = {0x02B9, 0x02BA, 0x02BB, 0x02BC, 0x02BD, 0x02BE, 0x02BF, 0x02C0};
@@ -199,6 +202,17 @@ uint8_t EMSESP::check_master_device(const uint8_t device_id, const uint16_t type
return 0x18;
}
}
} else if (actual_master_thermostat_ == 0x10) {
// Junkers FW200 supports hc1/hc2, hc3/hc4 handled by devices 0x1A...
// see https://github.com/emsesp/EMS-ESP32/issues/336
uint16_t mon_ids[] = {0x0171, 0x0172};
uint16_t set_ids[] = {0x0167, 0x0168};
for (uint8_t i = 0; i < sizeof(mon_ids) / 2; i++) {
if (type_id == mon_ids[i] || type_id == set_ids[i]) {
// reads to master thermostat, writes to remote thermostats
return (read ? actual_master_thermostat_ : 0x1A + i);
}
}
}
return device_id;

View File

@@ -375,7 +375,7 @@ MAKE_PSTR_LIST(enum_controlmode, F_(off), F_(optimized), F_(simple), F_(mpc), F_
MAKE_PSTR_LIST(enum_controlmode2, F_(outdoor), F_(room))
// MAKE_PSTR_LIST(enum_controlmode3, F_(off), F_(room), F_(outdoor), F("room+outdoor"))
MAKE_PSTR_LIST(enum_control, F_(off), F_(rc20), F_(rc3x))
MAKE_PSTR_LIST(enum_j_control, F_(off), F("fb10"), F("fb110"))
MAKE_PSTR_LIST(enum_j_control, F_(off), F("fb10"), F("fb100"))
MAKE_PSTR_LIST(enum_wwProgMode, F("std_prog"), F_(own_prog))
MAKE_PSTR_LIST(enum_dayOfWeek, F("mo"), F("tu"), F("we"), F("th"), F("fr"), F("sa"), F("so"), F("all"))

View File

@@ -359,8 +359,9 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) {
telegram_raw[message_p++] = telegram->message_data[i];
}
}
telegram_last_ = std::make_shared<Telegram>(*telegram); // make a copy of the telegram
// make a copy of the telegram with new dest
telegram_last_ =
std::make_shared<Telegram>(telegram->operation, telegram->src, dest, telegram->type_id, telegram->offset, telegram->message_data, telegram->message_length);
uint8_t length = message_p;
telegram_raw[length] = calculate_crc(telegram_raw, length); // generate and append CRC to the end