From dd551cf056ec3743d62220f9eca569f177506d18 Mon Sep 17 00:00:00 2001 From: Hugo Dupras Date: Thu, 29 Sep 2016 16:45:54 +0200 Subject: [PATCH] Netatmo: Hotfix for hass 0.29 (#3576) Signed-off-by: Hugo D. (jabesq) --- homeassistant/components/camera/netatmo.py | 10 +++++++--- homeassistant/components/sensor/netatmo.py | 9 ++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/camera/netatmo.py b/homeassistant/components/camera/netatmo.py index 457c63d1ad7..9069a5c6c28 100644 --- a/homeassistant/components/camera/netatmo.py +++ b/homeassistant/components/camera/netatmo.py @@ -36,10 +36,14 @@ def setup_platform(hass, config, add_devices, discovery_info=None): """Setup access to Netatmo Welcome cameras.""" netatmo = get_component('netatmo') home = config.get(CONF_HOME) - data = WelcomeData(netatmo.NETATMO_AUTH, home) + import lnetatmo + try: + data = WelcomeData(netatmo.NETATMO_AUTH, home) + except lnetatmo.NoDevice: + return None for camera_name in data.get_camera_names(): - if CONF_CAMERAS in config: + if config[CONF_CAMERAS] != []: if camera_name not in config[CONF_CAMERAS]: continue add_devices([WelcomeCamera(data, camera_name, home)]) @@ -49,7 +53,7 @@ class WelcomeCamera(Camera): """Representation of the images published from Welcome camera.""" def __init__(self, data, camera_name, home): - """Setup for access to the BloomSky camera images.""" + """Setup for access to the Netatmo camera images.""" super(WelcomeCamera, self).__init__() self._data = data self._camera_name = camera_name diff --git a/homeassistant/components/sensor/netatmo.py b/homeassistant/components/sensor/netatmo.py index c3588e24853..be8f2e7d76d 100644 --- a/homeassistant/components/sensor/netatmo.py +++ b/homeassistant/components/sensor/netatmo.py @@ -21,7 +21,6 @@ _LOGGER = logging.getLogger(__name__) ATTR_MODULE = 'modules' CONF_MODULES = 'modules' -CONF_MODULE_NAME = 'module_name' CONF_STATION = 'station' DEPENDENCIES = ['netatmo'] @@ -50,7 +49,7 @@ SENSOR_TYPES = { } MODULE_SCHEMA = vol.Schema({ - vol.Required(CONF_MODULE_NAME, default=[]): + vol.Required(cv.string, default=[]): vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]), }) @@ -84,11 +83,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None): # pylint: disable=too-few-public-methods class NetAtmoSensor(Entity): - """Implementation of a NetAtmo sensor.""" + """Implementation of a Netatmo sensor.""" def __init__(self, netatmo_data, module_name, sensor_type): """Initialize the sensor.""" - self._name = 'NetAtmo {} {}'.format(module_name, + self._name = 'Netatmo {} {}'.format(module_name, SENSOR_TYPES[sensor_type][0]) self.netatmo_data = netatmo_data self.module_name = module_name @@ -232,7 +231,7 @@ class NetAtmoData(object): @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): - """Call the NetAtmo API to update the data.""" + """Call the Netatmo API to update the data.""" import lnetatmo dev_list = lnetatmo.DeviceList(self.auth)