Skip to content

Commit

Permalink
Merge pull request #1444 from MichaelDvP/dev
Browse files Browse the repository at this point in the history
set/read thermostat mode for RC100-RC300, fix #1440 and fix #1442
  • Loading branch information
proddy authored Nov 21, 2023
2 parents 2de855e + aed4596 commit cff5b8c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/devices/thermostat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,13 +1023,12 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> telegram) {
// has_update(telegram, hc->selTemp, 10, 1); // single byte conversion, value is * 2 - manual

telegram->read_value(hc->mode_new, 21); // 0-off, 1-manual, 2-auto
if (hc->mode_new <= 2) {
if (Helpers::hasValue(hc->mode_new)) {
has_update(hc->mode, hc->mode_new);
} else {
uint8_t mode = hc->mode == 2 ? 0xFF : 0; // auto : manual
if (telegram->read_value(mode, 0)) {
has_update(hc->mode, mode == 0xFF ? 2 : 1);
}
telegram->read_value(mode, 0);
has_update(hc->mode, mode == 0xFF ? 2 : 1);
}
has_update(telegram, hc->daytemp, 2); // is * 2
has_update(telegram, hc->nighttemp, 4); // is * 2
Expand Down Expand Up @@ -2598,7 +2597,7 @@ bool Thermostat::set_mode_n(const uint8_t mode, const uint8_t hc_num) {
if (model_ == EMSdevice::EMS_DEVICE_FLAG_RC10) {
hc->mode = set_mode_value >> 1;
} else if (model_ == EMSdevice::EMS_DEVICE_FLAG_RC300 || model_ == EMSdevice::EMS_DEVICE_FLAG_RC100) {
hc->mode = set_mode_value ? 1 : 0;
hc->mode = Helpers::hasValue(hc->mode_new) ? set_mode_value : set_mode_value == 0xFF ? 2 : 1;
} else if (model_ == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
hc->mode = set_mode_value - 1;
} else {
Expand Down

0 comments on commit cff5b8c

Please sign in to comment.