File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""
2- Copyright (c) 2017 Fabian Affolter <fabian@affolter-engineering.ch>
2+ Copyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>
33
44Licensed under MIT. All rights reserved.
55"""
1212@asyncio .coroutine
1313def main ():
1414 with aiohttp .ClientSession () as session :
15- data = Luftdaten (2154 , loop , session )
15+ data = Luftdaten (155 , loop , session )
1616 yield from data .async_get_data ()
1717
1818 # Print the sensor values
Original file line number Diff line number Diff line change 11"""
2- Copyright (c) 2017 Fabian Affolter <fabian@affolter-engineering.ch>
2+ Copyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>
33
44Licensed under MIT. All rights reserved.
55"""
@@ -63,8 +63,12 @@ def async_get_data(self):
6363 _LOGGER .error ("Can not load data from luftdaten.info" )
6464 raise exceptions .LuftdatenConnectionError ()
6565
66+ print (data )
6667 try :
67- sensor_data = sorted (data , key = lambda timestamp : timestamp ['timestamp' ], reverse = True )[0 ]
68+ sensor_data = sorted (
69+ data , key = lambda timestamp : timestamp ['timestamp' ],
70+ reverse = True )[0 ]
71+ print (sensor_data )
6872 for entry in sensor_data ['sensordatavalues' ]:
6973 for measurement in self .values .keys ():
7074 if measurement == entry ['value_type' ]:
Original file line number Diff line number Diff line change 11"""
2- Copyright (c) 2017 Fabian Affolter <fabian@affolter-engineering.ch>
2+ Copyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>
33
44Licensed under MIT. All rights reserved.
55"""
@@ -15,3 +15,9 @@ class LuftdatenConnectionError(LuftdatenError):
1515 """When a connection error is encountered."""
1616
1717 pass
18+
19+
20+ class LuftdatenNoDataAvailable (LuftdatenError ):
21+ """When no data is available."""
22+
23+ pass
Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
2+ """
3+ Copyright (c) 2017-2018 Fabian Affolter <fabian@affolter-engineering.ch>
24
5+ Licensed under MIT. All rights reserved.
6+ """
37import os
48import sys
59
2125 author = 'Fabian Affolter' ,
2226 author_email = 'fabian@affolter-engineering.ch' ,
2327 license = 'MIT' ,
24- install_requires = ['aiohttp' ],
28+ install_requires = ['aiohttp' , 'async_timeout' ],
2529 packages = ['luftdaten' ],
2630 zip_safe = True ,
2731 classifiers = [
You can’t perform that action at this time.
0 commit comments