Xiaomi changes state every 50 minutes

Hello,

I have a Xiaomi Aqara single button, I integrate Zigbee with the Zigate device by this component : https://github.com/doudz/homeassistant-zigate
I cannot use ZHA because I use Zigate by Wifi.

I have an automation which is triggered when my button changes state, so when I push on it :

- alias: 'bouton spots cuisine'
  trigger:
    platform: state
    entity_id: zigate.00158d000214f0ad
  action:
    service: switch.toggle
    entity_id: switch.qubino_goap_zmnhadx_flush_1_relay_switch

This works fine, but the button changes state alone every 50 minutes, and then triggered the automation :

Below my device actual config :

{
“lqi_percent”: 59,
“type”: “lumi.sensor_86sw1”,
“manufacturer”: null,
“receiver_on_when_idle”: false,
“missing”: false,
“generic_type”: “”,
“discovery”: “auto-discovered”,
“groups”: {},
“datecode”: null,
“battery_voltage”: 3.035,
“battery_level”: 79,
“addr”: “e00c”,
“id”: 0,
“ieee”: “00158d000214f0ad”,
“last_seen”: “2019-10-14 10:05:11”,
“lqi”: 150,
“mac_capability”: “10000000”,
“power_type”: 0,
“friendly_name”: “Bouton spots cuisine”,
“icon”: “mdi:access-point”
}

I have no other automation which could be interact with it.

Should I change a parameter to avoid that ?
Or my automation is not good?

Thanks !

Hi.

The trigger on your automation will trigger when anything changes on the button, it would be best to capture what you want from the button, so probably best to add whatever shows in HA when the button is pushed. IE “on”.

Something like this:

- alias: 'bouton spots cuisine'
  trigger:
    platform: state
    entity_id: zigate.00158d000214f0ad
    to: 'on'
  action:
    service: switch.toggle
    entity_id: switch.qubino_goap_zmnhadx_flush_1_relay_switch

Simon

Thanks for answer.
You are right, I should use the binary_sensor entity to get ‘on/off’ instead of device entity, but there is a bug with this device : https://github.com/doudz/homeassistant-zigate/issues/79
Value is not well updated with this device… Maybe I will try to create a template sensor to fix that.