Jelajahi Sumber

Temperature unit: return strings from unit_from_ascii

This helper function is just for translating simple ASCII into more
complex Unicode units (C to °C, m3 to m³ etc) to make editing files
easier.

Now that HA converted most of the unit constants into Enum's, they are
converting to instances of enums, which might no work in some cases.

Issue #1855

Unit tests appear to have coverage of this, and were not deteecting
any issues, but this is the only possiblity I can see for the issue
not being resolved.
Jason Rumney 2 tahun lalu
induk
melakukan
d6634c4972
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      custom_components/tuya_local/helpers/mixin.py

+ 2 - 2
custom_components/tuya_local/helpers/mixin.py

@@ -121,8 +121,8 @@ class TuyaLocalEntity:
 
 
 UNIT_ASCII_MAP = {
-    "C": UnitOfTemperature.CELSIUS,
-    "F": UnitOfTemperature.FAHRENHEIT,
+    "C": UnitOfTemperature.CELSIUS.value,
+    "F": UnitOfTemperature.FAHRENHEIT.value,
     "ugm3": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
     "m2": AREA_SQUARE_METERS,
 }