Skip to content

Commit a430535

Browse files
committed
Check if station is available and valid
1 parent 0b2e256 commit a430535

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

luftdaten/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def __init__(self, sensor_id, loop, session):
2323
self._loop = loop
2424
self._session = session
2525
self.sensor_id = sensor_id
26-
self.data = None
2726
self.values = {
2827
'humidity': None,
2928
'P1': None,
@@ -49,6 +48,10 @@ async def get_data(self):
4948
_LOGGER.error("Can not load data from luftdaten.info")
5049
raise exceptions.LuftdatenConnectionError()
5150

51+
if not data:
52+
self.values = self.meta = None
53+
return
54+
5255
try:
5356
sensor_data = sorted(
5457
data, key=lambda timestamp: timestamp['timestamp'],

0 commit comments

Comments
 (0)