Update media state via telnet in `denonavr` integration (#89788)

pull/89940/head
Oliver 2023-03-19 11:47:01 +01:00 committed by GitHub
parent 87264d219a
commit 0441a64c69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

View File

@ -6,7 +6,7 @@
"documentation": "https://www.home-assistant.io/integrations/denonavr",
"iot_class": "local_push",
"loggers": ["denonavr"],
"requirements": ["denonavr==0.11.1"],
"requirements": ["denonavr==0.11.2"],
"ssdp": [
{
"manufacturer": "Denon",

View File

@ -249,11 +249,19 @@ class DenonDevice(MediaPlayerEntity):
self._telnet_was_healthy: bool | None = None
async def _telnet_callback(self, zone, event, parameter):
async def _telnet_callback(self, zone, event, parameter) -> None:
"""Process a telnet command callback."""
# There are multiple checks implemented which reduce unnecessary updates of the ha state machine
if zone != self._receiver.zone:
return
# Some updates trigger multiple events like one for artist and one for title for one change
# We skip every event except the last one
if event == "NS" and not parameter.startswith("E4"):
return
if event == "TA" and not parameter.startwith("ANNAME"):
return
if event == "HD" and not parameter.startswith("ALBUM"):
return
self.async_write_ha_state()
async def async_added_to_hass(self) -> None:
@ -276,7 +284,6 @@ class DenonDevice(MediaPlayerEntity):
if (
telnet_is_healthy := receiver.telnet_connected and receiver.telnet_healthy
) and self._telnet_was_healthy:
await receiver.input.async_update_media_state()
return
# if async_update raises an exception, we don't want to skip the next update

View File

@ -586,7 +586,7 @@ deluge-client==1.7.1
demetriek==0.4.0
# homeassistant.components.denonavr
denonavr==0.11.1
denonavr==0.11.2
# homeassistant.components.devolo_home_control
devolo-home-control-api==0.18.2

View File

@ -466,7 +466,7 @@ deluge-client==1.7.1
demetriek==0.4.0
# homeassistant.components.denonavr
denonavr==0.11.1
denonavr==0.11.2
# homeassistant.components.devolo_home_control
devolo-home-control-api==0.18.2