def setup_platform(hass, config, add_devices, discovery_info=None): """Setup access to Netatmo binary sensor.""" netatmo = get_component('netatmo') home = config.get(CONF_HOME, None) timeout = config.get(CONF_TIMEOUT, 15) import lnetatmo try: data = WelcomeData(netatmo.NETATMO_AUTH, home) if data.get_camera_names() == []: return None except lnetatmo.NoDevice: return None sensors = config.get(CONF_MONITORED_CONDITIONS, SENSOR_TYPES) for camera_name in data.get_camera_names(): if CONF_CAMERAS in config: if config[CONF_CAMERAS] != [] and \ camera_name not in config[CONF_CAMERAS]: continue for variable in sensors: add_devices([ WelcomeBinarySensor(data, camera_name, home, timeout, variable) ])
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) import lnetatmo try: data = WelcomeData(netatmo.NETATMO_AUTH, home) for camera_name in data.get_camera_names(): if CONF_CAMERAS in config: if config[CONF_CAMERAS] != [] and \ camera_name not in config[CONF_CAMERAS]: continue add_devices([WelcomeCamera(data, camera_name, home)]) except lnetatmo.NoDevice: return None