Thx to Christoph and cweitkamp the following is a working example of how to zone bulbs and multiple remotes to work as one shared zone (6 IKEA Trådfri spots with three different remotes in this setup).
Additionally I am experimenting with the remotes ON/OFF (IKEA trådfri groups) for avoiding switching on full power and wake our daughter.
.things
Bridge tradfri:gateway:mygateway [ host="xxx.xxx.xxx.xxx", code="MyCode" ] {
0220 Bulb1 [ id=65537 ]
0220 Bulb2 [ id=65538 ]
0220 Bulb3 [ id=65539 ]
0220 Bulb4 [ id=65540 ]
0220 Bulb5 [ id=65541 ]
0220 Bulb6 [ id=65542 ]
group tradfri_group_Hall1 [ id=140891 ]
group tradfri_group_Hall2 [ id=140892 ]
group tradfri_group_Hall3 [ id=140893 ]
}
.items
Group:Dimmer All_Bright
Group:Dimmer All_Color
Group:Dimmer FirstSecond_Bright (All_Bright)
Group:Dimmer FirstThird_Bright (All_Bright)
Group:Dimmer SecondThird_Bright (All_Bright)
Group:Dimmer FirstSecond_Color (All_Color)
Group:Dimmer FirstThird_Color (All_Color)
Group:Dimmer SecondThird_Color (All_Color)
Group:Dimmer First_Bright (FirstSecond_Bright, FirstThird_Bright)
Group:Dimmer Second_Bright (FirstSecond_Bright, SecondThird_Bright)
Group:Dimmer Third_Bright (FirstThird_Bright, SecondThird_Bright)
Group:Dimmer First_Color (FirstSecond_Color, FirstThird_Color)
Group:Dimmer Second_Color (FirstSecond_Color, SecondThird_Color)
Group:Dimmer Third_Color (FirstThird_Color, SecondThird_Color)
Group:Switch:OR(ON,OFF) FirstSecond
Group:Switch:OR(ON,OFF) FirstThird
Group:Switch:OR(ON,OFF) SecondThird
Group:Switch:OR(ON,OFF) First (FirstSecond, FirstThird)
Group:Switch:OR(ON,OFF) Second (FirstSecond, SecondThird)
Group:Switch:OR(ON,OFF) Third (FirstThird, SecondThird)
Dimmer Light1_Bright (First_Bright) { channel="tradfri:0220:mygateway:Bulb1:brightness" }
Dimmer Light2_Bright (First_Bright) { channel="tradfri:0220:mygateway:Bulb2:brightness" }
Dimmer Light3_Bright (Second_Bright) { channel="tradfri:0220:mygateway:Bulb3:brightness" }
Dimmer Light4_Bright (Second_Bright) { channel="tradfri:0220:mygateway:Bulb4:brightness" }
Dimmer Light5_Bright (Third_Bright) { channel="tradfri:0220:mygateway:Bulb5:brightness" }
Dimmer Light6_Bright (Third_Bright) { channel="tradfri:0220:mygateway:Bulb6:brightness" }
Dimmer Light1_Color (First_Color) { channel="tradfri:0220:mygateway:Bulb1:color_temperature" }
Dimmer Light2_Color (First_Color) { channel="tradfri:0220:mygateway:Bulb2:color_temperature" }
Dimmer Light3_Color (Second_Color) { channel="tradfri:0220:mygateway:Bulb3:color_temperature" }
Dimmer Light4_Color (Second_Color) { channel="tradfri:0220:mygateway:Bulb4:color_temperature" }
Dimmer Light5_Color (Third_Color) { channel="tradfri:0220:mygateway:Bulb5:color_temperature" }
Dimmer Light6_Color (Third_Color) { channel="tradfri:0220:mygateway:Bulb6:color_temperature" }
Switch Ligth1 (First) { channel="tradfri:group:mygateway:tradfri_group_Hall1:group_state" }
Switch Ligth2 (Second) { channel="tradfri:group:mygateway:tradfri_group_Hall2:group_state" }
Switch Light3 (Third) { channel="tradfri:group:mygateway:tradfri_group_Hall3:group_state" }
.rules
//Brightness
rule "Update Second and Third bulb brightness"
when
Item Light1_Bright changed
then
sendCommand(SecondThird_Bright, Light1_Bright.state.toString)
//sendCommand(Third_Bright, Light1_Bright.state.toString)
end
rule "Update Third and First bulb brightness"
when
Item Light3_Bright changed
then
sendCommand(FirstThird_Bright, Light3_Bright.state.toString)
//sendCommand(Third_Bright, Light3_Bright.state.toString)
end
rule "Update First and second bulb brightness"
when
Item Light5_Bright changed
then
sendCommand(FirstSecond_Bright, Light5_Bright.state.toString)
//sendCommand(Second_Bright, Light5_Bright.state.toString)
end
//Colour
rule "Update Second and Third bulb Colour"
when
Item Light1_Color changed
then
sendCommand(SecondThird_Color, Light1_Color.state.toString)
//sendCommand(Third_Color, Light1_Color.state.toString)
end
rule "Update Third and First bulb Colour"
when
Item Light3_Color changed
then
sendCommand(FirstThird_Color, Light3_Color.state.toString)
//sendCommand(Third_Color, Light3_Color.state.toString)
end
rule "Update First and second bulb Colour"
when
Item Light5_Color changed
then
sendCommand(FirstSecond_Color, Light5_Color.state.toString)
//sendCommand(Second_Color, Light5_Color.state.toString)
end
//On / off
rule "Turn on / off all bulbs when Trådfri group 1 command"
when
Item First received command
then
val today = now
val startOfDay = (today.millis - today.getMillisOfDay)
val triggerTime = startOfDay + 79200000
if(receivedCommand == ON && today.millis >= triggerTime) {
All_Bright.sendCommand("50")
}
else {
SecondThird.sendCommand(receivedCommand)
}
end
rule "Turn on all bulbs when Trådfri group 2 command"
when
Item Second received command
then
val today = now
val startOfDay = (today.millis - today.getMillisOfDay)
val triggerTime = startOfDay + 79200000
if(receivedCommand == ON && today.millis >= triggerTime) {
All_Bright.sendCommand("50")
}
else {
FirstThird.sendCommand(receivedCommand)
}
end
rule "Turn on all bulbs when Trådfri group 3 command"
when
Item Third received command
then
val today = now
val startOfDay = (today.millis - today.getMillisOfDay)
val triggerTime = startOfDay + 79200000
if(receivedCommand == ON && today.millis >= triggerTime) {
All_Bright.sendCommand("50")
}
else {
FirstSecond.sendCommand(receivedCommand)
}
end
Please be aware that I have no sitemap here because the scope of my own solution is not to control the devices (light bulbs) from a smartphone or other device but simply to enable the use of multiple remotes to control the same light bulbs.
Each remote is paired with two bulbs hence the first, second and third groups.
I expects that IKEA will release more features to the IKEA Trådfri Gateway in the future whereas one of them will be to zone or link several remotes and light sources together either by doing what this solution does through OH2 directly as a setup in the gateway or by using the gateway as virtual bulbs which the remotes binds to and then by configuration can do the trick without any delay thus tricking the remotes to believe they are controlling a device directly.
If I had a ZigBee dongle I would have used a ZigBee binding to try to do this very trick (act like a virtual device) and react to the remotes directly to have OH completely control the bulbs.
If someone can build a specialised ZigBee binding working like that it could completely remove the need of the gateway entirely.
EDIT: Updated with ON/OFF from remotes (group actions).