mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Fix unhandled exception which creates many useless logs (#17508)
* Fix unhandled exception which creates many useless logs * recover old component logic, sorry * remove inline conditional
This commit is contained in:
parent
9c52a3ce22
commit
764ea06795
@ -92,10 +92,13 @@ class HorizonDevice(MediaPlayerDevice):
|
|||||||
@util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS)
|
@util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS)
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update State using the media server running on the Horizon."""
|
"""Update State using the media server running on the Horizon."""
|
||||||
|
try:
|
||||||
if self._client.is_powered_on():
|
if self._client.is_powered_on():
|
||||||
self._state = STATE_PLAYING
|
self._state = STATE_PLAYING
|
||||||
else:
|
else:
|
||||||
self._state = STATE_OFF
|
self._state = STATE_OFF
|
||||||
|
except OSError:
|
||||||
|
self._state = STATE_OFF
|
||||||
|
|
||||||
def turn_on(self):
|
def turn_on(self):
|
||||||
"""Turn the device on."""
|
"""Turn the device on."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user