Global Variable with capture and restore piston review


#1

1) Give a description of the problem
The piston may not work if the lights are off and I’m not sure if I can mix global variables with capture local store.

2) What is the expected behaviour?
Camera motion will capture current state of the lights run the automation for the alert and restore the values.

3) What is happening/not happening?
If the lights are off then this will not work but I don’t want to have the lights on all the time. I also have other pistons like holiday lights and hue ambilight (app) that control these lights.

**4) Post a Green Snapshot of the


#2

I don’t have any of these bulbs but my guess is you need to independently check for on/off. Perhaps use a boolean to store whether it is on or off. Then when restoring, only restore if it was originally on, otherwise, just turn back to off.


#3

I am curious as to why you would loop this 11 times over 66 minutes?!?

Turn White
Flash Pink & Gold for 5min
Wait 1 min
Restore attributes
Turn White
Flash Pink & Gold for 5min
Wait 1 min
Restore attributes
etc…


#4

Would the Boolean (haven’t used before) occur in the first part after the trigger?


#5

Testing and put in a crazy value to see if it works. When I get it to work would reduce but it doesn’t loop for 66 minutes anyway so that isn’t working.

Edit - In fact it only changes once (fast) for one color.


#6

When encountering hurdles, I might recommend to simplify first… not complexify. :grin:


#7

Good point :ok_hand:

Either way the lamps aren’t flashing.


#8

Have you made any changes to the original piston above?


#9

I removed everything and just tried to push a virtual switch to test and the flash didn’t work. The lights are hue bulbs and a gledopto controller and dumb led


#10

Flash (color) does not work with every single device or handler…

Can you go one step farther, and simply make a one line piston to flash one of those lights?
(I reduced the times a bit to make testing faster)

pic

(pressing Test will execute that command… 25 sec later, a Full log will explain more)


#11

Same issue it changes color really fast but doesn’t flash.


#12

I believe that changing color is considered “flashing”.
(IE: “Flash color” affects the color, not the level of brightness)


#13

I see. Well it isn’t a clean flash of color. I think I would prefer it to loop between two colors versus the flash for 60 seconds. The goal is to warn me when the baby cam has motion with the lights.

Another option to pulsing light. 5-6 pulses of light as a warning. I tried the website breathe option but it isnt working.


#14

When I use this piston, it loops between two colors.
(the code says every 4 secs, but in reality, it is every 3-5 seconds)


There is a Flash option (without color) that brightens and dims…

Or you could code it manually:

Set level to 100
Set color to Pink
Wait 4 seconds
Set level to 1


#15

I ended up going the manual route. I still need to fix resetting the color back to original and testing if it works with the lights off.

It doesn’t repeat the action though. But it did alert me albeit slow.


#16

This is a bit ironic to me… Your last piston is trying to change many bulbs to various colors, with absolutely no delay between commands.

In other words, if Switch 31 stays off, a single motion can easily send over a thousand commands within 90 seconds. (it could be 2 or 3 thousand, depending on how many devices you have stored in your @globals)


TL;DR

I think you are asking for trouble, but at the very least, I would add delays to each loop.
(otherwise, each time your baby sneezes, your SmartHome will be crippled)


#17

I have tried both ways and made several changes based on how the lights I am using responded. The issue is the lights (Hue Blooms) are very very slow to make changes. What I see is removing the waits makes the lights cycle through the commands but adding the waits increases the wait more than the automate. So it is not a webcore issue but the lights have a tough time making changes at a set speed.

However, I do understand your point. I have a wait at the end of light automation to let the system breathe a bit.

Also note switch 31 is just a test switch and is removed from the final piston (it was a virtual on/off switch).


#18

Oh sorry. I didn’t realize you were using Blooms… I believe this is intentional, and the way those bulbs were designed.

But don’t get mad, because they have a strength that most bulbs do not have… Internal software to assist with a slow graceful transition between colors. Most bulbs struggle with this, but the Blooms makes it look easy.

In other words, Blooms works better as gentle background colors, but not so good as quick sharp contrasting colors. (I use Philips Hue Color for my “notification” bulb)


#19

Thanks. The way I’m doing it works just not in the way I would like but based on the blooms it is what it is. I like them a lot and they are a nice soft light feature versus my gledopto + leds that are more aggressive.