Ikea Tradfri switch 0n/off with Node Red

I have a sonoff zigbee with tasmota and i bought some tradfri devices to try. Works fine, pairing is fast. I then use a blueprint for automation with the ikea button since it only reports as power under zha.
My question is: is it possible to integrate in Node Red?

Yes, you need to listen for the events. It will be published under ZHA_Event

Ok, I did and I have the id but what should I do with it?
Thanks

I’am not used to ZHA, but i had to made also the decision how to intregate Zigbee devices into HA a few weeks ago.

I decided to setup Zigbee2mqtt (i use a docker container for that) and i’am very happy with that solution.

Node RED and HA interact via mqtt with the Zigbee devices. Flawless. And Zigbee2mqtt does the translation job. Works like a charm. And Zigbee2mqtt is aware of HA in suppling the entities. Syncronisation is not needed, because of mqtt. that does the job for all mqtt aware listeners like HA, node-RED, you name it.

I use lots of Ikea devices, Osram and what so ever. I even use ikea remotes with Tasmota wlan plugs without a hassle.

Just as a hint to take a look. No need of blueprints when you already use node RED.

A list of supported devices by Zigbee2mqtt:

An example of making use of an Ikea button (ticker?):
Ikea 1743 (Zigbee) to toggle a Gosund (Tasmota flashed plug. Wifi, not Zigbee!). Fully recognized by HA, because of mqtt protocol.

1 Like

I have the id but i do not know how to use it in Node Red, any help?

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "80:4b:50:ff:fe:48:4d:83",
        "unique_id": "80:4b:50:ff:fe:48:4d:83:1:0x0006",
        "device_id": "4860b36566dd1795ff19faf3da39e1dd",
        "endpoint_id": 1,
        "cluster_id": 6,
        "command": "off",
        "args": []
    },
    "origin": "LOCAL",
    "time_fired": "2021-05-02T09:46:00.448117+00:00",
    "context": {
        "id": "10de3670e6eda1ab86947ead2602a7a8",
        "parent_id": null,
        "user_id": null
    }
}
Evento 0 disparado 10:45:
{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "80:4b:50:ff:fe:48:4d:83",
        "unique_id": "80:4b:50:ff:fe:48:4d:83:1:0x0006",
        "device_id": "4860b36566dd1795ff19faf3da39e1dd",
        "endpoint_id": 1,
        "cluster_id": 6,
        "command": "on",
        "args": []
    },
    "origin": "LOCAL",
    "time_fired": "2021-05-02T09:45:56.396582+00:00",
    "context": {
        "id": "1a20496237848ba3a27ce70a96472fca",
        "parent_id": null,
        "user_id": null
    }
}

Probably you would want to filter for the device i.e.: msg.data.device_iee or msg.payload.event.device_ieeee and then later filter for the command: msg.data.command or msg.payload.command

You can do that via a switch node.
Here is an example i was using with the ikea tradfri remote controller:
(5 Button Remote)

[{"id":"84a8d990.9a35b8","type":"switch","z":"28e73868.21cde8","name":"","property":"payload.event.command","propertyType":"msg","rules":[{"t":"eq","v":"toggle","vt":"str"},{"t":"eq","v":"step_with_on_off","vt":"str"},{"t":"eq","v":"step","vt":"str"},{"t":"eq","v":"press","vt":"str"},{"t":"eq","v":"move_with_on_off","vt":"str"},{"t":"eq","v":"move","vt":"str"},{"t":"eq","v":"stop","vt":"str"}],"checkall":"true","repair":false,"outputs":7,"x":4370,"y":4520,"wires":[["f108c45b.631588"],["ca64dec9.b6046"],["58649cd5.e17664"],["cad4c4f5.aaf698"],["e492fd80.505eb"],["30dd6e8e.029472"],["fe9f3c2e.669e2"]],"outputLabels":["","Brightness +","Brightness -","Change Scene","Brightness - Hold","Brightness + Hold",""]},{"id":"379138fd.7612b8","type":"switch","z":"28e73868.21cde8","name":"","property":"payload.event.device_ieee","propertyType":"msg","rules":[{"t":"eq","v":"00:15:8d:00:01:e5:f4:e6","vt":"str"},{"t":"eq","v":"00:15:8d:00:00:ed:4e:8e","vt":"str"},{"t":"eq","v":"00:0d:6f:ff:fe:0d:25:51","vt":"str"},{"t":"eq","v":"ec:1b:bd:ff:fe:9e:c2:ef","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":4150,"y":4000,"wires":[["7c3cb33c.f1278c","d13d8a3b.145068"],["adf510a8.092d2","2f13749d.8b9c0c"],["84a8d990.9a35b8"],["33745ae2.b7d006"]],"outputLabels":["Wohnzimmer Button","Schlafzimmer Button","Wohnzimmer Ikea Remote",null]},{"id":"d59b48e8.446c58","type":"server-events","z":"28e73868.21cde8","name":"","server":"2fba4297.e4145e","event_type":"zha_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"x":3990,"y":3600,"wires":[["379138fd.7612b8"]]},{"id":"2fba4297.e4145e","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
1 Like

Exactly what i needeed! Thank you so much…
:heart_eyes: