I was thinking the platform would always handle temperature scale, based on location configuration.
However, it seems it is not the case for thermostatCoolingSetpoint and thermostatHeatingSetpoint.
It seems that when sending the following event device:emit_event(capabilities.thermostatCoolingSetpoint.coolingSetpoint({value = 30, unit = 'C' }))
if 'unit is omitted, then no change is reflected in the APP (which is is not the same as for temperatureMeasurement)
If the unit is provided, then the value is displayed exactly as it is sent, no transformation to location’s scale is performed.
I think it is not the same behavior as we see for temperatureMeasurement capability where the value is always transformed to location’s scale, regardless what units where provided when firing the event.
Am I missing something? Any reason we should not expect the consistent temperature scale handling across capabilities?
Also, how it is possible to query location’s temperature scale setting from the driver code? Is there any example?
I’ve been able to replicate this, and indeed, there’s an inconsistency with temperature-related capabilities which I’ll document right away.
Also, just for reference, do you have a personal preference for temperature management?
Should it be parsed according to the location’s scale (Temperature Measurement’s behavior)
Or should it be dynamic (Thermostat Cooling / Heating Setpoint’s behavior)?
Unfortunately, this cannot be tracked from a driver, since it can only access the built-in device_api interface which grants access to devices under a specific driver.
My personal preference is to allow the device to select the scale. This can be easily done by providing the standard preference, similar to standard temperature offset preference.
This preference could have 3 options, ‘F’, ‘C’ or ‘Location’.
I think such approach would provide the greatest flexibility, while keeping simplicity.
If the above is not an option, than dynamic ( Thermostat Cooling / Heating Setpoint ’s behavior) is preferable, as it allows to implement custom preferences for users to choose.