Hi there.
I take one of my hue lamps to show light notifications. In this case it starts with the alarm function (blinking in a special color) and the rest of the time (to the end of 1 minute) it will only shine in this special color. The problem is to get the lamp to previous state after notification. Because the lamp itself saves the last state. For example, if i turn it on in white, than change it to red, turn it off and turn it on again, it is red.
So i want to give the lamp white color back after using it. When i turn on the lamp again for normal use i get white light.
I think that the changing of the color already works if the lamp is on.
So my rule is:
var HSBType SchrankPreviousState = null
rule "Blauer Lichtalarm Schrank"
when
Item blueSchrank received command ON
then
if (Schrank_Switch.state == ON){
SchrankPreviousState = Schrank1.state as HSBType
Schrank_Color.sendCommand(HSBType::BLUE.toString)
Alarm.sendCommand("LSELECT")
createTimer(now.plusMinutes(1)) [|Schrank_Color.sendCommand(SchrankPreviousState.toString())]
}
if (Schrank_Switch.state == OFF){
Schrank_Color.sendCommand(HSBType::BLUE.toString)
Alarm.sendCommand("LSELECT")
createTimer(now.plusMinutes(1)) [|var DecimalType hue = new DecimalType(47) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
var PercentType sat = new PercentType(47) // 0-100
var PercentType bright = new PercentType(100) // 0-100
var HSBType light = new HSBType(hue,sat,bright)
Schrank_Color.sendCommand(light.toString())
Schrank_Switch.sendCommand(OFF)]
}
blueSchrank.sendCommand(OFF)
end
This works, but at the end of a notification you can see, that the light goes to white befor it goes off.
And on the other side the notification starts in white light for half a second and changed than to color.
Has someone an idea how i can make it better with hue lamps?
Greetings,
Markus