UPDATE: The binding via groups doesn’t work with the new firmware and you have to bind to devices directly. See Upgraded ikea switch, now no binding to group so automation issues - #3 by duck304
Hey,
I was trying to achieve a seemingly easy thing: direct binding of IKEA Tradfri remote with dimmable IKEA FLOALT. I wanted to do that to have a better response time to dimming and also make it fail-safe if my HA is down.
What is achieved in this mini-guide
- Having the remote and light available in z2m
- Having direct binding of the controller to the light (therefore, if z2m is down, the controller still work)
- the same functionality (brightness, color changes) as if you didn’t use z2m at all (so you don’t lose anything with this guide)
- you won’t be able to get color temperature reporting (“updates”) if it’s changed via the controller (although you can still control it, e.g. from HA). What it means is that you cannot believe what color does the light have if you knew that someone could’ve changed it via the controller (mentioned here, firmware limitation)
- you will be able to bind different controllers to different lights, in 1:1 or 1:many fashion
- however, all of the lights on the same zigbee network will have to follow the same “scenes” (color temperatures - the thing that is changed when pressing
>
)
Steps
It’s actually almost whole described here, I am just going to show how to do it (partly) via UI.
- pair the controller and the light with your z2m stack, should look like this:
- go to the remote “Binding” tab and unbind the default group after you press some button on the remote (e.g. brigthness up)
- go to “Groups” tab in z2m and create one group for your light(s). It can have any ID, you can keep it blank for z2m to generate one for you. But then you must create a group with ID=65289. It can have arbitrary name, I recommend something like
tradfri_scenes
, but the ID must be the above. It should look like this:
- now, the binding of the remote. We are going to bind it to the group of lights we created previously (in my examples above
group_alpha
) not the scenes group.
it should look like this then:
- now, even if z2m is down, the remote should be bind to your light and you should be able to control it. Unfortunately, changing the color doesn’t work. That’s where that
tradfri_scenes
weird group comes in, we’ll fix it, but you need to get your hands dirty with mqtt as the UI doesn’t have scenes settings in yet.
-
Update: since zigbee2mqtt 1.22, it’s possible to now set scenes via the UI as well. The following still work though. To make it “factory-reset-like”, you have to set three scenes to the
tradfri_scenes
, specifically sending the following JSONs to MQTT topiczigbee2mqtt/<tradfri_scenes_group_name>/set
:
{"scene_add": {
"ID": 1,
"color_temp": 250, # 250 means the most white
"state": "ON",
"transition": 1
}
}
{"scene_add": {
"ID": 2,
"color_temp": 370,
"state": "ON",
"transition": 1
}
}
{"scene_add": {
"ID": 3,
"color_temp": 454, # 454 means the most yellow
"state": "ON",
"transition": 1
}
}
for example, from command line, assuming your mqtt host is 192.168.0.201
with username and password z2m
, while naming your scenes group as I did tradfi_alpha
(I have typo there, I know), you would do:
mosquitto_pub -h 192.168.0.201 -u z2m -P z2m -t "zigbee2mqtt/tradfi_alpha/set" -m '{
"scene_add": {
"ID": 1,
"color_temp": 250,
"state": "ON",
"transition": 1
}
}'
and the same for the other two JSON payloads. Bonus: You could make transitions smoother and support even more color temperatures than just the basic three - you would simply add more. You could also set specific brightness and not just colors if you wanted (but note that all remotes/lights would follow these). When I was experimenting with it, I created this python script to generate scenes. I had to recreate the scenes to make it work for any new device added to the scenes group! (so when you add a new remote with a new light, then you add that light into that new group, you have to e.g. rerun that script with scenes or simply delete them and add them again).
Once this is done, it should all work as normal.