From 4e7aefa7c4b2bc3e91f6a05e8ba08c9ab95256fa Mon Sep 17 00:00:00 2001 From: stickpin <630000+stickpin@users.noreply.github.com> Date: Mon, 8 May 2023 13:12:56 +0200 Subject: [PATCH] Fix Home Assistant 2023.5.x error The fix for https://github.com/robinostlund/homeassistant-volkswagencarnet/issues/474 --- custom_components/volkswagencarnet/sensor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/volkswagencarnet/sensor.py b/custom_components/volkswagencarnet/sensor.py index 0442ccff..8df100bb 100644 --- a/custom_components/volkswagencarnet/sensor.py +++ b/custom_components/volkswagencarnet/sensor.py @@ -53,7 +53,8 @@ def _attr_native_value(self): @property def _attr_native_unit_of_measurement(self): """Return the unit of measurement.""" - return self.instrument.unit + if self.instrument.unit: + return self.instrument.unit @property def device_class(self) -> Union[SensorDeviceClass, None]: