Append name char value from the service to HomeKit Controller Entities (#74359)

This commit is contained in:
J. Nick Koston 2022-07-03 15:47:54 -05:00 committed by GitHub
parent 737a1fd9fa
commit 30a5df5895
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 662 additions and 145 deletions

View file

@ -93,11 +93,11 @@ class HomeKitNumber(CharacteristicEntity, NumberEntity):
super().__init__(conn, info, char)
@property
def name(self) -> str | None:
def name(self) -> str:
"""Return the name of the device if any."""
if prefix := super().name:
return f"{prefix} {self.entity_description.name}"
return self.entity_description.name
if name := self.accessory.name:
return f"{name} {self.entity_description.name}"
return f"{self.entity_description.name}"
def get_characteristic_types(self) -> list[str]:
"""Define the homekit characteristics the entity is tracking."""