Log SamsungTV state changes (#71989)

This commit is contained in:
epenet 2022-05-23 17:48:41 +02:00 committed by GitHub
parent c10d456d11
commit 7da9cac1f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -197,12 +197,15 @@ class SamsungTVDevice(MediaPlayerEntity):
"""Update state of device.""" """Update state of device."""
if self._auth_failed or self.hass.is_stopping: if self._auth_failed or self.hass.is_stopping:
return return
old_state = self._attr_state
if self._power_off_in_progress(): if self._power_off_in_progress():
self._attr_state = STATE_OFF self._attr_state = STATE_OFF
else: else:
self._attr_state = ( self._attr_state = (
STATE_ON if await self._bridge.async_is_on() else STATE_OFF STATE_ON if await self._bridge.async_is_on() else STATE_OFF
) )
if self._attr_state != old_state:
LOGGER.debug("TV %s state updated to %s", self._host, self._attr_state)
if self._attr_state != STATE_ON: if self._attr_state != STATE_ON:
if self._dmr_device and self._dmr_device.is_subscribed: if self._dmr_device and self._dmr_device.is_subscribed: