mirror of https://github.com/home-assistant/core
Address late review comments for denonavr (#49666)
* denonavr: Add DynamicEQ and Audyssey service * Remove useless return and entry.option in hass.data * Remove duplicate translation
This commit is contained in:
parent
940d28960b
commit
1b14a2f54f
|
@ -11,12 +11,10 @@ from homeassistant.helpers.httpx_client import get_async_client
|
||||||
|
|
||||||
from .config_flow import (
|
from .config_flow import (
|
||||||
CONF_SHOW_ALL_SOURCES,
|
CONF_SHOW_ALL_SOURCES,
|
||||||
CONF_UPDATE_AUDYSSEY,
|
|
||||||
CONF_ZONE2,
|
CONF_ZONE2,
|
||||||
CONF_ZONE3,
|
CONF_ZONE3,
|
||||||
DEFAULT_SHOW_SOURCES,
|
DEFAULT_SHOW_SOURCES,
|
||||||
DEFAULT_TIMEOUT,
|
DEFAULT_TIMEOUT,
|
||||||
DEFAULT_UPDATE_AUDYSSEY,
|
|
||||||
DEFAULT_ZONE2,
|
DEFAULT_ZONE2,
|
||||||
DEFAULT_ZONE3,
|
DEFAULT_ZONE3,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
@ -55,9 +53,6 @@ async def async_setup_entry(
|
||||||
|
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
CONF_RECEIVER: receiver,
|
CONF_RECEIVER: receiver,
|
||||||
CONF_UPDATE_AUDYSSEY: entry.options.get(
|
|
||||||
CONF_UPDATE_AUDYSSEY, DEFAULT_UPDATE_AUDYSSEY
|
|
||||||
),
|
|
||||||
UNDO_UPDATE_LISTENER: undo_listener,
|
UNDO_UPDATE_LISTENER: undo_listener,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,9 @@ async def async_setup_entry(
|
||||||
entities = []
|
entities = []
|
||||||
data = hass.data[DOMAIN][config_entry.entry_id]
|
data = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
receiver = data[CONF_RECEIVER]
|
receiver = data[CONF_RECEIVER]
|
||||||
update_audyssey = data.get(CONF_UPDATE_AUDYSSEY, DEFAULT_UPDATE_AUDYSSEY)
|
update_audyssey = config_entry.options.get(
|
||||||
|
CONF_UPDATE_AUDYSSEY, DEFAULT_UPDATE_AUDYSSEY
|
||||||
|
)
|
||||||
for receiver_zone in receiver.zones.values():
|
for receiver_zone in receiver.zones.values():
|
||||||
if config_entry.data[CONF_SERIAL_NUMBER] is not None:
|
if config_entry.data[CONF_SERIAL_NUMBER] is not None:
|
||||||
unique_id = f"{config_entry.unique_id}-{receiver_zone.zone}"
|
unique_id = f"{config_entry.unique_id}-{receiver_zone.zone}"
|
||||||
|
@ -482,13 +484,12 @@ class DenonDevice(MediaPlayerEntity):
|
||||||
async def async_set_dynamic_eq(self, dynamic_eq: bool):
|
async def async_set_dynamic_eq(self, dynamic_eq: bool):
|
||||||
"""Turn DynamicEQ on or off."""
|
"""Turn DynamicEQ on or off."""
|
||||||
if dynamic_eq:
|
if dynamic_eq:
|
||||||
result = await self._receiver.async_dynamic_eq_on()
|
await self._receiver.async_dynamic_eq_on()
|
||||||
else:
|
else:
|
||||||
result = await self._receiver.async_dynamic_eq_off()
|
await self._receiver.async_dynamic_eq_off()
|
||||||
|
|
||||||
if self._update_audyssey:
|
if self._update_audyssey:
|
||||||
await self._receiver.async_update_audyssey()
|
await self._receiver.async_update_audyssey()
|
||||||
return result
|
|
||||||
|
|
||||||
# Decorator defined before is a staticmethod
|
# Decorator defined before is a staticmethod
|
||||||
async_log_errors = staticmethod( # pylint: disable=no-staticmethod-decorator
|
async_log_errors = staticmethod( # pylint: disable=no-staticmethod-decorator
|
||||||
|
|
Loading…
Reference in New Issue