1) Give a description of the problem
I have a piston which sends a push notification if the external temperature is higher/lower than my thermostat’s target temperature when it’s heating/cooling respectively and the windows are closed. It’s an indefinite loop which keeps running as long as the conditions are met. I added a wait statement to limit it to 1 notification per hour.
2) What is the expected behaviour?
I was expecting to see at the most 1 notification for this in an hour.
3) What is happening/not happening?
The wait is being bypassed by new events which trigger the piston causing a notification to be sent way more often.
**4) Post a Green Snapshot of the piston
5) Attach logs after turning logging level to Full
7/14/2020, 7:29:19 AM +43ms
+2ms ╔Received event [Multi (Master Bed)].temperature = 71.2 with a delay of 78ms
+118ms ║Runtime (43869 bytes) successfully initialized in 43ms (v0.3.110.20191009) (116ms)
+119ms ║╔Execution stage started
+314ms ║║Executed virtual command sendPushNotification (8ms)
+317ms ║║Executed virtual command wait (0ms)
+318ms ║║Requesting a wake up for Tue, Jul 14 2020 @ 8:29:19 AM MDT (in 3600.0s)
+322ms ║╚Execution stage complete. (204ms)
+323ms ║Setting up scheduled job for Tue, Jul 14 2020 @ 8:29:19 AM MDT (in 3599.996s)
+338ms ╚Event processed successfully (338ms)
7/14/2020, 7:21:18 AM +115ms
+1ms ╔Received event [Multi (Master Bed)].temperature = 71.3 with a delay of 96ms
+142ms ║Runtime (43869 bytes) successfully initialized in 56ms (v0.3.110.20191009) (140ms)
+143ms ║╔Execution stage started
+348ms ║║Executed virtual command sendPushNotification (7ms)
+350ms ║║Executed virtual command wait (0ms)
+352ms ║║Requesting a wake up for Tue, Jul 14 2020 @ 8:21:18 AM MDT (in 3600.0s)
+355ms ║╚Execution stage complete. (213ms)
+357ms ║Setting up scheduled job for Tue, Jul 14 2020 @ 8:21:18 AM MDT (in 3599.996s)
+369ms ╚Event processed successfully (369ms)
7/14/2020, 7:20:37 AM +370ms
+0ms ╔Starting piston... (v0.3.110.20191009)
+491ms ║╔Subscribing to devices...
+546ms ║║Subscribing to E. Window (Master Bed).contact...
+555ms ║║Subscribing to W. Window (Master Bed).contact...
+563ms ║║Subscribing to Nest Thermostat - Hallway.thermostatMode...
+573ms ║║Subscribing to Multi (Master Bed).temperature...
+625ms ║╚Finished subscribing (144ms)
+874ms ╚Piston successfully started (874ms)
As can be seen from the logs, anytime the temperature inside or outside the room changes, it triggers the piston to run.
The only thing I can think of is to create another piston (callee) which pauses the caller piston, loops on the same conditions but doesn’t subscribe to them and resumes execution of the caller piston when the condition fails. Is there a better way to go about this?