Skip to content

Commit

Permalink
test fix set switchprog absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Nov 19, 2024
1 parent 4533431 commit fd8e965
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/devices/thermostat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3413,11 +3413,12 @@ bool Thermostat::set_reducehours(const char * value, const int8_t id) {

bool Thermostat::set_switchpoint(JsonObject doc, uint8_t & offset, uint8_t * data) {
uint8_t no = doc["no"] | 0xFF;
uint8_t temp = doc["temp"] | 0;
float tempF = doc["temp"] | 0;
std::string s_day = doc["day"].as<std::string>();
std::string s_mode = doc["mode"].as<std::string>();
std::string s_time = doc["time"].as<std::string>();
uint8_t day;
uint8_t temp = tempF;
// LOG_DEBUG("id: %d, day: %s, mode: %s, time: %s", no, s_day.c_str(), s_mode.c_str(), s_time.c_str());
if (!Helpers::value2enum(s_day.c_str(), day, FL_(enum_dayOfWeek))) {
day = 7;
Expand Down Expand Up @@ -3467,7 +3468,7 @@ bool Thermostat::set_switchpoint(JsonObject doc, uint8_t & offset, uint8_t * dat
}
temp--; // set on->0xFF, off to 0x00
} else {
temp = 2 * (EMSESP::system_.fahrenheit() ? (temp - 32.0) / 1.8 : temp);
temp = 2 * (EMSESP::system_.fahrenheit() ? (tempF - 32.0) / 1.8 : tempF);
}
if (no != 0xFF) {
offset = day * 12 + (no * 2) % 12;
Expand Down

0 comments on commit fd8e965

Please sign in to comment.