home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.12k stars 2.81k forks source link

Changing temperature by pressing plus/minus leads to wrong value being set #22048

Open ibezkrovnyi opened 2 months ago

ibezkrovnyi commented 2 months ago

Checklist

Describe the issue you are experiencing

When the current temperature is 25.1 degrees (celcius), pressing + button on Thermostat card to increase temperature by 0.1 leads to temperature 25.200000000000003 being sent to device, then (what is worse) either ZWaveJS or ZWaveJS UI or device itself resets value to 25.0 (not to 25.1 and not to 25.2)

2024-09-21 22:33:47.669 DEBUG (MainThread) [zwave_js_server] Publishing message:
{'command': 'node.set_value',
 'messageId': '7ef4b533a709432aaf8ceab816763803',
 'nodeId': 65,
 'value': 25.200000000000003,
 'valueId': {'commandClass': 67,
             'endpoint': 0,
             'property': 'setpoint',
             'propertyKey': 1}}

2024-09-21 22:33:47.701 DEBUG (MainThread) [zwave_js_server.server] 2024-09-21T20:33:47.692Z:
2024-09-21T20:33:47.692Z DRIVER » [Node 065] [REQ] [SendDataBridge]
                                  │ source node id:   1
                                  │ transmit options: 0x25
                                  │ callback id:      51
                                  └─[Security2CCMessageEncapsulation]
                                    │ sequence number: 2
                                    │ security class:  S2_Authenticated
                                    └─[SupervisionCCGet]
                                      │ session id:      20
                                      │ request updates: true
                                      └─[ThermostatSetpointCCSet]
                                          setpoint type: Heating
                                          value:         25.200000000000003 °C

Describe the behavior you expected

Pressing + or - on the thermostat card should round values to the precision of the step increment, or use a method that avoids floating-point inaccuracies (such as the well-known IEEE 754 precision issue).

Steps to reproduce the issue

This issue doesn't occur when adjusting the temperature via the circular slider.

image

What version of Home Assistant Core has the issue?

2024.9.2

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Edge 128.0.2739.79

Which operating system are you using to run this browser?

Windows 11

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

Issue https://github.com/home-assistant/frontend/issues/1798 is related to wrong value being displayed. Not sure though if it was only fixed for displayed value, or for the value that is being sent to device too.

GauravSahu891 commented 2 months ago

Hey there,

I’d like to take on this issue. Please assign it to me.

Additionally, I’d like to loop in @ibezkrovnyi for their insights.

Thanks!

Feel free to modify it as needed!