From bd6a96348f0114f38e2b1bafc5832376a25d2523 Mon Sep 17 00:00:00 2001 From: Stephan Uhle Date: Sat, 9 Jul 2022 20:08:48 +0000 Subject: [PATCH] Fixed unit of measurement. #70121 --- homeassistant/components/edl21/sensor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/edl21/sensor.py b/homeassistant/components/edl21/sensor.py index f7a79d727a0b88..65603b0c8c45aa 100644 --- a/homeassistant/components/edl21/sensor.py +++ b/homeassistant/components/edl21/sensor.py @@ -17,6 +17,7 @@ ) from homeassistant.const import ( CONF_NAME, + DEGREE, ELECTRIC_CURRENT_AMPERE, ELECTRIC_POTENTIAL_VOLT, ENERGY_KILO_WATT_HOUR, @@ -250,6 +251,7 @@ "W": POWER_WATT, "A": ELECTRIC_CURRENT_AMPERE, "V": ELECTRIC_POTENTIAL_VOLT, + "°": DEGREE, } @@ -449,7 +451,7 @@ def extra_state_attributes(self): @property def native_unit_of_measurement(self): """Return the unit of measurement.""" - if (unit := self._telegram.get("unit")) is None: + if (unit := self._telegram.get("unit")) is None or unit == 0: return None return SENSOR_UNIT_MAPPING[unit]