From ff40afde70816197bb3af5e845759960d19ae835 Mon Sep 17 00:00:00 2001 From: Tobias Perschon Date: Sat, 8 Oct 2022 11:59:53 +0200 Subject: [PATCH] fix sensor startup Signed-off-by: Tobias Perschon --- custom_components/wienerlinien/sensor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/wienerlinien/sensor.py b/custom_components/wienerlinien/sensor.py index 7ada209..2a156ec 100644 --- a/custom_components/wienerlinien/sensor.py +++ b/custom_components/wienerlinien/sensor.py @@ -105,7 +105,10 @@ def name(self): @property def state(self): """Return state.""" - return f"{self._state[:-2]}:{self._state[26:]}" + if self._state is None: + return self._state + else: + return f"{self._state[:-2]}:{self._state[26:]}" @property def icon(self):