Aqara switch shows as being triggered when it hasn't been touched

I’m thinking this may be a configuration issue, since this is the second switch to do this, I sent the original back thinking it was defective.

I’m using a Dresden Elektronik ZigBee gateway [ConBee II], with zigbee2mqtt, HA running in a docker container. The switch is a WXKG11LM. It’s sitting on my desk and part of an automation to toggle a Zigbee smart plug (US version) (S31ZB) by SONOFF.

alias: Office Light Toggle
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.wms_1_click
condition: []
action:
  - service: homeassistant.toggle
    data: {}
    target:
      device_id: a32b5715abfbe2db0d263d357e3cfbc1
mode: single

I think something is losing the state, and so resetting to turning the outlet off. I’m kind of new to HA, and have hopes to be able to automate and integrate these switches for things, but am at a loss here.

Welcome to Home Assistant!

Are you certain its the switch thats being activated and not the smart plug?
Can you provide a screenshot from your logbook showing the event ?

It certainly looks to me like it is detecting a change to the switch, it was a couple of weeks between returning the original and getting the new one. They both display the same behavior, the state never changed unless I did it via the HA website or my phone app when I did not have a physical switch.

It looks like it is happening every 60 minutes, which makes me think the switch is sending an update, that HA is interpreting as it needs to toggle the other device, in this case the zigbee outlet.

Based on another thread I tweaked the automation so that it looks like this now, we’ll see if that works.

alias: Office Light Toggle
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.wms_1_click
    attribute: action
    to: single
condition: []
action:
  - service: homeassistant.toggle
    data: {}
    target:
      device_id: a32b5715abfbe2db0d263d357e3cfbc1
mode: single