44# 2014-01 : philippelt@users.sourceforge.net
55
66# Just connect to a Netatmo account, and print all last informations available for
7- # station and modules of the user account
7+ # station(s) and modules of the user account
88# (except if module data is more than one hour old that usually means module lost
99# wether out of radio range or battery exhausted thus information is no longer
1010# significant)
@@ -20,19 +20,24 @@ user = weather.user
2020print ("Station owner : " , user .mail )
2121print ("Data units : " , user .unit )
2222
23- print ()
23+ # For each station in the account
24+ for station in weather .stations :
2425
25- # For each available module in the returned data that should not be older than one hour (3600 s) from now
26- for module , moduleData in weather .lastData (exclude = 3600 ).items () :
27-
28- # Name of the module (or station embedded module), the name you defined in the web netatmo account station management
29- print (module )
30-
31- # List key/values pair of sensor information (eg Humidity, Temperature, etc...)
32- for sensor , value in moduleData .items () :
33- # To ease reading, print measurement event in readable text (hh:mm:ss)
34- if sensor == "When" : value = time .strftime ("%H:%M:%S" ,time .localtime (value ))
35- print ("%30s : %s" % (sensor , value ))
26+ print ("\n STATION : %s\n " % weather .stations [station ]["station_name" ])
27+
28+ # For each available module in the returned data of the specified station
29+ # that should not be older than one hour (3600 s) from now
30+ for module , moduleData in weather .lastData (station = station , exclude = 3600 ).items () :
31+
32+ # Name of the module (or station embedded module)
33+ # You setup this name in the web netatmo account station management
34+ print (module )
35+
36+ # List key/values pair of sensor information (eg Humidity, Temperature, etc...)
37+ for sensor , value in moduleData .items () :
38+ # To ease reading, print measurement event in readable text (hh:mm:ss)
39+ if sensor == "When" : value = time .strftime ("%H:%M:%S" ,time .localtime (value ))
40+ print ("%30s : %s" % (sensor , value ))
3641
3742
3843# OUTPUT SAMPLE :
@@ -43,6 +48,8 @@ for module, moduleData in weather.lastData(exclude=3600).items() :
4348#Data units : metric
4449#
4550#
51+ #STATION : TEST-STATION-1
52+ #
4653#Office
4754# AbsolutePressure : 988.7
4855# CO2 : 726
0 commit comments