Update denonavr to `0.11.4` (#101169)

This commit is contained in:
Oliver 2023-10-01 12:26:28 +02:00 committed by GitHub
parent 9b754a58f4
commit fd1f0b0efe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 7 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.3"],
"requirements": ["denonavr==0.11.4"],
"ssdp": [
{
"manufacturer": "Denon",

View File

@ -8,7 +8,15 @@ import logging
from typing import Any, Concatenate, ParamSpec, TypeVar
from denonavr import DenonAVR
from denonavr.const import POWER_ON, STATE_OFF, STATE_ON, STATE_PAUSED, STATE_PLAYING
from denonavr.const import (
ALL_TELNET_EVENTS,
ALL_ZONES,
POWER_ON,
STATE_OFF,
STATE_ON,
STATE_PAUSED,
STATE_PLAYING,
)
from denonavr.exceptions import (
AvrCommandError,
AvrForbiddenError,
@ -73,6 +81,23 @@ SERVICE_GET_COMMAND = "get_command"
SERVICE_SET_DYNAMIC_EQ = "set_dynamic_eq"
SERVICE_UPDATE_AUDYSSEY = "update_audyssey"
# HA Telnet events
TELNET_EVENTS = {
"HD",
"MS",
"MU",
"MV",
"NS",
"NSE",
"PS",
"SI",
"SS",
"TF",
"ZM",
"Z2",
"Z3",
}
_DenonDeviceT = TypeVar("_DenonDeviceT", bound="DenonDevice")
_R = TypeVar("_R")
_P = ParamSpec("_P")
@ -254,7 +279,9 @@ class DenonDevice(MediaPlayerEntity):
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:
if zone not in (self._receiver.zone, ALL_ZONES):
return
if event not in TELNET_EVENTS:
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
@ -268,11 +295,11 @@ class DenonDevice(MediaPlayerEntity):
async def async_added_to_hass(self) -> None:
"""Register for telnet events."""
self._receiver.register_callback("ALL", self._telnet_callback)
self._receiver.register_callback(ALL_TELNET_EVENTS, self._telnet_callback)
async def async_will_remove_from_hass(self) -> None:
"""Clean up the entity."""
self._receiver.unregister_callback("ALL", self._telnet_callback)
self._receiver.unregister_callback(ALL_TELNET_EVENTS, self._telnet_callback)
@async_log_errors
async def async_update(self) -> None:

View File

@ -668,7 +668,7 @@ deluge-client==1.7.1
demetriek==0.4.0
# homeassistant.components.denonavr
denonavr==0.11.3
denonavr==0.11.4
# homeassistant.components.devolo_home_control
devolo-home-control-api==0.18.2

View File

@ -545,7 +545,7 @@ deluge-client==1.7.1
demetriek==0.4.0
# homeassistant.components.denonavr
denonavr==0.11.3
denonavr==0.11.4
# homeassistant.components.devolo_home_control
devolo-home-control-api==0.18.2