Add `configuration_url` to Denon AVR integration (#58116)

pull/58138/head
Maciej Bieniek 2021-10-21 00:34:42 +02:00 committed by GitHub
parent 47678c5995
commit 18ce799f74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 38 deletions

View File

@ -35,9 +35,10 @@ from homeassistant.components.media_player.const import (
SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP,
)
from homeassistant.const import ATTR_COMMAND, STATE_PAUSED, STATE_PLAYING
from homeassistant.const import ATTR_COMMAND, CONF_HOST, STATE_PAUSED, STATE_PLAYING
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.entity import DeviceInfo
from . import CONF_RECEIVER
from .config_flow import (
@ -144,9 +145,19 @@ class DenonDevice(MediaPlayerEntity):
update_audyssey: bool,
) -> None:
"""Initialize the device."""
self._attr_name = receiver.name
self._attr_unique_id = unique_id
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, config_entry.unique_id)},
manufacturer=config_entry.data[CONF_MANUFACTURER],
name=config_entry.title,
model=f"{config_entry.data[CONF_MODEL]}-{config_entry.data[CONF_TYPE]}",
configuration_url=f"http://{config_entry.data[CONF_HOST]}/",
)
self._attr_sound_mode_list = receiver.sound_mode_list
self._attr_source_list = receiver.input_func_list
self._receiver = receiver
self._unique_id = unique_id
self._config_entry = config_entry
self._update_audyssey = update_audyssey
self._supported_features_base = SUPPORT_DENON
@ -230,31 +241,6 @@ class DenonDevice(MediaPlayerEntity):
"""Return True if entity is available."""
return self._available
@property
def unique_id(self):
"""Return the unique id of the zone."""
return self._unique_id
@property
def device_info(self):
"""Return the device info of the receiver."""
if self._config_entry.data[CONF_SERIAL_NUMBER] is None:
return None
device_info = {
"identifiers": {(DOMAIN, self._config_entry.unique_id)},
"manufacturer": self._config_entry.data[CONF_MANUFACTURER],
"name": self._config_entry.title,
"model": f"{self._config_entry.data[CONF_MODEL]}-{self._config_entry.data[CONF_TYPE]}",
}
return device_info
@property
def name(self):
"""Return the name of the device."""
return self._receiver.name
@property
def state(self):
"""Return the state of the device."""
@ -279,21 +265,11 @@ class DenonDevice(MediaPlayerEntity):
"""Return the current input source."""
return self._receiver.input_func
@property
def source_list(self):
"""Return a list of available input sources."""
return self._receiver.input_func_list
@property
def sound_mode(self):
"""Return the current matched sound mode."""
return self._receiver.sound_mode
@property
def sound_mode_list(self):
"""Return a list of available sound modes."""
return self._receiver.sound_mode_list
@property
def supported_features(self):
"""Flag media player features that are supported."""