Refactor netatmo to use hass.data (#23429)

* Refactor NETATMO_AUTH to use hass.data

* Minor cleanup

* Rename conf to auth and other suggestions by Martin

* Revert webhook name change

* Rename constant

* Move auth

* Don't use hass.data.get()

* Fix auth string
This commit is contained in:
cgtobi authored and Martin Hjelmare committed 2019-04-26 17:15:37 +02:00
1 parent 5dbf58d67f
commit b84ba93c42
6 files changed
+44 -22

No files matched your search

+6 -2
View File
@@ -9,7 +9,8 @@ from homeassistant.components.camera import (
from homeassistant.const import CONF_VERIFY_SSL
from homeassistant.helpers import config_validation as cv
from . import CameraData, NETATMO_AUTH
from .const import DATA_NETATMO_AUTH
from . import CameraData
_LOGGER = logging.getLogger(__name__)
@@ -37,8 +38,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
verify_ssl = config.get(CONF_VERIFY_SSL, True)
quality = config.get(CONF_QUALITY, DEFAULT_QUALITY)
import pyatmo
auth = hass.data[DATA_NETATMO_AUTH]
try:
data = CameraData(hass, NETATMO_AUTH, home)
data = CameraData(hass, auth, home)
for camera_name in data.get_camera_names():
camera_type = data.get_camera_type(camera=camera_name, home=home)
if CONF_CAMERAS in config: