Aligned handlers and fields in value magnitude and added tests#3111
Aligned handlers and fields in value magnitude and added tests#3111aleclorimer wants to merge 2 commits into
Conversation
|
Invitation URL: |
Test Results 73 files 537 suites 0s ⏱️ Results for commit 2376ac9. ♻️ This comment has been updated with latest results. |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 2376ac9 |
e2b0384 to
08a32b8
Compare
| local setpoint_limit_handler = function(limit_type) | ||
| return function(driver, device, limit) | ||
| device:set_field(limit_type, limit.value, {persist = true}) | ||
| device:set_field(limit_type, limit.value / 100.0, {persist = true}) |
There was a problem hiding this comment.
While this will fix it for future devices, this value is already persisted on existing devices, so even though I think this change makes more sense in a vacuum, for this fix, I think we need to keep persisting in centidegrees (and comment that we are doing such) and then do this division on the checks. We'll have to update the DEFAULT values as well
aeac47a to
4254ba3
Compare
| device:get_field(MAX_HEAT_LIMIT) or DEFAULT_MAX_SETPOINT) | ||
| device:get_field(MIN_COOL_LIMIT) or DEFAULT_MIN_SETPOINT, | ||
| device:get_field(MAX_COOL_LIMIT) or DEFAULT_MAX_SETPOINT) | ||
| device:set_field(COOLING_SETPOINT, value) |
There was a problem hiding this comment.
Isn't this going to set the value in centidegrees, and then correspondingly the update_device_setpoint call will emit an invalid event?
| cooling_setpoint = nil | ||
| elseif (current_mode == ModeAttribute.cool.NAME) and heating_setpoint ~= nil then | ||
| heating_setpoint = device:get_latest_state("main", ThermostatHeatingSetpoint.ID, ThermostatHeatingSetpoint.heatingSetpoint.NAME) | ||
| device:emit_event(ThermostatHeatingSetpoint.heatingSetpoint({value = heating_setpoint, unit = "C"})) |
There was a problem hiding this comment.
Won't this be multiplied by 100 now?
4254ba3 to
55f504a
Compare
55f504a to
2376ac9
Compare
Fixed a bug where
(min|max)(Heat|Cool)SetPointwas being set in centidegrees and then being used to clamp a value in degrees causing the clamped value to have an Int16 overflow error when then tried to scale to centidegrees.Mutant testing: Failing without the
/ 100.0fix/update.