Why won't my piston wait for 30 minutes?


#1

1) Give a description of the problem
This is a notification piston if my son’s phone battery is dying. I want the warning every 30 minutes until he’s charging it and the charge is over 20%, but many times it’ll warn me every 10-15 minutes, even though the time is still counting down.

2) What is the expected behaviour?
Warn me every 30 minutes

3) What is happening/not happening?
Warns me in less than 30 minutes. It could be how Life360 monitors his phone, but I just wanted to be sure. Thanks in advance for taking a look.

**4) Post a Green Snapshot of the piston!

5) Attach logs after turning logging level to Full
01/12/2019, 22:26:54 +847ms
+1ms ╔Received event [Life360 Derek].battery = 19 with a delay of 170ms
+123ms ║RunTime Analysis CS > 21ms > PS > 51ms > PE > 51ms > CE
+125ms ║Runtime (40796 bytes) successfully initialized in 51ms (v0.3.110.20191009) (123ms)
+126ms ║╔Execution stage started
+134ms ║║Comparison (integer) 19 is_less_than (integer) 20 = true (2ms)
+135ms ║║Condition #2 evaluated true (5ms)
+144ms ║║Comparison (string) true is (boolean) false = false (1ms)
+146ms ║║Cancelling condition #4’s schedules…
+146ms ║║Condition #4 evaluated false (10ms)
+147ms ║║Cancelling condition #1’s schedules…
+148ms ║║Condition group #1 evaluated false (state changed) (18ms)
+150ms ║╚Execution stage complete. (24ms)
+152ms ║Setting up scheduled job for Sun, Dec 1 2019 @ 10:49:56 PM PST (in 1381.015s)
+168ms ╚Event processed successfully (168ms)
01/12/2019, 22:19:54 +952ms
+2ms ╔Received event [Life360 Derek].battery = 13 with a delay of 201ms
+141ms ║RunTime Analysis CS > 30ms > PS > 59ms > PE > 51ms > CE
+143ms ║Runtime (40796 bytes) successfully initialized in 59ms (v0.3.110.20191009) (141ms)
+144ms ║╔Execution stage started
+152ms ║║Comparison (integer) 13 is_less_than (integer) 20 = true (1ms)
+153ms ║║Condition #2 evaluated true (5ms)
+163ms ║║Comparison (string) false is (boolean) false = true (1ms)
+165ms ║║Condition #4 evaluated true (11ms)
+166ms ║║Condition group #1 evaluated true (state did not change) (17ms)
+168ms ║║Cancelling statement #5’s schedules…
+182ms ║║Executed virtual command sendPushNotification (11ms)
+193ms ║║Executed virtual command sendSMSNotification (6ms)
+200ms ║║Executed virtual command sendSMSNotification (1ms)
+205ms ║║Executed virtual command sendSMSNotification (1ms)
+208ms ║║Cancelling statement #147’s schedules…
+822ms ║║Executed physical command [Echo - Computer Echo].setAlarmVolume([99]) (600ms)
+823ms ║║Executed [Echo - Computer Echo].setAlarmVolume (602ms)
+850ms ║║Executed physical command [Echo - Derek Echo].setAlarmVolume([99]) (22ms)
+851ms ║║Executed [Echo - Derek Echo].setAlarmVolume (24ms)
+1044ms ║║Executed physical command [Echo - Living Room Echo].setAlarmVolume([99]) (188ms)
+1045ms ║║Executed [Echo - Living Room Echo].setAlarmVolume (190ms)
+1047ms ║║Cancelling statement #76’s schedules…
+1051ms ║║Executed virtual command setVariable (1ms)
+1054ms ║║Executed virtual command setVariable (1ms)
+1056ms ║║Cancelling statement #13’s schedules…
+1059ms ║║Executed virtual command wait (0ms)
+1060ms ║║Requesting a wake up for Sun, Dec 1 2019 @ 10:49:56 PM PST (in 1800.0s)
+1064ms ║╚Execution stage complete. (920ms)
+1066ms ║Setting up scheduled job for Sun, Dec 1 2019 @ 10:49:56 PM PST (in 1799.996s)
+1077ms ╚Event processed successfully (1076ms)
01/12/2019, 22:12:54 +761ms
+1ms ╔Received event [Life360 Derek].battery = 15 with a delay of 90ms
+118ms ║RunTime Analysis CS > 27ms > PS > 45ms > PE > 45ms > CE
+120ms ║Runtime (40795 bytes) successfully initialized in 45ms (v0.3.110.20191009) (119ms)
+121ms ║╔Execution stage started
+129ms ║║Comparison (integer) 15 is_less_than (integer) 20 = true (1ms)
+130ms ║║Condition #2 evaluated true (5ms)
+138ms ║║Comparison (string) false is (boolean) false = true (2ms)
+139ms ║║Condition #4 evaluated true (8ms)
+140ms ║║Condition group #1 evaluated true (state did not change) (15ms)
+142ms ║║Cancelling statement #5’s schedules…
+156ms ║║Executed virtual command sendPushNotification (11ms)
+182ms ║║Executed virtual command sendSMSNotification (21ms)
+188ms ║║Executed virtual command sendSMSNotification (2ms)
+194ms ║║Executed virtual command sendSMSNotification (1ms)
+196ms ║║Cancelling statement #147’s schedules…
+444ms ║║Executed physical command [Echo - Computer Echo].setAlarmVolume([99]) (242ms)
+445ms ║║Executed [Echo - Computer Echo].setAlarmVolume (244ms)
+464ms ║║Executed physical command [Echo - Derek Echo].setAlarmVolume([99]) (15ms)
+465ms ║║Executed [Echo - Derek Echo].setAlarmVolume (17ms)
+649ms ║║Executed physical command [Echo - Living Room Echo].setAlarmVolume([99]) (180ms)
+650ms ║║Executed [Echo - Living Room Echo].setAlarmVolume (182ms)
+653ms ║║Cancelling statement #76’s schedules…
+656ms ║║Executed virtual command setVariable (1ms)
+660ms ║║Executed virtual command setVariable (0ms)
+662ms ║║Cancelling statement #13’s schedules…
+665ms ║║Executed virtual command wait (1ms)
+666ms ║║Requesting a wake up for Sun, Dec 1 2019 @ 10:42:55 PM PST (in 1800.0s)
+670ms ║╚Execution stage complete. (549ms)
+671ms ║Setting up scheduled job for Sun, Dec 1 2019 @ 10:42:55 PM PST (in 1799.996s)
+684ms ╚Event processed successfully (684ms)


#2

TCP set to NEVER but try doing that at line 26 instead of line 17.


#3

The way I am reading this is, it triggers at each percent below 20%. (19, 18, 17, 16 etc)
This means you will get 19 messages before his phone dies.

In this case, I believe the 30 min wait serves no purpose, because there are no commands after the WAIT… (IE: you are waiting to do “nothing”)


Another way to say this: If you are subscribed to a device, you can not prevent a trigger from firing that piston. The way it is currently worded, it will execute when any of the “lightning bolt” lines changes.


#4

I missed that WAIT doing nothing… thanks man… it’s very true… Damn Vodka:))))


#5

Since you set the variable @Pistontrigger to $now, you could add another statement to your initial IF.

if addminutes(@PistonTrigger,30) > $now. It would then only activate the piston if it’s been more than 30 minutes since the last message. I am going from memory on the function but it’s something like that.


#6

Something like this? I’ll give it a shot and let you know.


#7

Looks right , you may need to initialize the variable the first time not sure what it comes up with if it’s null. You can just edit the variable and manually set it to $now and then you should be good to go from that point on.

The @ suggest PistonTrigger is a global variable so if another Piston is filling that variable that may be an issue as well.


#8

Wouldn’t you know it…THIS time my son actually plugged in his phone after the first warning…figures, lol


#9

Something you might want to consider, since since the new part is a time based statement. It might be better with something like this

if
$now is after addminutes(@PistonTrigger,30)