File tree Expand file tree Collapse file tree 1 file changed +11
-14
lines changed
Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Original file line number Diff line number Diff line change 11"""Example for getting the data from a station."""
22import asyncio
33
4- import aiohttp
5-
64from luftdaten import Luftdaten
75
8- SENSOR_ID = 155
6+ SENSOR_ID = 152
97
108
119async def main ():
1210 """Sample code to retrieve the data."""
13- async with aiohttp .ClientSession () as session :
14- data = Luftdaten (SENSOR_ID , loop , session )
15- await data .get_data ()
11+ data = Luftdaten (SENSOR_ID )
12+ await data .get_data ()
1613
17- if not await data .validate_sensor ():
18- print ("Station is not available:" , data .sensor_id )
19- return
14+ if not await data .validate_sensor ():
15+ print ("Station is not available:" , data .sensor_id )
16+ return
2017
21- if data .values and data .meta :
22- # Print the sensor values
23- print ("Sensor values:" , data .values )
18+ if data .values and data .meta :
19+ # Print the sensor values
20+ print ("Sensor values:" , data .values )
2421
25- # Print the coordinates fo the sensor
26- print ("Location:" , data .meta [' latitude' ], data .meta [' longitude' ])
22+ # Print the coordinates fo the sensor
23+ print ("Location:" , data .meta [" latitude" ], data .meta [" longitude" ])
2724
2825
2926loop = asyncio .get_event_loop ()
You can’t perform that action at this time.
0 commit comments