Hallo,
I want to realize this scenario:
At 8 pm a Hue bulb should switch on with red light and less brightness. I should stay the whole night like that.
At 7 am in the morning it should switch to green light with the same brightness.
rule "Nachlicht Becky green"
when
Item BeckyNachtlicht_green received command ON
then
{
var DecimalType hue = new DecimalType(120) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
var PercentType sat = new PercentType(100) // 0-100
var PercentType bright = new PercentType(5) // 0-100
var HSBType green = new HSBType(hue,sat,bright)
BeckyNachtlicht_Schalter.sendCommand(ON)
BeckyNachtlicht_Schalter.sendCommand(green)
}
end
This rule doesn’t has a time based trigger. I just wanted to figure out, if this rule turns the bulb on and switch to green colour.
If I switch the item “BeckyNachtlicht_green” via sitemap to on the bulb is shining but not in colour green
rule "Nachtlicht Woche"
when
Time cron "0 45 19 ? * MON-FRI *"
then
{
var DecimalType hue = new DecimalType(0) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
var PercentType sat = new PercentType(100) // 0-100
var PercentType bright = new PercentType(5) // 0-100
var HSBType light = new HSBType(hue,sat,bright)
BeckyNachtlicht_Schalter.sendCommand(ON)
BeckyNachtlicht_Farbe.sendCommand(light)
}
end
rule "Morgenlicht Woche"
when
Time cron "0 50 6 ? * MON-FRI *"
then
{
var DecimalType hue = new DecimalType(120) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
var PercentType sat = new PercentType(100) // 0-100
var PercentType bright = new PercentType(5) // 0-100
var HSBType light = new HSBType(hue,sat,bright)
BeckyNachtlicht_Schalter.sendCommand(ON)
BeckyNachtlicht_Farbe.sendCommand(light)
}
end
rule "Nachtlicht Wochenende"
when
Time cron "0 45 19 ? * SAT-SUN *"
then
{
var DecimalType hue = new DecimalType(0) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
var PercentType sat = new PercentType(100) // 0-100
var PercentType bright = new PercentType(5) // 0-100
var HSBType light = new HSBType(hue,sat,bright)
BeckyNachtlicht_Schalter.sendCommand(ON)
BeckyNachtlicht_Farbe.sendCommand(light)
}
end
rule "Morgenlicht Wochenende"
when
Time cron "0 30 7 ? * SAT-SUN *"
then
{
var DecimalType hue = new DecimalType(120) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
var PercentType sat = new PercentType(100) // 0-100
var PercentType bright = new PercentType(5) // 0-100
var HSBType light = new HSBType(hue,sat,bright)
BeckyNachtlicht_Schalter.sendCommand(ON)
BeckyNachtlicht_Farbe.sendCommand(light)
}
end
I tried to put the variables out of the rules at the top to use them for general. But with no success…
var DecimalType hue_green = new DecimalType(120) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
var DecimalType hue_red = new DecimalType(0) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
var PercentType sat = new PercentType(100) // 0-100
var PercentType bright = new PercentType(5) // 0-100
var HSBType green = new HSBType(hue_green,sat,bright)
var HSBType red = new HSBType(hue_red,sat,bright)
rule "New rule"...