Fix Freebox call sensor when no call in history (#40001)

pull/40179/head
Quentame 2020-09-13 01:13:57 +02:00 committed by Bram Kragten
parent b9b76b3519
commit 951c373110
1 changed files with 6 additions and 5 deletions

View File

@ -146,11 +146,12 @@ class FreeboxCallSensor(FreeboxSensor):
def async_update_state(self) -> None:
"""Update the Freebox call sensor."""
self._call_list_for_type = []
for call in self._router.call_list:
if not call["new"]:
continue
if call["type"] == self._sensor_type:
self._call_list_for_type.append(call)
if self._router.call_list:
for call in self._router.call_list:
if not call["new"]:
continue
if call["type"] == self._sensor_type:
self._call_list_for_type.append(call)
self._state = len(self._call_list_for_type)