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
pull/17526/head
Ben Lebherz 2018-10-16 16:41:38 +02:00 committed by Paulus Schoutsen
parent 9c52a3ce22
commit 764ea06795
1 changed files with 6 additions and 3 deletions

View File

@ -92,9 +92,12 @@ class HorizonDevice(MediaPlayerDevice):
@util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS)
def update(self):
"""Update State using the media server running on the Horizon."""
if self._client.is_powered_on():
self._state = STATE_PLAYING
else:
try:
if self._client.is_powered_on():
self._state = STATE_PLAYING
else:
self._state = STATE_OFF
except OSError:
self._state = STATE_OFF
def turn_on(self):