Hue Light Piston won't store colour?


#1

I’ve got a motion sensor in my kitchen, and I basically want my Hue strips to come on and off with motion. Easy

What I also want though is that if the colour, brightness etc of the bulbs is overwritten by the Hue app, the next time the piston is run, it respects those settings. To do this, I’ve got some variable that are set to the strips current hue, level and saturation params.

I’ve done this in the living room with the Hue bulbs and it works great, however for some reason in my kitchen, it keeps changing them to a pink colour after a while. Any ideas?


#2

Hmmm, there is some strange logic here…

Lines 30-37

With Bulb3
    Set hue to Bulb3's hue
    Set level to Bulb3's level
    Set saturation to Bulb3's saturation 

Lines 38-45

With Bulb7
    Set hue to Bulb7's hue
    Set level to Bulb7's level
    Set saturation to Bulb7's saturation 

Honestly, I would not expect a single thing to happen using the above code.
(it’s like saying, “Charlie, change your name to Charlie”)

I left out the “Turn on” command, (that should still work), but no colors or levels should change with your current wording…


Also, keep in mind if you hard code variables up top in the define section, then you will be forcing those dataPoints each and every time the piston runs.


#3

Here is how I would achieve this:

IF Sensor's motion changes to active
Then
    Turn on light
END IF

IF Sensor's motion stays inactive for 5 minutes
Then
    Turn off light
END IF

With this method, there is no need to capture or store the previous colors. Just send a “Turn on” command, and the colors & levels should stay whatever they are currently.