diff --git a/homeassistant/components/sensor/netatmo.py b/homeassistant/components/sensor/netatmo.py index b8a42f3cdbf..184f9fe18a2 100644 --- a/homeassistant/components/sensor/netatmo.py +++ b/homeassistant/components/sensor/netatmo.py @@ -33,6 +33,7 @@ SENSOR_TYPES = { } CONF_SECRET_KEY = 'secret_key' +CONF_STATION = 'station' ATTR_MODULE = 'modules' # Return cached results if last scan was less then this time ago @@ -64,7 +65,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): "Please check your settings for NatAtmo API.") return False - data = NetAtmoData(authorization) + data = NetAtmoData(authorization, config.get(CONF_STATION, None)) dev = [] try: @@ -149,10 +150,11 @@ class NetAtmoSensor(Entity): class NetAtmoData(object): """Get the latest data from NetAtmo.""" - def __init__(self, auth): + def __init__(self, auth, station): """Initialize the data object.""" self.auth = auth self.data = None + self.station = station def get_module_names(self): """Return all module available on the API as a list.""" @@ -164,4 +166,8 @@ class NetAtmoData(object): """Call the NetAtmo API to update the data.""" import lnetatmo dev_list = lnetatmo.DeviceList(self.auth) - self.data = dev_list.lastData(exclude=3600) + + if self.station is not None: + self.data = dev_list.lastData(station=self.station, exclude=3600) + else: + self.data = dev_list.lastData(exclude=3600)