Variable Help - Capture Dimmer Level


I’m trying to capture the existing level of dimmable bulbs that are also being used for notifications when going into certain modes in which the light flashes at 50% twice - after which want them to go back to whatever level they were previously set at. I’m not sure which settings to use within CoRE or even webCoRE to accomplish this task.

Additionally I’d like to have it setup so my piston captures the on/off status so that if the light was on before flashing then it’d turn on at the previously set dim level.


Also trying this in a separate test piston


In webCoRE, you can save the current level to your variable using the format:

set variable currLevel = {[deviceName:level]} (If using Value field)
set variable currLevel = [deviceName:level] (if using Expression field)


also check the capture and restore attributes tasks in wC.


Here is what I had tried out and it works in the sense that dim level is restored, but the part about restoring the on/off status isn’t working. So if the light was already on then it goes back to same brightness and stays on, but if the light had been off then after the piston runs it just stays on. How can I correct t his?


Try adding a second or two after capture and before restore… might have to play with it a bit.


Ok so maybe you can help me out with something then - is there an easy way fo add stuff in the middle of existing code between two existing lines. I’ve been going through and rewriting pistons just to have everything pur together in logical order the way I’d like, which is a pain.


I just add the task at the bottom and drag it by the handle and move it to the position I want… see pic. I hope that’s what you’re referring to.




restore level and switch in separate tasks with 1 second wait in between. like this:

restore level
wait 1 sec
restore switch


Alright here’s what I’ve got now and the only reason your suggestions are not shown being used was because at one point this was working for restoring ;level, state if bulb initially off and just needed to get with bulb initially on fixed.

It no longer turns the light back off and only seems to restore dim level.


yes, i had seen the same in my tests. it sometimes works but not consistently for regular use. if the commands to the bulb arrive too close to one another. the previous one may be overriding this one because with most bulbs it takes a second or say for the level change to be actually executed.

if that continues to be the case, may be worth splitting up the restore in to parts as suggested earlier and see if that works consistently. if not you can always revert it back by keeping a copy of the piston before making the change. :slight_smile: