home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.64k stars 29.94k forks source link

[Matter] Unexpected exception: 'BridgedDeviceBasicInformation' object has no attribute 'productID' #125620

Open lboue opened 1 week ago

lboue commented 1 week ago

The problem

Hi,

I noticed an issue with Matter integration since this commit c53c2d7](https://github.com/home-assistant/core/commit/c53c2d7e640df464257938d6083fb6d2e88dbd6): AttributeError: 'BridgedDeviceBasicInformation' object has no attribute 'productID'. Did you mean: 'productURL'?

HA log

2024-09-09 19:38:26.134 ERROR (MainThread) [custom_components.matter] Unexpected exception: 'BridgedDeviceBasicInformation' object has no attribute 'productID'
Traceback (most recent call last):
  File "/config/custom_components/matter/__init__.py", line 166, in _client_listen
    await matter_client.start_listening(init_ready)
  File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 639, in start_listening
    self._handle_incoming_message(msg)
  File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 677, in _handle_incoming_message
    self._handle_event_message(msg)
  File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 702, in _handle_event_message
    self._signal_event(event, data=node, node_id=node.node_id)
  File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 781, in _signal_event
    callback(event, data)
  File "/config/custom_components/matter/adapter.py", line 68, in node_added_callback
    self._setup_node(node)
  File "/config/custom_components/matter/adapter.py", line 148, in _setup_node
    self._setup_endpoint(endpoint)
  File "/config/custom_components/matter/adapter.py", line 218, in _setup_endpoint
    self._create_device_registry(endpoint)
  File "/config/custom_components/matter/adapter.py", line 210, in _create_device_registry
    model_id=str(basic_info.productID) if basic_info.productID else None,
                                          ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BridgedDeviceBasicInformation' object has no attribute 'productID'. Did you mean: 'productURL'?
2024-09-09 19:38:26.195 WARNING (MainThread) [matter_server.common.helpers.util] Value 0 of type <class 'int'> is invalid for presetsSchedulesEditable, expected value of type typing.Optional[bool]
2024-09-09 19:38:26.969 ERROR (MainThread) [custom_components.matter] Unexpected exception: 'BridgedDeviceBasicInformation' object has no attribute 'productID'
Traceback (most recent call last):
  File "/config/custom_components/matter/__init__.py", line 166, in _client_listen
    await matter_client.start_listening(init_ready)
  File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 639, in start_listening
    self._handle_incoming_message(msg)
  File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 677, in _handle_incoming_message
    self._handle_event_message(msg)
  File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 702, in _handle_event_message
    self._signal_event(event, data=node, node_id=node.node_id)
  File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 781, in _signal_event
    callback(event, data)
  File "/config/custom_components/matter/adapter.py", line 77, in node_updated_callback
    self._setup_node(node)
  File "/config/custom_components/matter/adapter.py", line 148, in _setup_node
    self._setup_endpoint(endpoint)
  File "/config/custom_components/matter/adapter.py", line 218, in _setup_endpoint
    self._create_device_registry(endpoint)
  File "/config/custom_components/matter/adapter.py", line 210, in _create_device_registry
    model_id=str(basic_info.productID) if basic_info.productID else None,

Commenting on the next line, the Matter integration works again. Could you fix this issue? https://github.com/home-assistant/core/blob/c53c2d7e640df464257938d6083fb6d2e88dbd69/homeassistant/components/matter/adapter.py#L210

Regards

What version of Home Assistant Core has the issue?

2024.9.1 + commit c53c2d7

What was the last working version of Home Assistant Core?

N/A

What type of installation are you running?

Home Assistant OS

Integration causing the issue

matter

Link to integration documentation on our website

https://www.home-assistant.io/integrations/matter/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 week ago

Hey there @home-assistant/matter, mind taking a look at this issue as it has been labeled with an integration (matter) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `matter` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign matter` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


matter documentation matter source (message by IssueLinks)

marcelveldt commented 1 week ago

Oh crap, that is a small oversight on our side, good you tested the dev branch. The productid apparently doesn't exist on the BridgedDeviceBasicInformation (where it does on regular BasicInformation). We'll have to fix this.