Hue Lightstrip switched on/off by motion sensor, but color is not changed

Dear community,
I programmed my Homematic motion sensor to switch on a Hue Lightstrip. Strip is switched on and (after a timer) also switched off. But somehow my code is not changing the color… I’ve already checked the community and tried different ways for the sendCommand (predefined variable like below, item.sendCommand (“123,234,123”), sendCommand (item,123,234,123), but without success… The color stays always the same. Any hint or idea?

Thank you for your answers in advance,
Doc MC

item-File

//Gang
Switch HueLightstripPlus1 “Lightstrip” {channel=“hue:0210:00178873b3f2:6:color”}
Color HueLightstripPlus1Color “Lighstrip Farbe” {channel=“hue:0210:00178873b3f2:6:color”}
Dimmer HueLightstripPlus1ColorTemperature “Lightstrip Farbtemperatur” {channel=“hue:0210:00178873b3f2:6:color_temperature”}
String HueLightstripPlus1Alert “Lightstrip Alarm” {channel=“hue:0210:00178873b3f2:6:alert”}
Switch HueLightstripPlus1Effect “Lightstrip Farbeffekt” {channel=“hue:0210:00178873b3f2:6:effect”}

rule-File

var String ColourMorning = “200,0,0”

rule “Bewegung Gang”

when
Item swBewegungGangMotion changed to ON
then
HueLightstripPlus1Color.sendCommand(ColourMorning)
HueLightstripPlus1ColorTemperature.sendCommand(20)
HueLightstripPlus1.sendCommand(ON)
createTimer(now.plusSeconds(10))
[|
HueLightstripPlus1.sendCommand(OFF)
]
end

Do you see anything in the logs when the rule try’s to change the color?

No, I haven’t managed yet to create/check the log files, since it’s running on a Synology Diskstation, where this seems more complicated. And I don’t know how I can write something into the Visual Studio Code output field (e.g. by some command like an ordinary “printf”)…

If a Hue Light strip works like my other Hue color bulbs, setting color temperature wipes out any color setting. In other words, your rule sets the color of the light strip, then it sets the temperature, probably changing your previously set color. Also, you might have to turn it on before setting the color. On my Hue color bulbs can have temperature set when they are off, then when turned on will be that temperature, not sure color works the same.

2 Likes

Hi Andrew,

thank you for your answer. I detected my mistake! Defining the colors, I did not define them as HSB but as RGB. So switching on/off I took over some code I encountered in the forum as follows

HueLightstripPlus1.sendCommand(ON)
var DecimalType hue = new DecimalType(240) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
var PercentType sat = new PercentType(50) // 0-100
var PercentType bright = new PercentType(80) // 0-100
var HSBType light = new HSBType(hue,sat,bright)
HueLightstripPlus1Color.sendCommand(light)
createTimer(now.plusSeconds(5)) [|
	HueLightstripPlus1.sendCommand(OFF)
]

Although there is now an “ambiguous feature call” by the line “HueLightstripPlus1Color.sendCommand(light)”, it does work correctly.