Trigger on time


#1

1) Give a description of the problem
I have created a piston that’s executed when I leave the house.
In that piston I have some bulbs turning off etc. But I also have a snip to start my Roomba via IFTTT.
I only want the Roomba to start on on Monday, Wednesday, Friday and Saturday if the time is between 3PM and 11PM. But when I create if with the time code it’s created as an trigger and therefore it triggers at 3PM and 11PM.
Is it possible not to create the time as a trigger, but just check if the time is between 3PM and 11PM when the piston is executed?

Another thing that would be great (if possible…):
If I leave the house 2 times on a Monday between 3PM and 11PM the Roomba will start both times. Is it possible to create a variable that counts if the Roomba has started? And in the code check if the roomba has already run today?

2) What is the expected behaviour?
That the roomba only starts between 3PM and 11PM on given days.

3) What is happening/not happening?
Because of the trigger that is created the piston is beeing executed at 3PM and 11PM causing all the bulbs to switch to off.

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

5) Attach logs after turning logging level to Full
[1/26/2021, 10:59:59 PM +67ms
+0ms ╔Received event [Mitt hjem].time = 1611698400000 with a delay of -934ms
+206ms ║RunTime Analysis CS > 42ms > PS > 19ms > PE > 145ms > CE
+209ms ║Runtime (38629 bytes) successfully initialized in 19ms (v0.3.110.20191009) (207ms)
+210ms ║╔Execution stage started
+217ms ║║Cancelling statement #1’s schedules…
+243ms ║║Skipped execution of physical command [gang 1].off([]) because it would make no change to the device. (4ms)
+244ms ║║Executed [gang 1].off (7ms)
+252ms ║║Skipped execution of physical command [gang 2].off([]) because it would make no change to the device. (5ms)
+253ms ║║Executed [gang 2].off (7ms)
+276ms ║║Skipped execution of physical command [Nattbord].off([]) because it would make no change to the device. (19ms)
+277ms ║║Executed [Nattbord].off (22ms)
+285ms ║║Skipped execution of physical command [Nattbord Peder].off([]) because it would make no change to the device. (5ms)
+286ms ║║Executed [Nattbord Peder].off (7ms)
+326ms ║║Executed physical command [Oslo lampe].off() (32ms)
+329ms ║║Executed [Oslo lampe].off (35ms)
+337ms ║║Skipped execution of physical command [Strøm ovn gang].off([]) because it would make no change to the device. (4ms)
+339ms ║║Executed [Strøm ovn gang].off (6ms)
+346ms ║║Skipped execution of physical command [Strøm ovn gjesterom].off([]) because it would make no change to the device. (5ms)
+347ms ║║Executed [Strøm ovn gjesterom].off (7ms)
+5166ms ║║Executed physical command [Strøm ovn kjøkken].off() (4816ms)
+5167ms ║║Executed [Strøm ovn kjøkken].off (4817ms)
+5173ms ║║Skipped execution of physical command [Strøm ovn soverom].off([]) because it would make no change to the device. (3ms)
+5173ms ║║Executed [Strøm ovn soverom].off (5ms)
+5181ms ║║Skipped execution of physical command [Strøm ovn stua].off([]) because it would make no change to the device. (4ms)
+5181ms ║║Executed [Strøm ovn stua].off (6ms)
+5188ms ║║Skipped execution of physical command [Taklampe gjesterom].off([]) because it would make no change to the device. (4ms)
+5189ms ║║Executed [Taklampe gjesterom].off (5ms)
+5195ms ║║Skipped execution of physical command [Taklampe kjøkken].off([]) because it would make no change to the device. (3ms)
+5196ms ║║Executed [Taklampe kjøkken].off (5ms)
+5204ms ║║Skipped execution of physical command [Taklampe soverom].off([]) because it would make no change to the device. (6ms)
+5205ms ║║Executed [Taklampe soverom].off (8ms)
+5217ms ║║Executed physical command [Taklampe stue].off() (10ms)
+5218ms ║║Executed [Taklampe stue].off (12ms)
+5222ms ║║Executed virtual command [gang 1, gang 2, Nattbord, Nattbord Peder, Oslo lampe, Strøm ovn gang, Strøm ovn gjesterom, Strøm ovn kjøkken, Strøm ovn soverom, Strøm ovn stua, Taklampe gjesterom, Taklampe kjøkken, Taklampe soverom, Taklampe stue].sendPushNotification (0ms)
+5234ms ║║Comparison (time) 82804292 is_between (time) 54000000 … (time) 82800000 = false (7ms)
+5236ms ║║Condition #5 evaluated false (11ms)
+5237ms ║║Cancelling statement #5’s schedules…
+5242ms ║║Requesting time schedule wake up at Wed, Jan 27 2021 @ 3:00:00 PM CET
+5244ms ║║Condition group #4 evaluated false (state did not change) (19ms)
+5246ms ║╚Execution stage complete. (5036ms)
+5247ms ║Setting up scheduled job for Wed, Jan 27 2021 @ 3:00:00 PM CET (in 57595.687s)
+5255ms ╚Event processed successfully (5256ms)]


#2

I think you can remove the subscription to get it to do what you want.

If you edit the piston, click on the if condition and then the cog for advanced settings. Theres an option there “subscription method” you can change it to never subscribe


#3

As @Paul1964 stated, you can unsubscribe to that trigger making it a conidition. In pistons that don’t have a trigger, webCore use conditions as triggers where possible.

Very possible. create a local boolean variable, runOnce, for example. set it to true after you send the start command. You will need an addtional line of code to reset it to false everyday.

IF 
	Time is between 3 and 11....
	AND
	runOnce is FALSE
THEN
	Send start_roomba...
	Set runOnce to true

Everyday at 1am
	Set runOnce to FALSE

#4

You can turn off subscriptions for the time period, or you can turn off event subscriptions for the piston as a whole in the piston settings.


#5

Thanks alot! This was the solution I was looking for :smiley: