Provide a better model for HomeKit service entries (#100848)

This commit is contained in:
J. Nick Koston 2023-09-25 09:34:53 -05:00 committed by GitHub
parent fb174f8063
commit c1b9400833
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -856,8 +856,7 @@ class HomeKit:
connection = (dr.CONNECTION_NETWORK_MAC, formatted_mac)
identifier = (DOMAIN, self._entry_id, BRIDGE_SERIAL_NUMBER)
self._async_purge_old_bridges(dev_reg, identifier, connection)
is_accessory_mode = self._homekit_mode == HOMEKIT_MODE_ACCESSORY
hk_mode_name = "Accessory" if is_accessory_mode else "Bridge"
accessory_type = type(self.driver.accessory).__name__
dev_reg.async_get_or_create(
config_entry_id=self._entry_id,
identifiers={
@ -866,7 +865,7 @@ class HomeKit:
connections={connection},
manufacturer=MANUFACTURER,
name=accessory_friendly_name(self._entry_title, self.driver.accessory),
model=f"HomeKit {hk_mode_name}",
model=accessory_type,
entry_type=dr.DeviceEntryType.SERVICE,
)