Restoring Attributes to Lights on Motion


#1

1) Give a description of the problem
Lights not restoring properly after motion

2) What is the expected behaviour?
I want my kitchen lights (all Osram Smart+ GU10 RGBW) to restore to the state they were in when motion stopped, when there is motion

3) What is happening/not happening?
I’ve tried a few goes to get them to be properly dynamic, but they’re pretty random. I want each light to come back exactly as it was - so if it was blue come back blue, if it was daylight come back daylight. If it was at 20% come back at 20%, if it wasn’t on then don’t come back on.

I have everything setup so I can reference the lights individually, through a variable that includes them all, or through a simulated bulb that controls them all at the same time.

No matter what I do though, the results are random.

Is there not just a ‘come back exactly as you were’ command somewhere???

Hope someone can help, @bangali perhaps? Your stuff is great.


#2

I am not familiar with those lights specifically, but with many bulbs, we have this dilemma:

  • Changing the RGB color does not mean the colorTemp syncs
  • Changing the colorTemp does not mean the Hue & Saturation syncs
  • Changing the Hue & Saturation does not mean the RGB color syncs

Yes, this is very strange, but I have seen it time and time again. (the blame lies with the bulb’s manufacturer and/or the Device Handler used) The “best” strategy is to use only one of the three methods, and only match and recall that single method. Trying to match all 3 is almost a guarantee failure.

Note: Matching level should always work if coded properly, no matter which path you choose above.


#3

see an example in the first post on how to restore lights here:


#4

Thanks. I’ve set that up to run exactly as suggested for the Restore but on a Device Variable that contains the 10 spotlights I’m interested in. (Each of which might have different levels and colour temps / colours at the time…) I’ll let you know how it goes.


#5

Interesting. Seems to work fine in terms of on / off / level but it restores random colours rather than the colour temp. (I just restored HSL though, so I guess that kind of makes sense.)

The only thing I can think of is to check each bulb’s mode for white or colour prior to save and branch accordingly. Feels really cumbersome though…

Any better ideas?


#6

not a big deal to check each bulb for color or color temp mode on restore using a loop. question is how do you plan to check whether the bulb was in color or color temp mode when saved?


#7

thanks @bangali. not sure if you got my email reply so i’ll repeat it here. how do i sort the bulbs in the loop? what value can i access that will tell me if a bulb is in color or colortemperature mode before i switch it off? the virtual switch i use to control a group of lights gives me access to a $bulbmode value that tells me if a bulb is in color or colortemperature (which makes my standard ‘kitchen lights’ or ‘bathroom lights’ virtual switch super configurable, but i can’t find this on the list of options available to me on the variable that i capture the lights into for this piston.


#8

$bulbmode is likely a custom attribute which will not be available on the save and restore.

just create a list with your devices and an empty list of strings. then loop thru and save the $bulbmode to the empty list of strings and save attributes for the each device in the device list.

on the restore loop thru the list of devices and check the saved $bulbmode in the list of strings to device which attributes to restore and restore accordingly.


#9

Not sure how to do this? Could you post a very quick example of how I might achieve it? Would really appreciate it.