Set Yamaha unique_id (#84730)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Anders 2022-12-29 01:00:31 +01:00 committed by GitHub
parent 72671b93d2
commit 65aaea6ec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,6 +205,11 @@ class YamahaDevice(MediaPlayerEntity):
self._play_status = None
self._name = name
self._zone = receiver.zone
if self.receiver.serial_number is not None:
# Since not all receivers will have a serial number and set a unique id
# the default name of the integration may not be changed
# to avoid a breaking change.
self._attr_unique_id = f"{self.receiver.serial_number}_{self._zone}"
def update(self) -> None:
"""Get the latest details from the device."""