Matter generic switch throws "Invalid event type" on short_release and other events
hiattp opened this issue · 1 comments
The problem
I'm new to Matter but very eager to get some ESP32-H2 prototypes up and running. As a very basic test I've installed the latest Matter server on HA and flashed an ESP32-H2 with the generic switch example:
This commissions successfully and according to the ESP32 monitor is triggering the correct events. However, when I observe state_changed
events in HA on any given button press I only see initial_press
events like this (5 largely identical events per one button press in quick succession):
event_type: state_changed
data:
entity_id: event.test_product
old_state:
entity_id: event.test_product
state: "2024-05-16T16:42:32.199+00:00"
attributes:
event_types:
- initial_press
event_type: initial_press
newPosition: 1
device_class: button
friendly_name: Test Product
last_changed: "2024-05-16T16:42:32.569806+00:00"
last_reported: "2024-05-16T16:42:32.569806+00:00"
last_updated: "2024-05-16T16:42:32.569806+00:00"
context:
id: 01HY14HBQSCJPFDAZATBPNEY1R
parent_id: null
user_id: null
new_state:
entity_id: event.test_product
state: "2024-05-16T16:43:15.429+00:00"
attributes:
event_types:
- initial_press
event_type: initial_press
newPosition: 1
device_class: button
friendly_name: Test Product
last_changed: "2024-05-16T16:43:15.429479+00:00"
last_reported: "2024-05-16T16:43:15.429479+00:00"
last_updated: "2024-05-16T16:43:15.429479+00:00"
context:
id: 01HY14JNK5PNNY50XQQH01WPK8
parent_id: null
user_id: null
origin: LOCAL
time_fired: "2024-05-16T16:43:15.429479+00:00"
context:
id: 01HY14JNK5PNNY50XQQH01WPK8
parent_id: null
user_id: null
In addition to these events (which don't seem to be usable in terms of determining the actual button action/state since they appear as 5 redundant initial_press
) I also see event validation errors in Core pertaining to the event types:
2024-05-16 12:41:02.863 DEBUG (MainThread) [homeassistant.components.matter] Setting up entities for node 3
2024-05-16 12:41:02.865 DEBUG (MainThread) [homeassistant.components.matter] Creating event entity for <class 'chip.clusters.Objects.Switch.Attributes.CurrentPosition'>
2024-05-16 12:41:42.996 ERROR (MainThread) [homeassistant.components.matter] Unexpected exception: Invalid event type short_release for event.test_product
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/matter/__init__.py", line 151, in _client_listen
await matter_client.start_listening(init_ready)
File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 628, in start_listening
self._handle_incoming_message(msg)
File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 666, in _handle_incoming_message
self._handle_event_message(msg)
File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 740, in _handle_event_message
self._signal_event(
File "/usr/local/lib/python3.12/site-packages/matter_server/client/client.py", line 770, in _signal_event
callback(event, data)
File "/usr/src/homeassistant/homeassistant/components/matter/event.py", line 116, in _on_matter_node_event
self._trigger_event(EVENT_TYPES_MAP[data.event_id], data.data)
File "/usr/src/homeassistant/homeassistant/components/event/__init__.py", line 153, in _trigger_event
raise ValueError(f"Invalid event type {event_type} for {self.entity_id}")
ValueError: Invalid event type short_release for event.test_product
After a quick (and naive) code search I do see these as supported event types (see https://github.com/home-assistant/core/blob/dev/homeassistant/components/matter/event.py#L27) so it isn't clear why these are triggering errors and why I'm seeing all the redundant event notifications.
FWIW the ESP32 monitor logs for a single button press on the generic switch example is here, you can see it attempting those "short release" and "multipress complete" events:
What version of Home Assistant Core has the issue?
core-2024.5.3
What was the last working version of Home Assistant Core?
No response
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
config_entry-matter-7357b64f7330f7c829b9684c529d9a81.json
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
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)