dzungpv / mitsubishi2MQTT

Mitsubishi to MQTT with ESP8266/ESP32 module
GNU General Public License v3.0
68 stars 13 forks source link

When setting WebUI to Fahrenheit, HA Temp sensor still converts from C to F #25

Open TheRykin opened 5 months ago

TheRykin commented 5 months ago

In the WebUI, if you set the temperature units to Fahrenheit, it will cause an incorrect reporting in Home Assistant if HA is also set to use Fahrenheit. The temperature sensor mistakenly converts from C to F, regardless of what the WebUI is set to. So when I changed the WebUI to use F, Home Assistant reported that the mini split was at 159F. (The HVAC entity reported the right temperature. It was the separate room temperature sensor that had the wrong temp)

Since HA automatically converts C to F, the sensor works fine when the WebUI is left at Celsius. This isn't much of a deal breaker since I mostly control my mini splits using Home Assistant, but wanted to mention it as I'm sure it's an easy fix.

dzungpv commented 2 months ago

In the WebUI, if you set the temperature units to Fahrenheit, it will cause an incorrect reporting in Home Assistant if HA is also set to use Fahrenheit. The temperature sensor mistakenly converts from C to F, regardless of what the WebUI is set to. So when I changed the WebUI to use F, Home Assistant reported that the mini split was at 159F. (The HVAC entity reported the right temperature. It was the separate room temperature sensor that had the wrong temp)

Since HA automatically converts C to F, the sensor works fine when the WebUI is left at Celsius. This isn't much of a deal breaker since I mostly control my mini splits using Home Assistant, but wanted to mention it as I'm sure it's an easy fix.

This is HA bug, I get the value for sensor from the data serve to MQTT Climate room temperature component. When you change the unit in the web UI, the data still report correctly in the HA, and it is not convert automatically, it set in code https://github.com/dzungpv/mitsubishi2MQTT/blob/893483d4c24ad2a0e27b6c795bbd083f3cb5eee9/main/main.cpp#L2678 https://www.home-assistant.io/integrations/climate.mqtt/#temperature_unit

You can check mqtt data send to HA, it report correctly the temperature when I change webui unit to F:

{"roomTemperature":91,"temperature":82,"compressorFreq":3,"fan":"auto","vane":"AUTO","wideVane":"SWING","mode":"cool","action":"cooling","compressorFrequency":3,"upTime":"00:00:27:05"}

You can manual change the unit of room temperature sensor to F will solve the issue.