Hi all,
In my flat I have 58 rgb downlights. Now the tricky part comes how to set them in an easy configurable way.
I have 4 rooms, so i created one group for each: I.e Group_LivingRoom
Then for each room I have several scenes, in some rooms i decided to split the scene up on two scene selector items. I.e
TV,Dinner,Reading,Cooking,OFF
and Bar,Demo,OFF
Then I have dimmer item :Dimmer_LivingRoom
which will set the brightness of the downlights
I also have a color picker Color_LivingRoom
which overides the color
Then I have another scene which is : Warm White, White,Night,Lounge
to set colors
So my idea is to define all my lamp items like this:(Should this be color or dimmer instead?)
Switch rgb_LR1 “Living Room 1” {dmx=“CHANNEL[7,8,9:1000]”} (Group_TV,Group_Dinner,Group_Lights,Group_LivingRoom)
So to control the lamps I need to send the command : sendCommand(rgbLR1,“124,128,354”)
This was my basic idea of how to do it, any comments, wrong approach?
So now the big question is how to do the rules, here is my idea when changing scene
var String redValue
var String greenValue
var String blueValue
rule "tv mode"
when
LivingRoom_Scene changed to 1
then
{
Group_LivingRoom.members.forEach( s |
sendCommand( s, OFF)
)
redValue=redItem.intValue.toString
greenValue =greenItem.intValue.toString
blueValue = blueItem.intValue.toString
dimVal = Dimmer_LivingRoom.value
redValue = redValue*dimVal
blueValue = blueValue*dimVal
greenValue = greenValue*dimVal
Group_Tv.members.forEach( s |
sendCommand( s, redValue +"," +greenValue +"," +blueValue )
)
}
end
the dimmer rule:
var String redValue
var String greenValue
var String blueValue
rule "living Room dimmer"
when
LivingRoom_Dimmer changed
then
{
Group_LivingRoom.members.forEach( s |
sendCommand( s, OFF)
)
redValue=redItem.intValue.toString
greenValue =greenItem.intValue.toString
blueValue = blueItem.intValue.toString
dimVal = Dimmer_LivingRoom.value
redValue = redValue*dimVal
blueValue = blueValue*dimVal
greenValue = greenValue*dimVal
if s.state = ON {
sendCommand( s, redValue +"," +greenValue +"," +blueValue )
}
)
}
end
So is the right path to take? I am new to Java so how can I best verify my rules?