From 1cae4456895dbba798667519ca32534884ee94ce Mon Sep 17 00:00:00 2001 From: Charles Garwood Date: Tue, 28 Dec 2021 08:51:16 -0500 Subject: [PATCH] Tweak sensor state to handle missing attributes (#76) --- custom_components/fullykiosk/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/fullykiosk/sensor.py b/custom_components/fullykiosk/sensor.py index d87ed07..ccb84dc 100644 --- a/custom_components/fullykiosk/sensor.py +++ b/custom_components/fullykiosk/sensor.py @@ -110,7 +110,7 @@ def state(self): if self._sensor in STORAGE_SENSORS: return round(self.coordinator.data[self._sensor] * 0.000001, 1) - return self.coordinator.data[self._sensor] + return self.coordinator.data.get(self._sensor) async def async_added_to_hass(self): """Connect to dispatcher listening for entity data notifications."""