Netatmo: Hotfix for hass 0.29 ()

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>
This commit is contained in:
Hugo Dupras 2016-09-29 16:45:54 +02:00 committed by Paulus Schoutsen
parent 7d86fb8c72
commit dd551cf056
2 changed files with 11 additions and 8 deletions
homeassistant/components

View file

@ -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

View file

@ -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)