How to crate automation based on zha_event for Aqara WXKG02LM?

Hi all,
I have switched to ZHA coming from Zigbee2MQTT due to huge instability problems.
I’ve managed to integrate my Aqara Wireless Remote Switch (Double Rocker) (2016 version) after a few tries, but it only registers a battery entity.
If I press a button I can register a zha_event that looks like this:

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "00:15:8d:00:01:63:96:bc",
        "unique_id": "00:15:8d:00:01:63:96:bc:2:0x0006",
        "device_id": "254829befceaf50e24f90e5eeb2366a0",
        "endpoint_id": 2,
        "cluster_id": 6,
        "command": "attribute_updated",
        "args": {
            "attribute_id": 0,
            "attribute_name": "on_off",
            "value": 1
        }
    },
    "origin": "LOCAL",
    "time_fired": "2021-09-28T11:21:34.491140+00:00",
    "context": {
        "id": "024fd951ec3bd2052e48c336e973451c",
        "parent_id": null,
        "user_id": null
    }
}

So basically the args.value changes from 0 to 1 back to 0 when pressing a button.
How can I use this to create an automation on button press? I couldn’t figure it out.
Thanks in advance.

Isn’t the search functionality a great invention :wink:

1 Like

Thanks!
Somehow blueprints haven’t crossed my mind. The one you were linking didn’t help, but the thread solved the problem for me! (I have the lumi.sensor_86sw2)