Point lnetatmo library directly from github

This commit is contained in:
hydreliox 2016-01-08 05:34:51 +01:00
parent a8b36d9baa
commit 1ed574b2a0

View File

@ -7,14 +7,16 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/... https://home-assistant.io/components/...
""" """
import logging import logging
from homeassistant.components.sensor import lnetatmo
from datetime import timedelta from datetime import timedelta
from homeassistant.const import (CONF_API_KEY, CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS, TEMP_FAHRENHEIT) from homeassistant.const import (CONF_API_KEY, CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS, TEMP_FAHRENHEIT)
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle from homeassistant.util import Throttle
REQUIREMENTS = [] REQUIREMENTS = [
'https://github.com/HydrelioxGitHub/netatmo-api-python/archive/'
'f468d0926b1bc018df66896f5d67585343b56dda.zip']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
SENSOR_TYPES = { SENSOR_TYPES = {
'temperature': ['Temperature', ''], 'temperature': ['Temperature', ''],
@ -30,7 +32,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
""" Get the NetAtmo sensor. """ """ Get the NetAtmo sensor. """
try: try:
from homeassistant.components.sensor import lnetatmo from lnetatmo import lnetatmo
except ImportError: except ImportError:
_LOGGER.exception( _LOGGER.exception(
@ -136,11 +138,13 @@ class NetAtmoData(object):
""" Gets the latest data from NetAtmo. """ """ Gets the latest data from NetAtmo. """
def __init__(self, auth): def __init__(self, auth):
from lnetatmo import DeviceList
self.auth = auth self.auth = auth
self.data = None self.data = None
@Throttle(MIN_TIME_BETWEEN_UPDATES) @Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self): def update(self):
""" Gets the latest data from NetAtmo. """ """ Gets the latest data from NetAtmo. """
devList = lnetatmo.DeviceList(self.auth) devList = DeviceList(self.auth)
self.data = devList.lastData(exclude=3600) self.data = devList.lastData(exclude=3600)