Fix tradfri error spam (#8738)

* Catch tradfri timout exception

* Remove not needed return statement

* Remove test logging

* Log warning instead of error
This commit is contained in:
Martin Hjelmare 2017-07-31 17:58:47 +02:00 committed by Paulus Schoutsen
parent 53048f71a0
commit ce67be2fff

View File

@ -71,7 +71,7 @@ class TradfriGroup(Light):
def turn_off(self, **kwargs):
"""Instruct the group lights to turn off."""
return self._group.set_state(0)
self._group.set_state(0)
def turn_on(self, **kwargs):
"""Instruct the group lights to turn on, or dim."""
@ -82,7 +82,11 @@ class TradfriGroup(Light):
def update(self):
"""Fetch new state data for this group."""
from pytradfri import RequestTimeout
try:
self._group.update()
except RequestTimeout:
_LOGGER.warning("Tradfri update request timed out")
class Tradfri(Light):
@ -153,7 +157,7 @@ class Tradfri(Light):
def turn_off(self, **kwargs):
"""Instruct the light to turn off."""
return self._light_control.set_state(False)
self._light_control.set_state(False)
def turn_on(self, **kwargs):
"""
@ -181,7 +185,11 @@ class Tradfri(Light):
def update(self):
"""Fetch new state data for this light."""
from pytradfri import RequestTimeout
try:
self._light.update()
except RequestTimeout:
_LOGGER.warning("Tradfri update request timed out")
# Handle Hue lights paired with the gateway
# hex_color is 0 when bulb is unreachable