diff --git a/src/core/emsdevicevalue.h b/src/core/emsdevicevalue.h index efa9935f8..83763d947 100644 --- a/src/core/emsdevicevalue.h +++ b/src/core/emsdevicevalue.h @@ -158,6 +158,7 @@ class DeviceValue { enum DeviceValueNumOp : int8_t { DV_NUMOP_NONE = 0, // default DV_NUMOP_DIV2 = 2, + DV_NUMOP_DIV4 = 4, DV_NUMOP_DIV10 = 10, DV_NUMOP_DIV60 = 60, DV_NUMOP_DIV100 = 100, diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 7446acb2b..e67c10266 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -2595,11 +2595,11 @@ bool Thermostat::set_coolondelay(const char * value, const int8_t id) { return false; } - int v; - if (!Helpers::value2number(value, v)) { + float f; + if (!Helpers::value2float(value, f)) { return false; } - write_command(summer2_typeids[hc->hc()], 6, v, summer2_typeids[hc->hc()]); + write_command(summer2_typeids[hc->hc()], 6, (uint8_t)(f * 4), summer2_typeids[hc->hc()]); return true; } @@ -2609,11 +2609,11 @@ bool Thermostat::set_cooloffdelay(const char * value, const int8_t id) { return false; } - int v; - if (!Helpers::value2number(value, v)) { + float f; + if (!Helpers::value2float(value, f)) { return false; } - write_command(summer2_typeids[hc->hc()], 7, v, summer2_typeids[hc->hc()]); + write_command(summer2_typeids[hc->hc()], 7, (uint8_t)(f * 4), summer2_typeids[hc->hc()]); return true; } @@ -3491,11 +3491,11 @@ bool Thermostat::set_heatondelay(const char * value, const int8_t id) { if (hc == nullptr) { return false; } - int v; - if (!Helpers::value2number(value, v)) { + float f; + if (!Helpers::value2float(value, f)) { return false; } - write_command(summer2_typeids[hc->hc()], 2, (uint8_t)v, summer2_typeids[hc->hc()]); + write_command(summer2_typeids[hc->hc()], 2, (uint8_t)(f * 4), summer2_typeids[hc->hc()]); return true; } @@ -3504,11 +3504,11 @@ bool Thermostat::set_heatoffdelay(const char * value, const int8_t id) { if (hc == nullptr) { return false; } - int v; - if (!Helpers::value2number(value, v)) { + float f; + if (!Helpers::value2float(value, f)) { return false; } - write_command(summer2_typeids[hc->hc()], 3, (uint8_t)v, summer2_typeids[hc->hc()]); + write_command(summer2_typeids[hc->hc()], 3, (uint8_t)(f * 4), summer2_typeids[hc->hc()]); return true; } @@ -5012,14 +5012,14 @@ void Thermostat::register_device_values_hc(std::shared_ptrremotehum, DeviceValueType::CMD, FL_(remotehum), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_remotehum), -1, 101); } - register_device_value(tag, &hc->heatondelay, DeviceValueType::UINT8, FL_(heatondelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_heatondelay), 1, 48); - register_device_value(tag, &hc->heatoffdelay, DeviceValueType::UINT8, FL_(heatoffdelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_heatoffdelay), 1, 48); + register_device_value(tag, &hc->heatondelay, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV4, FL_(heatondelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_heatondelay), 1, 48); + register_device_value(tag, &hc->heatoffdelay, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV4, FL_(heatoffdelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_heatoffdelay), 1, 48); register_device_value(tag, &hc->instantstart, DeviceValueType::UINT8, FL_(instantstart), DeviceValueUOM::K, MAKE_CF_CB(set_instantstart), 1, 10); register_device_value(tag, &hc->boost, DeviceValueType::BOOL, FL_(boost), DeviceValueUOM::NONE, MAKE_CF_CB(set_boost)); register_device_value(tag, &hc->boosttime, DeviceValueType::UINT8, FL_(boosttime), DeviceValueUOM::HOURS, MAKE_CF_CB(set_boosttime)); register_device_value(tag, &hc->coolstart, DeviceValueType::UINT8, FL_(coolstart), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_coolstart), 20, 35); - register_device_value(tag, &hc->coolondelay, DeviceValueType::UINT8, FL_(coolondelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_coolondelay), 1, 48); - register_device_value(tag, &hc->cooloffdelay, DeviceValueType::UINT8, FL_(cooloffdelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_cooloffdelay), 1, 48); + register_device_value(tag, &hc->coolondelay, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV4,FL_(coolondelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_coolondelay), 1, 48); + register_device_value(tag, &hc->cooloffdelay, DeviceValueType::UINT8, DeviceValueNumOp::DV_NUMOP_DIV4, FL_(cooloffdelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_cooloffdelay), 1, 48); register_device_value(tag, &hc->switchProgMode, DeviceValueType::ENUM,