Migrate DenonAVR to has entity name (#98155)

pull/98532/head
Joost Lekkerkerker 2023-08-11 11:58:02 +02:00 committed by GitHub
parent c62081430b
commit 41572480fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -217,6 +217,9 @@ def async_log_errors(
class DenonDevice(MediaPlayerEntity): class DenonDevice(MediaPlayerEntity):
"""Representation of a Denon Media Player Device.""" """Representation of a Denon Media Player Device."""
_attr_has_entity_name = True
_attr_name = None
def __init__( def __init__(
self, self,
receiver: DenonAVR, receiver: DenonAVR,
@ -225,7 +228,6 @@ class DenonDevice(MediaPlayerEntity):
update_audyssey: bool, update_audyssey: bool,
) -> None: ) -> None:
"""Initialize the device.""" """Initialize the device."""
self._attr_name = receiver.name
self._attr_unique_id = unique_id self._attr_unique_id = unique_id
assert config_entry.unique_id assert config_entry.unique_id
self._attr_device_info = DeviceInfo( self._attr_device_info = DeviceInfo(
@ -234,7 +236,7 @@ class DenonDevice(MediaPlayerEntity):
identifiers={(DOMAIN, config_entry.unique_id)}, identifiers={(DOMAIN, config_entry.unique_id)},
manufacturer=config_entry.data[CONF_MANUFACTURER], manufacturer=config_entry.data[CONF_MANUFACTURER],
model=config_entry.data[CONF_MODEL], model=config_entry.data[CONF_MODEL],
name=config_entry.title, name=receiver.name,
) )
self._attr_sound_mode_list = receiver.sound_mode_list self._attr_sound_mode_list = receiver.sound_mode_list