mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Updates pyatmo to 1.8 and adds exception handling (#20938)
* switch to pyatmo 1.7 & add exception handling * STATE_UNKNOWN => None * correct too long line * delete whitespace * remove fancy update logic
This commit is contained in:
parent
5dfaec5967
commit
1e69848af4
@ -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.4']
|
REQUIREMENTS = ['pyatmo==1.8']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ class NetAtmoSensor(Entity):
|
|||||||
self._state = None
|
self._state = None
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
if self.type == 'temperature':
|
if self.type == 'temperature':
|
||||||
self._state = round(data['Temperature'], 1)
|
self._state = round(data['Temperature'], 1)
|
||||||
elif self.type == 'humidity':
|
elif self.type == 'humidity':
|
||||||
@ -304,6 +305,11 @@ class NetAtmoSensor(Entity):
|
|||||||
self._state = "High"
|
self._state = "High"
|
||||||
elif data['wifi_status'] <= 55:
|
elif data['wifi_status'] <= 55:
|
||||||
self._state = "Full"
|
self._state = "Full"
|
||||||
|
except KeyError:
|
||||||
|
_LOGGER.error("No %s data found for %s", self.type,
|
||||||
|
self.module_name)
|
||||||
|
self._state = None
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
class NetAtmoData:
|
class NetAtmoData:
|
||||||
@ -360,10 +366,14 @@ class NetAtmoData:
|
|||||||
self.data = self.station_data.lastData(exclude=3600)
|
self.data = self.station_data.lastData(exclude=3600)
|
||||||
|
|
||||||
newinterval = 0
|
newinterval = 0
|
||||||
|
try:
|
||||||
for module in self.data:
|
for module in self.data:
|
||||||
if 'When' in self.data[module]:
|
if 'When' in self.data[module]:
|
||||||
newinterval = self.data[module]['When']
|
newinterval = self.data[module]['When']
|
||||||
break
|
break
|
||||||
|
except TypeError:
|
||||||
|
_LOGGER.error("No modules found!")
|
||||||
|
|
||||||
if newinterval:
|
if newinterval:
|
||||||
# Try and estimate when fresh data will be available
|
# Try and estimate when fresh data will be available
|
||||||
newinterval += NETATMO_UPDATE_INTERVAL - time()
|
newinterval += NETATMO_UPDATE_INTERVAL - time()
|
||||||
|
@ -930,7 +930,7 @@ pyalarmdotcom==0.3.2
|
|||||||
pyarlo==0.2.3
|
pyarlo==0.2.3
|
||||||
|
|
||||||
# homeassistant.components.netatmo
|
# homeassistant.components.netatmo
|
||||||
pyatmo==1.4
|
pyatmo==1.8
|
||||||
|
|
||||||
# homeassistant.components.apple_tv
|
# homeassistant.components.apple_tv
|
||||||
pyatv==0.3.12
|
pyatv==0.3.12
|
||||||
|
Loading…
x
Reference in New Issue
Block a user