Skip to content

Commit

Permalink
switchtime write to right telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Aug 18, 2024
1 parent d345514 commit a55711b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
31 changes: 15 additions & 16 deletions src/devices/thermostat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3273,7 +3273,7 @@ bool Thermostat::set_reducehours(const char * value, const int8_t id) {
}

// sets a single switchtime in the thermostat program for RC35, ww, circ, hc..
bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char * out, size_t len) {
bool Thermostat::set_switchtime(const char * value, const uint16_t type_id) {
if (value == nullptr) {
return false;
}
Expand Down Expand Up @@ -3348,9 +3348,10 @@ bool Thermostat::set_switchtime1(const char * value, const int8_t id) {
if (hc == nullptr) {
return false;
}
char out[20] = {'\0'};
if (set_switchtime(value, timer_typeids[hc->hc()], out, sizeof(out))) {
return true;
if (isRC300() && hc->switchProgMode == 1) {
return set_switchtime(value, timer3_typeids[hc->hc()]);
} else {
return set_switchtime(value, timer_typeids[hc->hc()]);
}
return false;
}
Expand All @@ -3361,10 +3362,10 @@ bool Thermostat::set_switchtime2(const char * value, const int8_t id) {
if (hc == nullptr) {
return false;
}
char out[20] = {'\0'};

if (set_switchtime(value, timer2_typeids[hc->hc()], out, sizeof(out))) {
return true;
if (isRC300() && hc->switchProgMode == 1) {
return set_switchtime(value, timer4_typeids[hc->hc()]);
} else {
return set_switchtime(value, timer2_typeids[hc->hc()]);
}
return false;
}
Expand All @@ -3374,18 +3375,17 @@ bool Thermostat::set_wwCircSwitchTime(const char * value, const int8_t id) {
if (dhw == nullptr) {
return false;
}
char out[20] = {'\0'};

if (isRC300() || model() == EMSdevice::EMS_DEVICE_FLAG_RC100) {
if (set_switchtime(value, 0x0309 + dhw->offset(), out, sizeof(out))) {
if (set_switchtime(value, 0x0309 + dhw->offset())) {
return true;
}
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS || model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS_OLD) {
if (set_switchtime(value, 0x020F, out, sizeof(out))) {
if (set_switchtime(value, 0x020F)) {
return true;
}
} else { // RC35
if (set_switchtime(value, 0x39, out, sizeof(out))) {
if (set_switchtime(value, 0x39)) {
return true;
}
}
Expand All @@ -3398,18 +3398,17 @@ bool Thermostat::set_wwSwitchTime(const char * value, const int8_t id) {
if (dhw != nullptr) {
return false;
}
char out[20] = {'\0'};

if (isRC300() || model() == EMSdevice::EMS_DEVICE_FLAG_RC100) {
if (set_switchtime(value, 0x02FF + dhw->offset(), out, sizeof(out))) {
if (set_switchtime(value, 0x02FF + dhw->offset())) {
return true;
}
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS || model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS_OLD) {
if (set_switchtime(value, 0x01FB, out, sizeof(out))) {
if (set_switchtime(value, 0x01FB)) {
return true;
}
} else { // RC35
if (set_switchtime(value, 0x38, out, sizeof(out))) {
if (set_switchtime(value, 0x38)) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/devices/thermostat.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ class Thermostat : public EMSdevice {

bool set_temperature_value(const char * value, const int8_t id, const uint8_t mode, bool relative = false);
bool set_temperature(const float temperature, const uint8_t mode, const int8_t id);
bool set_switchtime(const char * value, const uint16_t type_id, char * out, size_t len);
bool set_switchtime(const char * value, const uint16_t type_id);

// set functions - these use the id/hc
bool set_mode(const char * value, const int8_t id);
Expand Down

0 comments on commit a55711b

Please sign in to comment.