Switch a Mixed Group to on with toggle command
Posted: Wednesday 11 December 2019 20:52
Hi there,
I am totally new with DzVents scripting so looking for a solution / tip for the following issue:
I have a Aqara dual rocker wall switch, named "Gang schakelaar' and I want to control the following lights / group with the the Aquara outputs B1, B2, B3 & B6.:
- Group "Woonkamer" (with 5 lights) toggle on B1 input - (single push lh switch)
- Light "Eettafel" toggle on B2 input - (single push rh switch)
- Light "Vloerlamp" toggle on B6 input - (dual push rh switch)
- Light ''Tuinverlichting" toggle on B3 input - (dual push lh switch)
Used the following code:
All is working fine as long as the group "Woonkamer" is in the state On or OFF.
As soon as this group in in the state "Mixed" the toggelGroup command is not working.
Is there a way to switch my "Woonkamer" group to on when it is in a mixed state?
Perhaps my approach on this is totally wrong, please let my know, any tips are much appreciated.
Greetings, Harald
I am totally new with DzVents scripting so looking for a solution / tip for the following issue:
I have a Aqara dual rocker wall switch, named "Gang schakelaar' and I want to control the following lights / group with the the Aquara outputs B1, B2, B3 & B6.:
- Group "Woonkamer" (with 5 lights) toggle on B1 input - (single push lh switch)
- Light "Eettafel" toggle on B2 input - (single push rh switch)
- Light "Vloerlamp" toggle on B6 input - (dual push rh switch)
- Light ''Tuinverlichting" toggle on B3 input - (dual push lh switch)
Used the following code:
Code: Select all
return {
on = { devices = { "Gang schakelaar" } },
execute = function(dz, switch )
if switch.state == "B2" then
dz.devices("Eettafellamp").toggleSwitch()
elseif switch.state == "B6" then
dz.devices("Vloerlamp").toggleSwitch()
elseif switch.state == "B3" then
dz.devices("Tuinverlichting").toggleSwitch()
elseif switch.state == "B1" then
dz.groups("Woonkamer").toggleGroup()
end
end
}As soon as this group in in the state "Mixed" the toggelGroup command is not working.
Is there a way to switch my "Woonkamer" group to on when it is in a mixed state?
Perhaps my approach on this is totally wrong, please let my know, any tips are much appreciated.
Greetings, Harald