[Zigbee2mqtt] Single click with Aqara Opple, two events in Home Assistant

Tags: #<Tag:0x00007f739eba6b48> #<Tag:0x00007f739eba6738> #<Tag:0x00007f739eba6468>

Hello everybody !

Using home assistant and zigbee2mqtt for several months and very happy with it !
I have received my Aqara Opple (6 buttons) and paired it with my system, all good.

But I have noticed with Node Red, when I put a call to notification service on a single click of one of the Opple buttons, I am getting 2 notifications instead of one.

Here is the Zigbee2mqtt log when I click the button :

zigbee2mqtt:info  2020-05-02 15:59:14: MQTT publish: topic 'zigbee2mqtt/opple_6_buttons', payload '{"battery":100,"voltage":3113,"linkquality":99,"action":"button_6_single"}'
zigbee2mqtt:info  2020-05-02 15:59:14: MQTT publish: topic 'zigbee2mqtt/opple_6_buttons', payload '{"battery":100,"voltage":3113,"linkquality":99,"action":""}'
zigbee2mqtt:info  2020-05-02 15:59:14: MQTT publish: topic 'zigbee2mqtt/opple_6_buttons/action', payload 'button_6_single'

So apparently, the event “button_6_single” is sent two times in the mqtt topic.
I have put the value in config for homeassistant_legacy_triggers: false, thinking it would be related but sadly not.

My Zigbee2mqtt config :

data_path: /share/zigbee2mqtt
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://192.168.1.40:1883'
  user: *
  password: *
serial:
  port: /dev/ttyACM0
  disable_led: true
advanced:
  pan_id: 6754
  channel: 11
  network_key:
    - * .....
    - *
  availability_blacklist: []
ban: []
whitelist: []
queue: {}
socat:
  enabled: false
  master: 'pty,raw,echo=0,link=/dev/ttyZ2M,mode=777'
  slave: 'tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5'
  restartdelay: 1
  initialdelay: 1
  options: '-d -d'
  log: false
homeassistant_legacy_triggers: false

Does someone have an idea ? Is it normal behaviour ? Or should I fine tune my automations in Node Red ?

Thank you !

Set debounce on the device.

The event is sent twice but in different topics.
Seems like zigbee2mqtt/opple_6_buttons is providing the pushed and released , information.
zigbee2mqtt/opple_6_buttons/action seems to solely provide the pushed information.

Hello @Tinkerer,
I have tried to put the debounce in the global config of Zigbee2mqtt (in Home Assistant) but it doesn’t seem to be working (or I might have done it wrong, not sure about the process to go with home assistant addon of z2mqtt if I need to include it for a specific device like mine ?).

@eXtatic :
Yes that is what I saw too :slight_smile:
Here is the simplest node red configuration I could extract which produces the double event behavior :

And its source :

[
    {
        "id": "2318ab90.8cb604",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "b49ff4aa.84e158",
        "type": "api-call-service",
        "z": "2318ab90.8cb604",
        "name": "Notif",
        "server": "366a00db.0b1cd",
        "version": 1,
        "debugenabled": false,
        "service_domain": "notify",
        "service": "mobile_app_francoiss_iphone",
        "entityId": "",
        "data": "{\"title\":\"Bouton pressed\",\"message\":\"Number 6!\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 590,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "ca898adf.c16918",
        "type": "switch",
        "z": "2318ab90.8cb604",
        "name": "Which Button ?",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "button_6_single",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 410,
        "y": 360,
        "wires": [
            [
                "b49ff4aa.84e158"
            ]
        ]
    },
    {
        "id": "e81dae2.20b575",
        "type": "trigger-state",
        "z": "2318ab90.8cb604",
        "name": "Aqara 6 Buttons",
        "server": "366a00db.0b1cd",
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityid": "sensor.opple_6_buttons_action",
        "entityidfiltertype": "exact",
        "debugenabled": false,
        "constraints": [],
        "constraintsmustmatch": "all",
        "outputs": 2,
        "customoutputs": [],
        "outputinitially": false,
        "state_type": "str",
        "x": 200,
        "y": 360,
        "wires": [
            [
                "ca898adf.c16918"
            ],
            []
        ]
    },
    {
        "id": "366a00db.0b1cd",
        "type": "server",
        "z": "",
        "name": "Home Assistant"
    }
]

I suspect that there is something to fine tune in the rule of the switch. Would it make sense ? :slight_smile:

Hello, I am new
with which program the graphics were made
?