Преглед изворни кода

water_heater: log original unit when invalid unit is given

Since there is some translation, ensure that the original incorrect value
is the one that is logged.
Jason Rumney пре 1 година
родитељ
комит
9e24db4de5
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3 3
      custom_components/tuya_local/water_heater.py

+ 3 - 3
custom_components/tuya_local/water_heater.py

@@ -33,9 +33,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
 
 
 def validate_temp_unit(unit):
-    unit = unit_from_ascii(unit)
+    translated_unit = unit_from_ascii(unit)
     try:
-        return UnitOfTemperature(unit)
+        return UnitOfTemperature(translated_unit)
     except ValueError:
         _LOGGER.warning("%s is not a valid temperature unit", unit)
 
@@ -95,7 +95,7 @@ class TuyaLocalWaterHeater(TuyaLocalEntity, WaterHeaterEntity):
             unit = validate_temp_unit(self._temperature_dps.unit)
             if unit is not None:
                 return unit
-        # Return the default unit from the device
+        # Return the default unit
         return UnitOfTemperature.CELSIUS
 
     @property