Fix netatmo_public sensor to use netatmo authentication (#23455)

pull/23478/head
cgtobi 2019-04-27 17:18:55 +02:00 committed by Andrew Sayre
parent bdc95e76d0
commit 96fb311f6b
1 changed files with 4 additions and 2 deletions

View File

@ -12,6 +12,8 @@ from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle from homeassistant.util import Throttle
from homeassistant.components.netatmo.const import DATA_NETATMO_AUTH
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
CONF_AREAS = 'areas' CONF_AREAS = 'areas'
@ -54,12 +56,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the access to Netatmo binary sensor.""" """Set up the access to Netatmo binary sensor."""
netatmo = hass.components.netatmo auth = hass.data[DATA_NETATMO_AUTH]
sensors = [] sensors = []
areas = config.get(CONF_AREAS) areas = config.get(CONF_AREAS)
for area_conf in areas: for area_conf in areas:
data = NetatmoPublicData(netatmo.NETATMO_AUTH, data = NetatmoPublicData(auth,
lat_ne=area_conf.get(CONF_LAT_NE), lat_ne=area_conf.get(CONF_LAT_NE),
lon_ne=area_conf.get(CONF_LON_NE), lon_ne=area_conf.get(CONF_LON_NE),
lat_sw=area_conf.get(CONF_LAT_SW), lat_sw=area_conf.get(CONF_LAT_SW),