@@ -34,9 +34,11 @@ def __init__(self, auth: NetatmoOAuth2, url_req: str = None) -> None:
3434
3535 try :
3636 self .raw_data = fix_id (resp ["body" ].get ("devices" ))
37- except KeyError :
37+ except KeyError as exc :
3838 LOG .debug ("No <body> in response %s" , resp )
39- raise NoDevice ("No weather station data returned by Netatmo server" )
39+ raise NoDevice (
40+ "No weather station data returned by Netatmo server"
41+ ) from exc
4042
4143 if not self .raw_data :
4244 raise NoDevice ("No weather station available" )
@@ -84,15 +86,17 @@ def get_modules(self, station_id: str) -> Dict:
8486
8587 res = {}
8688 for station in [self .stations [station_data ["_id" ]]]:
89+ station_type = station .get ("type" )
90+ station_name = station .get ("station_name" , station_type )
8791 res [station ["_id" ]] = {
88- "station_name" : station [ " station_name" ] ,
89- "module_name" : station .get ("module_name" , station . get ( "type" ) ),
92+ "station_name" : station_name ,
93+ "module_name" : station .get ("module_name" , station_type ),
9094 "id" : station ["_id" ],
9195 }
9296
9397 for module in station ["modules" ]:
9498 res [module ["_id" ]] = {
95- "station_name" : module .get ("station_name" , station [ " station_name" ] ),
99+ "station_name" : module .get ("station_name" , station_name ),
96100 "module_name" : module .get ("module_name" , module .get ("type" )),
97101 "id" : module ["_id" ],
98102 }
@@ -141,6 +145,12 @@ def get_monitored_conditions(self, module_id: str) -> List:
141145 if module ["type" ] in ["NAMain" , "NAModule1" , "NAModule4" , "NHC" ]:
142146 conditions .extend (["min_temp" , "max_temp" ])
143147
148+ if module ["type" ] in ["NAMain" , "NAModule1" , "NAModule4" ]:
149+ conditions .extend (["temp_trend" ])
150+
151+ if module ["type" ] == "NAMain" :
152+ conditions .extend (["pressure_trend" ])
153+
144154 if module ["type" ] in [
145155 "NAMain" ,
146156 "NAModule1" ,
0 commit comments