From dd7738e347e75f91d91e7d987ff91b095662e84b Mon Sep 17 00:00:00 2001 From: Dimitar Kukov <seriosbg@gmail.com> Date: Mon, 5 Aug 2019 12:57:26 +0300 Subject: [PATCH] Fix in code logic --- custom_components/varna_public_transport/sensor.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/custom_components/varna_public_transport/sensor.py b/custom_components/varna_public_transport/sensor.py index 3962585..3a51a2c 100644 --- a/custom_components/varna_public_transport/sensor.py +++ b/custom_components/varna_public_transport/sensor.py @@ -161,6 +161,9 @@ def device_state_attributes(self): attr['lines'] = lines_count i += 1 + else: + attr['stop_lines'] = {} + attr['lines'] = 0 if self._mode == 'schedule' or self._mode == 'all': @@ -201,6 +204,9 @@ def device_state_attributes(self): attr['lines_schedules'] = schedules_lines_count i += 1 + else: + attr['stop_lines_schedules'] = {} + attr['lines_schedules'] = 0 _LOGGER.debug(attr) return attr