geoffdavis / esphome-mitsubishiheatpump

ESPHome Climate Component for Mitsubishi Heatpumps using direct serial connection
BSD 2-Clause "Simplified" License
583 stars 156 forks source link

Wrong current temperature using external sensor and temperature_step: 1.0 #88

Open f-vicente opened 1 year ago

f-vicente commented 1 year ago

I have setup an external sensor, it works great but when I toggle temperature step in order to disable the 0.5º accuracy I have found that it rounds up to 1º degree more in some circunstances.

It seems that SwiCago rounds to 0.5 degrees, which is fine. So 12:26:47 [D] [MitsubishiHeatPump:409] Setting remote temp: 21.3 Sets the temperature to 21.5º on the heatpump.

And then when this integration reads back the temperature, it pulls the temperature from the heatpump, and because I have enabled temperature step: 1.0 it does another round operation (round(21.5)), so I get Current: 22º, so 21.3º real temperature ends reported as 22º.

Could be possible to show the external sensor temperature? leaving the "temperature_step" option to only apply when setting the temperature.

Thanks!

Smandurlo commented 1 year ago

I don’t understand why we need to round to 1 step when the internal temperature sensor works with 0.5 step. 21.3°C should be rounded to 21.5°C. Can we eliminate the second unneeded round?

To temporarily “fix” it, you can create a temperature sensor template in Home Assistant that reads the 21.3 and rounds it to 21. Then, you can change the code in your ESPHome YAML to use the second sensor that does only one round in a better way.