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
74.11k stars 31.1k forks source link

ZHA: Sending cluster command fails with exception on response #131908

Open Sisylam opened 2 days ago

Sisylam commented 2 days ago

The problem

I currently trying to create an IAS ACE alarm panel using an ESP32-C6 and general binding and communication with home-assistant works as expected and it shows up as an alarm panel inside of the dashboard. I went into 'Manage Zigbee device' to directly send a cluster command which somehow works as I do receive the proper arm command. However, in the HA dashboard I get an error 'Failed to perform the action...' and in the logs I see a stacktrace posted below.

Could someone please be so kind and take a look at it or advice me how to resolve the error?

What version of Home Assistant Core has the issue?

core-2025.1.0.dev202411280234

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

ZigBee Home Automation

Link to integration documentation on our website

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

Diagnostics information

As written above, I currently trying to create an IAS ACE alarm panel using an ESP32-C6 and general binding and communication with home-assistant works as expected and it shows up as an alarm panel inside of the dashboard. image I noticed that when I select the functionality in the dashboard to switch the state to arming image then it will only send me for whichever arming state always a panic event only

I (2156804) ZB_IAS_ACE_PANEL: ESP_ZB_CORE_IAS_ACE_PANIC_CB_ID : Receive Zigbee action(0x23) callback
I (2156804) ZB_IAS_ACE_PANEL: Panic message: endpoint(1), cluster(0x501), status(0) 

Maybe that is how it is supposed to work, but it was irritating, but not the issue at hand. Then I went into 'Manage Zigbee device' to directly send a cluster command via image which somehow works as I do receive the proper arm command on the ESP side:

I (4250924) ZB_IAS_ACE_PANEL: ESP_ZB_CORE_IAS_ACE_ARM_CB_ID : Receive Zigbee action(0x1f) callback
I (4250924) ZB_IAS_ACE_PANEL: Arm message: endpoint(1), cluster(0x501), status(0)
W (4251054) ZB_IAS_ACE_PANEL: arm_disarm_code: (1234)
W (4251064) ZB_IAS_ACE_PANEL: zone_id: 1
W (4251064) ZB_IAS_ACE_PANEL: ARM_MODE_DISARM

However, in the HA dashboard I get an error 'Failed to perform the action...' and in the logs I see the posted stacktrace.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-11-29 14:16:59.939 DEBUG (MainThread) [zigpy.zcl] [0x61B4:1:0x0501] Sending request header: ZCLHeader(frame_control=FrameControl<0x01>(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=False, direction=<Direction.Client_to_Server: 0>, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False), tsn=41, command_id=0, *direction=<Direction.Client_to_Server: 0>)
2024-11-29 14:16:59.947 DEBUG (MainThread) [zigpy.zcl] [0x61B4:1:0x0501] Sending request: arm(arm_mode=<ArmMode.Disarm: 0>, arm_disarm_code='1234', zone_id=1)
2024-11-29 14:17:00.150 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 11, 29, 13, 17, 0, 150493, tzinfo=datetime.timezone.utc), priority=0, src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x61B4), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=1281, data=Serialized[b'\x19)\x00\x00'], tx_options=<TransmitOptions.NONE: 0>, radius=29, non_member_radius=0, lqi=145, rssi=None)
2024-11-29 14:17:00.155 DEBUG (MainThread) [zigpy.zcl] [0x61B4:1:0x0501] Received ZCL frame: b'\x19)\x00\x00'
2024-11-29 14:17:00.160 DEBUG (MainThread) [zigpy.zcl] [0x61B4:1:0x0501] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl<0x19>(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, direction=<Direction.Server_to_Client: 1>, disable_default_response=1, reserved=0, *is_cluster=True, *is_general=False), tsn=41, command_id=0, *direction=<Direction.Server_to_Client: 1>)
2024-11-29 14:17:00.164 DEBUG (MainThread) [zigpy.zcl] [0x61B4:1:0x0501] Decoded ZCL frame: IasAce:arm_response(arm_notification=<ArmNotification.All_Zones_Disarmed: 0>)
2024-11-29 14:17:00.171 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546683253472] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1110, in _async_admin_handler
    await result
  File "/usr/src/homeassistant/homeassistant/components/zha/websocket_api.py", line 1389, in issue_zigbee_cluster_command
    await zha_device.issue_cluster_command(
    ...<8 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/zha/zigbee/device.py", line 958, in issue_cluster_command
    if response[1] is not ZclStatus.SUCCESS:
       ~~~~~~~~^^^
  File "/usr/local/lib/python3.13/site-packages/zigpy/zcl/foundation.py", line 1192, in __getitem__
    return self.as_tuple()[item]
           ~~~~~~~~~~~~~~~^^^^^^
IndexError: tuple index out of range

Additional information

No response

home-assistant[bot] commented 2 days ago

Hey there @dmulcahey, @adminiuga, @puddly, @thejulianjes, mind taking a look at this issue as it has been labeled with an integration (zha) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `zha` 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 zha` 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)


zha documentation zha source (message by IssueLinks)