Fix device sync to Google Assistant if Matter integration is active (#104796)

* Only get Matter device info if device is an actual Matter device

* Return None if matter device does not exist

* lint

* fix test

* adjust google assistant test
This commit is contained in:
Marcel van der Veldt 2023-11-30 16:59:26 +01:00 committed by GitHub
parent cc2c7c7be1
commit 52450291cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 10 deletions

View file

@ -686,8 +686,12 @@ class GoogleEntity:
return device
# Add Matter info
if "matter" in self.hass.config.components and (
matter_info := matter.get_matter_device_info(self.hass, device_entry.id)
if (
"matter" in self.hass.config.components
and any(x for x in device_entry.identifiers if x[0] == "matter")
and (
matter_info := matter.get_matter_device_info(self.hass, device_entry.id)
)
):
device["matterUniqueId"] = matter_info["unique_id"]
device["matterOriginalVendorId"] = matter_info["vendor_id"]