dzungpv / mitsubishi2MQTT

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

Fix room temperature sensor unit (F/C) reporting. #21

Closed SpencerMichaels closed 6 months ago

SpencerMichaels commented 6 months ago

haConfigTemp() unconditionally sets unit_of_meas for the room_temperature sensor to Celsius, even when configured to report temperatures in Fahrenheit — which results in reporting a temperature that is numerically in Fahrenheit but labeled as being in Celsius. If Home Assistant is also configured to default to Fahrenheit, it will do the C->F conversion a second time, displaying the wrong temperature (~160F room temperature!).

This is a one-line fix that conditionally reports the correct unit according to Mitsubishi2MQTT's useFahrenheit setting.