zigpy / zha-device-handlers

ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices.
Apache License 2.0
775 stars 703 forks source link

[BUG] SmartThings Button sends same command 3 times #1913

Closed alexruffell closed 11 months ago

alexruffell commented 2 years ago

Describe the bug I have several SmartThings Buttons M/N IM6001-BTP01 that have always worked flawlessly in ST and Home Assistant. Firmware version is 0x00000014. A while back they started repeating the same command 3 times. I checked the output of zha_event and confirmed it

Event 2 fired 7:36:

event_type: zha_event
data:
  device_ieee: 28:6d:97:00:01:04:1e:de
  unique_id: 28:6d:97:00:01:04:1e:de:1:0x0500
  device_id: f59f3b82102504ee70ab649e4300fde9
  endpoint_id: 1
  cluster_id: 1280
  command: button_single
  args:
    press_type: single
    command_id: 0
    args:
      - 1
      - 0
      - 0
      - 0
  params: {}
origin: LOCAL
time_fired: "2022-11-10T13:36:04.166296+00:00"
context:
  id: 01GHGW2EJ6R7HEWYYDDQPQW7B8
  parent_id: null
  user_id: null

Event 1 fired 7:36:

event_type: zha_event
data:
  device_ieee: 28:6d:97:00:01:04:1e:de
  unique_id: 28:6d:97:00:01:04:1e:de:1:0x0500
  device_id: f59f3b82102504ee70ab649e4300fde9
  endpoint_id: 1
  cluster_id: 1280
  command: button_single
  args:
    press_type: single
    command_id: 0
    args:
      - 1
      - 0
      - 0
      - 0
  params: {}
origin: LOCAL
time_fired: "2022-11-10T13:36:01.806008+00:00"
context:
  id: 01GHGW2C8ECN2VY6SNNKB53263
  parent_id: null
  user_id: null

Event 0 fired 7:36:

event_type: zha_event
data:
  device_ieee: 28:6d:97:00:01:04:1e:de
  unique_id: 28:6d:97:00:01:04:1e:de:1:0x0500
  device_id: f59f3b82102504ee70ab649e4300fde9
  endpoint_id: 1
  cluster_id: 1280
  command: button_single
  args:
    press_type: single
    command_id: 0
    args:
      - 1
      - 0
      - 0
      - 0
  params: {}
origin: LOCAL
time_fired: "2022-11-10T13:36:00.020955+00:00"
context:
  id: 01GHGW2AGM97XJKBS0WT4A7ZZM
  parent_id: null
  user_id: null

The same thing happens when I double press or hold. As I mentioned above I have multiple of these buttons around the house that were working perfectly fine in HA and they all started having the issue at the same time so I am guessing it has to do with the driver (Quirk: zhaquirks.samjin.button.SamjinButton) for this device.

To Reproduce Steps to reproduce the behavior:

  1. Just press the button while watching the zha_event output

Expected behavior Command should be output just once.

Screenshots n/a

Device signature ```yaml { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4673, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0402", "in_clusters": [ "0x0000", "0x0001", "0x0003", "0x0020", "0x0402", "0x0500", "0x0b05" ], "out_clusters": [ "0x0003", "0x0019" ] } }, "manufacturer": "Samjin", "model": "button", "class": "zhaquirks.samjin.button.SamjinButton" } ```
Diagnostic information ```yaml { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.11.2", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.7", "docker": true, "arch": "x86_64", "timezone": "America/Chicago", "os_name": "Linux", "os_version": "5.15.74", "supervisor": "2022.10.2", "host_os": "Home Assistant OS 9.3", "docker_version": "20.10.18", "chassis": "vm", "run_as_root": true }, "custom_components": { "favicon": { "version": "10.4", "requirements": [] }, "spotcast": { "version": "v3.6.30", "requirements": [ "spotify_token==1.0.0" ] }, "garbage_collection": { "version": "4.8.3", "requirements": [ "python-dateutil>=2.8.2" ] }, "zha_toolkit": { "version": "v0.8.23", "requirements": [ "packaging>=20.8" ] }, "auto_backup": { "version": "1.3.0", "requirements": [] }, "victorsmartkill": { "version": "2022.7.1", "requirements": [ "victor-smart-kill==1.1.0" ] }, "nws_alerts": { "version": "2.5", "requirements": [] }, "alexa_media": { "version": "4.3.2", "requirements": [ "alexapy==1.26.4", "packaging>=20.3", "wrapt>=1.12.1" ] }, "navien_water_heater": { "version": "0.0.7", "requirements": [] }, "keymaster": { "version": "v0.0.82", "requirements": [] }, "nest_protect": { "version": "0.3.8", "requirements": [] }, "browser_mod": { "version": "2.1.2", "requirements": [] }, "watchman": { "version": "0.5.1", "requirements": [ "prettytable==3.0.0" ] }, "webrtc": { "version": "v2.3.1", "requirements": [] }, "nodered": { "version": "1.1.2", "requirements": [] }, "hacs": { "version": "1.28.3", "requirements": [ "aiogithubapi>=22.2.4" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.34.2", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.85", "zigpy-deconz==0.19.0", "zigpy==0.51.5", "zigpy-xbee==0.16.2", "zigpy-zigate==0.10.3", "zigpy-znp==0.9.1" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "1A86", "pid": "55D4", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus v2" ] }, { "vid": "10C4", "pid": "EA60", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus" ] }, { "vid": "10C4", "pid": "EA60", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*zigstar*", "known_devices": [ "ZigStar Coordinators" ] }, { "vid": "1CF1", "pid": "0030", "description": "*conbee*", "known_devices": [ "Conbee II" ] }, { "vid": "10C4", "pid": "8A2A", "description": "*zigbee*", "known_devices": [ "Nortek HUSBZB-1" ] }, { "vid": "0403", "pid": "6015", "description": "*zigate*", "known_devices": [ "ZiGate+" ] }, { "vid": "10C4", "pid": "EA60", "description": "*zigate*", "known_devices": [ "ZiGate" ] }, { "vid": "10C4", "pid": "8B34", "description": "*bv 2010/10*", "known_devices": [ "Bitron Video AV2010/10" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" } ], "dependencies": [ "file_upload" ], "after_dependencies": [ "onboarding", "usb", "zeroconf" ], "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp" ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 25971, "manufacturer": "Samjin", "model": "button", "name": "Samjin button", "quirk_applied": true, "quirk_class": "zhaquirks.samjin.button.SamjinButton", "manufacturer_code": 4673, "power_source": "Battery or Unknown", "lqi": 61, "rssi": null, "last_seen": "2022-11-10T07:46:53", "available": true, "device_type": "EndDevice", "signature": { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4673, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0402", "in_clusters": [ "0x0000", "0x0001", "0x0003", "0x0020", "0x0402", "0x0500", "0x0b05" ], "out_clusters": [ "0x0003", "0x0019" ] } } }, "active_coordinator": false, "entities": [ { "entity_id": "binary_sensor.guest_bedroom_bedside_button", "name": "Samjin button" }, { "entity_id": "button.guest_bedroom_bedside_button_identify", "name": "Samjin button" }, { "entity_id": "sensor.guest_bedroom_bedside_button_battery", "name": "Samjin button" }, { "entity_id": "sensor.guest_bedroom_bedside_button_temperature", "name": "Samjin button" } ], "neighbors": [], "endpoint_names": [ { "name": "IAS_ZONE" } ], "user_given_name": "Guest Bedroom Bedside Button", "device_reg_id": "f59f3b82102504ee70ab649e4300fde9", "area_id": "remotes", "cluster_details": { "1": { "device_type": { "name": "IAS_ZONE", "id": 1026 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": "Samjin" }, "0x0005": { "attribute_name": "model", "value": "button" } }, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0020": { "attribute_name": "battery_voltage", "value": 27 }, "0x0021": { "attribute_name": "battery_percentage_remaining", "value": 193 } }, "unsupported_attributes": { "0x0031": { "attribute_name": "battery_size" }, "0x0033": { "attribute_name": "battery_quantity" } } }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0020": { "endpoint_attribute": "poll_control", "attributes": { "0x0000": { "attribute_name": "checkin_interval", "value": 13200 } }, "unsupported_attributes": {} }, "0x0402": { "endpoint_attribute": "temperature", "attributes": { "0x0000": { "attribute_name": "measured_value", "value": 2698 } }, "unsupported_attributes": {} }, "0x0500": { "endpoint_attribute": "ias_zone", "attributes": { "0x0000": { "attribute_name": "zone_state", "value": 1 }, "0x0001": { "attribute_name": "zone_type", "value": 32768 }, "0x0002": { "attribute_name": "zone_status", "value": 0 }, "0x0010": { "attribute_name": "cie_addr", "value": "00:12:4b:00:24:c3:15:9f" } }, "unsupported_attributes": {} }, "0x0b05": { "endpoint_attribute": "diagnostic", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} } } } } } } ```
Additional logs ``` Paste any additional debug logs here. Don't remove the extra line breaks outside the ``` marks. ```

Additional context Add any other context about the problem here.

MattWestb commented 2 years ago

Witch Zigbee radio chip / model / brand is you Zigbee dongle ? Also can you posting one log from (Z)HA then its happening with debug logging enable in HA ?

alexruffell commented 2 years ago

@MattWestb I am using a Sonoff Zigbee 3.0 USB Dongle Plus with the TI CC2652P chip. I changed the logging for ZHA to debug, rebooted, pressed the button once and saw the 3 commands on zha_event, turned off debug and rebooted again. I then took the backed up log file (log.1) and pasted it here. Hope this is what you wanted.

MattWestb commented 2 years ago

Im missing the communication with the device that need zigpy: debug also zigpy_znp: debug can being good but you dont need ZHA debug then its only spamming the log. Also the NWK address of the device is good so not need trying finding it log.

alexruffell commented 2 years ago

@MattWestb Below is the new log. I pressed the button more than once as I wasn't seeing the event... hopefully that doesn't confuse things. You should find presses in multiples of 3. ID is 0x6573

home-assistant.log

MattWestb commented 2 years ago

Great logging !!

2022-11-10 15:20:20.320 DEBUG (MainThread) [zigpy.zcl] [0x6573:1:0x0500] Received command 0x00 (TSN 9): status_change_notification(zone_status=<ZoneStatus.Alarm_1: 1>, extended_status=<bitmap8.0: 0>, zone_id=0, delay=0)

Also 15:20:22.091 and 15:20:24.260 the same frame with the same TSN and its one broadcasts to GroupId=0x0000.

@puddly Is not TI filtering group broadcast with the same TSN ? I dont know if its one direct child or the device is having one no Zigbee 3 parent -> the parent is transmitting the frame 3 times as one ZHA router and not using passive ack by listening that the neighbors have re sending the frame.

Is IAS Zone using broadcast in one different way as the light is doing ?

alexruffell commented 1 year ago

@puddly Have you had a chance to look into this? Even with the latest release the issue is still present.

OliverDudgeon commented 1 year ago

Started seeing this about a month back. Didn't happen before. I have a Aeotec Samjij Button with a TI chip. Other zigbee devices work normally.

LxonWWW commented 1 year ago

I have the same problem with one of my Aeotec buttons (same as SmartThings Button). I even got it replaced and it started again 3 days later. The strange thing is, that one of the buttons still works flawlessly (this one was never replaced).

alexruffell commented 1 year ago

Mine used to work flawlessly and then started having issues after some HA upgrade. Now I know that a single press to turn my LIFX light off will result in off, on, off. I just got used to it...

LxonWWW commented 1 year ago

Mine used to work flawlessly and then started having issues after some HA upgrade. Now I know that a single press to turn my LIFX light off will result in off, on, off. I just got used to it...

I have also looked at other zigbee buttons but none come close to this beautiful design while being this small. It's just frustrating to get a light show at night before going to bed. I might switch to the Aqara buttons, even though they don't look nearly as good as the Aeotec ones.

OliverDudgeon commented 1 year ago

This has stopped being an issue for me now. Not sure what change but after some updates I noticed it wasn't happening anymore. Best of luck folks.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

alexruffell commented 1 year ago

I have several of these ST buttons that I was not using. Now that I am, I noticed that just one keeps doing this on, off, on business so I suspect that the issue is device or network specific. Maybe a bad router in between or a failing button (does poor signal cause it to try more than once?), etc.

loosrob commented 11 months ago

I'm also experiencing this issue. I noticed that removing and replacing the battery on the Aeotec Smart Button (temporarily) solves the issue.

My HomeAssistant is on the latest version; I'm using the HomeAssistant Skyconnect zigbee stick.

alexruffell commented 11 months ago

Must be my same issue as mine no longer does it. I likely replaced the battery since then. Thank you for letting me know the possible cause.