Skip to content
Snippets Groups Projects
Commit e5aad49e authored by jkerdreu's avatar jkerdreu
Browse files

Added gust

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/trunk@2006 b32b6428-25c9-4566-ad07-03861ab6144f
parent 9d70f9fc
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,11 @@ class GW:
self.devs.append(devices.thermometer(self.get_config_addr('temperature')))
self.devs.append(devices.hygrometer(self.get_config_addr('humidity')))
self.devs.append(devices.barometer(self.get_config_addr('pressure')))
self.devs.append(devices.windgauge(self.get_config_addr('wind')))
wind = devices.windgauge(self.get_config_addr('wind'))
wind.unsupported_attributes.append('gustAngle')
wind.del_attribute(wind.get_attribute('gustAngle'))
self.devs.append(wind)
# gw
gw = devices.gateway(self.get_config_addr('addr'))
gw.attributes['embedded'] = [dev.address for dev in self.devs]
......@@ -87,6 +91,7 @@ class GW:
if wind: wind = round(wind * 3600 / 1000, 1) # m/s => km/h
self.devs[3].attributes['windStrength'] = wind
self.devs[3].attributes['windAngle'] = weather.get_wind().get('deg',None)
self.devs[3].attributes['gustStrength'] = weather.get_wind().get('gust',None)
def _exit(self):
cfg = tools.load_cfg(PACKAGE_NAME)
......@@ -94,8 +99,6 @@ class GW:
logger.info('Saving configuration file')
self.cfg.write()
def init(engine):
gw = GW(engine)
return gw
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment