From 966fa6a2b89bd80d9df67b15ce9c2fddf61a6bd5 Mon Sep 17 00:00:00 2001 From: Werner Pieterson Date: Sun, 31 Dec 2023 17:25:26 +0200 Subject: [PATCH] Update sensor.py Fix issue #87 when there is no planned load shedding. --- custom_components/load_shedding/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/load_shedding/sensor.py b/custom_components/load_shedding/sensor.py index 9a1ebf3..e7e0ff0 100644 --- a/custom_components/load_shedding/sensor.py +++ b/custom_components/load_shedding/sensor.py @@ -133,7 +133,7 @@ def native_value(self) -> StateType: planned = self.data.get(ATTR_PLANNED, []) if not planned: - return self._attr_native_value + return Stage.NO_LOAD_SHEDDING stage = planned[0].get(ATTR_STAGE, Stage.UNKNOWN) if stage in [Stage.UNKNOWN]: