mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Supports the new Netatmo Home Coach (#18308)
* Supports the new Netatmo Home Coach * unused import * Missing docstring * Fixed pylint * pydocs * doc style
This commit is contained in:
parent
16e3ff2fec
commit
9d1b94c24a
@ -16,7 +16,7 @@ from homeassistant.helpers import discovery
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
REQUIREMENTS = ['pyatmo==1.2']
|
REQUIREMENTS = ['pyatmo==1.3']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ def setup(hass, config):
|
|||||||
config[DOMAIN][CONF_USERNAME], config[DOMAIN][CONF_PASSWORD],
|
config[DOMAIN][CONF_USERNAME], config[DOMAIN][CONF_PASSWORD],
|
||||||
'read_station read_camera access_camera '
|
'read_station read_camera access_camera '
|
||||||
'read_thermostat write_thermostat '
|
'read_thermostat write_thermostat '
|
||||||
'read_presence access_presence')
|
'read_presence access_presence read_homecoach')
|
||||||
except HTTPError:
|
except HTTPError:
|
||||||
_LOGGER.error("Unable to connect to Netatmo API")
|
_LOGGER.error("Unable to connect to Netatmo API")
|
||||||
return False
|
return False
|
||||||
|
@ -304,6 +304,20 @@ class NetAtmoData:
|
|||||||
self.update()
|
self.update()
|
||||||
return self.data.keys()
|
return self.data.keys()
|
||||||
|
|
||||||
|
def _detect_platform_type(self):
|
||||||
|
"""Return the XXXData object corresponding to the specified platform.
|
||||||
|
|
||||||
|
The return can be a WeatherStationData or a HomeCoachData.
|
||||||
|
"""
|
||||||
|
import pyatmo
|
||||||
|
for data_class in [pyatmo.WeatherStationData, pyatmo.HomeCoachData]:
|
||||||
|
try:
|
||||||
|
station_data = data_class(self.auth)
|
||||||
|
_LOGGER.debug("%s detected!", str(data_class.__name__))
|
||||||
|
return station_data
|
||||||
|
except TypeError:
|
||||||
|
continue
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Call the Netatmo API to update the data.
|
"""Call the Netatmo API to update the data.
|
||||||
|
|
||||||
@ -316,12 +330,9 @@ class NetAtmoData:
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pyatmo
|
self.station_data = self._detect_platform_type()
|
||||||
try:
|
if not self.station_data:
|
||||||
self.station_data = pyatmo.WeatherStationData(self.auth)
|
raise Exception("No Weather nor HomeCoach devices found")
|
||||||
except TypeError:
|
|
||||||
_LOGGER.error("Failed to connect to NetAtmo")
|
|
||||||
return # finally statement will be executed
|
|
||||||
|
|
||||||
if self.station is not None:
|
if self.station is not None:
|
||||||
self.data = self.station_data.lastData(
|
self.data = self.station_data.lastData(
|
||||||
|
@ -849,7 +849,7 @@ pyalarmdotcom==0.3.2
|
|||||||
pyarlo==0.2.2
|
pyarlo==0.2.2
|
||||||
|
|
||||||
# homeassistant.components.netatmo
|
# homeassistant.components.netatmo
|
||||||
pyatmo==1.2
|
pyatmo==1.3
|
||||||
|
|
||||||
# homeassistant.components.apple_tv
|
# homeassistant.components.apple_tv
|
||||||
pyatv==0.3.10
|
pyatv==0.3.10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user