mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
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:
parent
53048f71a0
commit
ce67be2fff
@ -71,7 +71,7 @@ class TradfriGroup(Light):
|
|||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
"""Instruct the group lights to turn off."""
|
"""Instruct the group lights to turn off."""
|
||||||
return self._group.set_state(0)
|
self._group.set_state(0)
|
||||||
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Instruct the group lights to turn on, or dim."""
|
"""Instruct the group lights to turn on, or dim."""
|
||||||
@ -82,7 +82,11 @@ class TradfriGroup(Light):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Fetch new state data for this group."""
|
"""Fetch new state data for this group."""
|
||||||
|
from pytradfri import RequestTimeout
|
||||||
|
try:
|
||||||
self._group.update()
|
self._group.update()
|
||||||
|
except RequestTimeout:
|
||||||
|
_LOGGER.warning("Tradfri update request timed out")
|
||||||
|
|
||||||
|
|
||||||
class Tradfri(Light):
|
class Tradfri(Light):
|
||||||
@ -153,7 +157,7 @@ class Tradfri(Light):
|
|||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
"""Instruct the light to turn off."""
|
"""Instruct the light to turn off."""
|
||||||
return self._light_control.set_state(False)
|
self._light_control.set_state(False)
|
||||||
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
@ -181,7 +185,11 @@ class Tradfri(Light):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Fetch new state data for this light."""
|
"""Fetch new state data for this light."""
|
||||||
|
from pytradfri import RequestTimeout
|
||||||
|
try:
|
||||||
self._light.update()
|
self._light.update()
|
||||||
|
except RequestTimeout:
|
||||||
|
_LOGGER.warning("Tradfri update request timed out")
|
||||||
|
|
||||||
# Handle Hue lights paired with the gateway
|
# Handle Hue lights paired with the gateway
|
||||||
# hex_color is 0 when bulb is unreachable
|
# hex_color is 0 when bulb is unreachable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user