Skip to content

Commit 89041f5

Browse files
committed
Update example
1 parent a430535 commit 89041f5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

example.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ async def main():
1616
data = Luftdaten(155, loop, session)
1717
await data.get_data()
1818

19-
# Print the sensor values
20-
print("Sensor values:", data.values)
21-
22-
# Print the coordinates fo the sensor
23-
print("Location:", data.meta['latitude'], data.meta['longitude'])
19+
if data.values and data.meta:
20+
# Print the sensor values
21+
print("Sensor values:", data.values)
22+
23+
# Print the coordinates fo the sensor
24+
print("Location:", data.meta['latitude'], data.meta['longitude'])
25+
else:
26+
print("Station is not available:", data.sensor_id)
2427

2528

2629
loop = asyncio.get_event_loop()

0 commit comments

Comments
 (0)