Piston fires when variable changes. I don't want it to


#1

1) Give a description of the problem

I want to suppress notifications in certain situations so I created a global variable that I can set to true or false. When I get ready to leave the house, the variable gets set to false, a 2-minute wait occurs, and then it gets set to true. I then use the variable’s true or false state to determine if push or speech notifications should be generated. This is intended to temporarily stop the barrage of notifications I get when I leave the house (“motion in the garage”, “garage door has been opened”, “motion in the driveway”, etc.).

It sort of works but sort of doesn’t. I don’t get the notifications when the events are detected but I get them all when the global variable changes back to true two minutes after being set to false. The variable in question is @sendSpeakNotifications. Blue Iris fires the piston shown in the screenshot when one of my camera detects motion. The same thing is happening with other pistons that fire when a camera detects motion.

I’d appreciate any help in figuring out why the piston fires when the global variable changes to true, causing the notifications to be generated. The piston should run but because @sendSpeakNotifications is false, just ignore the send push or speak commands. I’ve included a screenshot of the variable’s settings.

2) What is the expected behavior?
Because the @sendSpeakNotifications is false the piston should run but skip the lines that generate notifications.

3) What is happening/not happening?
As soon as the @sendspeakNotifications variable changes to true, the notifications get sent.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach any logs (From ST IDE and by turning logging level to Full)

Received event [Home].mode = Away with a delay of 152ms
+180ms ║RunTime Analysis CS > 32ms > PS > 71ms > PE > 76ms > CE
+182ms ║Runtime (40426 bytes) successfully initialized in 71ms (v0.2.100.20171211) (181ms)
+183ms ║╔Execution stage started
+194ms ║║Comparison (string) :9984339f75f446f9c06978e611709967: is_any_of (string) :fd6b2fd9366cdca291a786245b40fcf7:,:4f87089617dfb9cee9d4ec80da10baf8: = false (3ms)
+196ms ║║Cancelling condition #6’s schedules…
+196ms ║║Condition #6 evaluated false (7ms)
+197ms ║║Condition group #3 evaluated false (state did not change) (8ms)
+204ms ║║Comparison (boolean) true is (boolean) true = true (2ms)
+206ms ║║Cancelling condition #11’s schedules…
+207ms ║║Condition #11 evaluated true (6ms)
+212ms ║║Comparison (string) :9984339f75f446f9c06978e611709967: is (string) :9984339f75f446f9c06978e611709967: = true (1ms)
+213ms ║║Condition #12 evaluated true (5ms)
+214ms ║║Cancelling condition #10’s schedules…
+215ms ║║Condition group #10 evaluated true (state changed) (15ms)
+218ms ║║Cancelling statement #7’s schedules…
+238ms ║║Executed virtual command sendPushNotification (16ms)
+241ms ║╚Execution stage complete. (58ms)
+243ms ╚Event processed successfully (242ms)


#2

Try making the variable condition a restriction instead, but what you have there should really be working.

Edit: what changes the variable?

As it is now, a mode change will trigger a motion notification.

If mode change is also changing the variable via a different piston that would explain what you are seeing.

If you want the piston to only fire from the BI execution then unsubscribe from the mode conditions.


#3

In the logs I can see that the variable was True when this piston ran. And the mode was Away. So I see why this one sent you the message. As Robin was asking, what changes the variable?

image

Just another option, have you considered Pausing and Resuming the pistons that are sending you these notifications?


#4

I use Ask Alexa (“Alexa, tell the house I’m leaving.”) to fire a piston that sets the variable when I leave and a presence change (not present to present) to fire it when I get close to the house.

I looked at logs from various pistons and it does appear to be the mode change that’s causing the notifications to be generated. That would also explain the “random” notifications at sunset when the piston that manages location mode runs. I’ve unsubscribed from location mode and will see what happens. Thanks for your help.


#5

Thanks, @Mike1616. I think @Robin is right about it being a change in location mode that’s causing the piston to run. And thanks for the suggestion about using pause and resume. I had forgotten about those and that’s a great approach to what I’m trying to do.