zwave-js / node-zwave-js

Z-Wave driver written entirely in JavaScript/TypeScript
https://zwave-js.github.io/node-zwave-js/
MIT License
755 stars 613 forks source link

[Bug]: Temperature inconsistently converted to local units #4818

Closed mbbush closed 2 years ago

mbbush commented 2 years ago

Checklist

Deploy method

Docker

Zwavejs2Mqtt version

6.13.0

ZwaveJS version

9.5.0

Describe the bug

I live in the US and use Fahrenheit, but have not yet set that preference as a preferred scale. I have two different temperature sensors. When I view the sensor value from the control panel -> device -> values -> Multilevel Sensor v5, I sometimes see:

I've seen those all within a single browser session. If it's showing the Fahrenheit temperature, with °F, and I click refresh, it consistently switches to showing the Celsius temperature with °F. I haven't been able to identify when the ui shows °F vs °C.

To Reproduce

Unset any preferred scales in the zwave settings. Set up a zwave device which reports temperature in Celsius. View the current temperature using the control panel.

Observe that it (sometimes?) shows the Fahrenheit temperature with units of °F (good). If it does, and you click refresh for that command class, it changes the displayed number to the current Celsius temperature, while leaving the unit unchanged (bad). I've also sometimes seen the reverse, where it initially shows Celsius temperature with units of °F, and then when I refresh the number changes to Fahrenheit but the units stay the same.

Expected behavior

I expect the displayed temperature value to always match its displayed units.

Additional context

I've observed logs of sensor reports in both Celsius and Fahrenheit. In all cases, the unit matched the numerical value.

Once I set a preferred scale, I have no longer been able to reproduce the issue. But I still consider it a bug, on the premise that in the default configuration, the software should not display anything which is flat-out wrong. Choose either F or C, but don't use one scale for the number and the other for the unit.

AlCalzone commented 2 years ago

Once I set a preferred scale, I have no longer been able to reproduce the issue.

This is exactly what preferred scales are for, since otherwise zwave-js has no way of knowing which scale you want when querying the device. The unit and value should be consistent though.

Please make a driver log, loglevel debug or silly and attach it here as a file. While making the log, query the device in a way that reproduces your issue.

zwave-js-assistant[bot] commented 2 years ago

This issue has not seen any recent activity and was marked as "stale 💤". Closing for housekeeping purposes... 🧹

Feel free to reopen if the issue persists.