All zigbee buttons regularly triggers events

Hi,

My Home Assistant (HA) is running in a Docker container inside iHost. While this setup isn’t ideal, it serves my basic automation and integration needs effectively. All Zigbee devices and entities connected to iHost are accessible/exposed to HA through the HomeKit integration (which server runs in another docker container). I’ve included a schematic below for visualization:

In iHost, I’ve set up the following automation: when a Zigbee button from Sonoff is pressed, it controls a Sonoff Mini R4. This automation works flawlessly, as expected since all components are from the same brand. However, I’m now considering using one of my two buttons (either SNZB-01 or SNZB-01P) to turn on/off a ceiling fan from a different brand, trough HA.

During the setup process, I noticed that both buttons trigger an event every 2 hours. For test purposes, I recreated the same automation i have in HA. Indeed the lamp controlled by the Sonoff Mini R4 also turns on and off every 2 hours (without anyone pressing the button).

My suspicion is that this periodic event might be related to a “Zigbee update” performed by iHost, which HA interprets as a button click. Strangely, neither the device logs in iHost nor the HomeKit logs show any triggers during these events.

Does anyone have any insights into what might be happening, or how I can troubleshoot this further?

Thanks in advance for your assistance!

It’s probably a heartbeat message, but you haven’t pasted the (correctly formatted) automation or the events for either a genuine button click or the periodic event, so I can only speculate.

Please read this.

Hi @ShadowFist,

Thank you for your reply.

Indeed, I believe it is a heartbeat. I have managed to listen to the periodic event after monitoring the bus for a while.

As you can see, Home Assistant (HA) does not discern between the genuine event and the supposed heartbeat. Both show as single press.

Do you have any insights on how I can diagnose this further or solve the issue?

Periodic event:

event_type: state_changed
data:
  entity_id: event.botao_cozinha
  old_state:
    entity_id: event.botao_cozinha
    state: "2024-03-13T03:30:12.865+00:00"
    attributes:
      event_types:
        - single_press
        - double_press
        - long_press
      event_type: single_press
      device_class: button
      friendly_name: Botão Cozinha
    last_changed: "2024-03-13T03:30:12.865496+00:00"
    last_updated: "2024-03-13T03:30:12.865496+00:00"
    context:
      id: 01HRTXRJ81D34CC8YDBGWVGXH6
      parent_id: null
      user_id: null
  new_state:
    entity_id: event.botao_cozinha
    state: "2024-03-13T03:30:12.886+00:00"
    attributes:
      event_types:
        - single_press
        - double_press
        - long_press
      event_type: single_press
      device_class: button
      friendly_name: Botão Cozinha
    last_changed: "2024-03-13T03:30:12.886516+00:00"
    last_updated: "2024-03-13T03:30:12.886516+00:00"
    context:
      id: 01HRTXRJ8PTGRRFRZEZTR863EE
      parent_id: null
      user_id: null
origin: LOCAL
time_fired: "2024-03-13T03:30:12.886516+00:00"
context:
  id: 01HRTXRJ8PTGRRFRZEZTR863EE
  parent_id: null
  user_id: null

The genuine click is below:

event_type: state_changed
data:
  entity_id: event.botao_cozinha
  old_state:
    entity_id: event.botao_cozinha
    state: "2024-03-13T19:48:13.334+00:00"
    attributes:
      event_types:
        - single_press
        - double_press
        - long_press
      event_type: single_press
      device_class: button
      friendly_name: Botão Cozinha
    last_changed: "2024-03-13T19:48:13.334602+00:00"
    last_updated: "2024-03-13T19:48:13.334602+00:00"
    context:
      id: 01HRWNQBCPEZQRDT4HDQ4GYYVD
      parent_id: null
      user_id: null
  new_state:
    entity_id: event.botao_cozinha
    state: "2024-03-13T19:48:13.364+00:00"
    attributes:
      event_types:
        - single_press
        - double_press
        - long_press
      event_type: single_press
      device_class: button
      friendly_name: Botão Cozinha
    last_changed: "2024-03-13T19:48:13.364794+00:00"
    last_updated: "2024-03-13T19:48:13.364794+00:00"
    context:
      id: 01HRWNQBDMJ2FS2CT6F5T6893Z
      parent_id: null
      user_id: null
origin: LOCAL
time_fired: "2024-03-13T19:48:13.364794+00:00"
context:
  id: 01HRWNQBDMJ2FS2CT6F5T6893Z
  parent_id: null
  user_id: null

How is your automation triggered? I had a similar issue a while ago with Philips Hue buttons (using a Hue hub), which registered a “press” whenever Philips issued a firmware update… As I recall, I was using the event timestamp as a “state” to trigger the automation (as suggested in the docs) and the update appeared to be changing it.

Edit: Sorry - you beat me to it.

I’m putting my money on the Homekit integration not sending more data in your event then.
It should be sending an event based on the command, cluster_id and endpoint_id, similar to the logic in this ZHA Blueprint

I have found the hearbeat message. The Ewelink CUBE Plugin inside homebridge docker container send a periodic message with the signal intensity in dbm (RSSI).

[homebridge-plugin-ewelink-cube] receive sse message {"endpoint":{"serial_number":"REDACTED"},"payload":{"rssi":{"rssi":-64}}}

Problably homebridge fowards this to the HA HomeKit Integration and it interprets that as a button press. I’m trying to investigate further and have made some changes.