Stuck- Need help with task cancellation


#1

1) Give a description of the problem
I’m trying to figure out how an action cancels a task and starts the loop over

2) What is the expected behavior?
When the door opens and the light is off, the light turns on. When the door closes and the light is still on, the piston waits for a time then flashes three minutes before turning off to warn you. If within that three minutes you physically toggle the light on (zwave toggle switch) the wait period and flash task start over.

3) What is happening/not happening?
I’m stuck on figuring out the correct actions.

More or less looking for a nudge in the right direction to complete this piston. I’m guessing it’s some sort of loop, but loops are something I haven’t used much so I’m a little stuck.


#2

A log and trace would certainly help us here. Without digging to deep, I would try pulling your second IF out from under the first and put it on it’s own.


#3

Okay, so I messed with it a bit and I’m still having issues (piston and log below). I gave up on the physical interaction as it just wasn’t working, so I need some help there. But before that, I need to get the basic piston straight.

The light turns on when the door opens. When closed, the delay is fine, but the warning “flash” doesn’t happen.

If there is any physical interaction with the switch, everything goes south. Doesn’t turn on when opened or off when closed unless I wait a minute or two. Note, that I removed the physical switch section I mentioned above so this wasn’t a cause.

Below is the revised Piston. Note that minutes are replaced with seconds and seconds are replaced with milliseconds for testing purposes.

> 4/19/2022, 8:06:59 PM +45ms
> +0ms 	╔Received event [Home].time = 1650424020978 with a delay of -1934ms
> +50ms 	║RunTime Analysis CS > 17ms > PS > 5ms > PE > 29ms > CE
> +52ms 	║Runtime (39064 bytes) successfully initialized in 5ms (v0.3.114.20220203) (51ms)
> +53ms 	║╔Execution stage started
> +173ms 	║║Executed physical command [Garage Side Door].off() (99ms)
> +179ms 	║║Executed physical command [Garage Side Door].on([delay: 300]) (6ms)
> +185ms 	║║Executed physical command [Garage Side Door].on([delay: 699]) (5ms)
> +186ms 	║║Executed virtual command [Garage Side Door].flash (116ms)
> +188ms 	║║Waiting for 700ms
> +892ms 	║║Executed virtual command [Garage Side Door].wait (1ms)
> +893ms 	║║Waiting for 2000ms
> +2899ms 	║║Skipped execution of physical command [Garage Side Door].off([]) because it would make no change to the device. (4ms)
> +2900ms 	║║Executed [Garage Side Door].off (6ms)
> +2902ms 	║╚Execution stage complete. (2849ms)
> +2909ms 	╚Event processed successfully (2910ms)
> 4/19/2022, 8:06:50 PM +880ms
> +1ms 	╔Received event [Garage Side Door Sensor].contact = closed with a delay of 90ms
> +57ms 	║RunTime Analysis CS > 15ms > PS > 5ms > PE > 37ms > CE
> +60ms 	║Runtime (39078 bytes) successfully initialized in 5ms (v0.3.114.20220203) (57ms)
> +60ms 	║╔Execution stage started
> +68ms 	║║Comparison (enum) closed changes_away_from (string) closed = false (0ms)
> +69ms 	║║Cancelling condition #3's schedules...
> +70ms 	║║Condition #3 evaluated false (5ms)
> +71ms 	║║Condition group #1 evaluated false (state did not change) (7ms)
> +77ms 	║║Comparison (enum) closed changes_away_from (string) open = true (1ms)
> +78ms 	║║Cancelling condition #55's schedules...
> +79ms 	║║Condition #55 evaluated true (5ms)
> +88ms 	║║Comparison (enum) on is (string) on = true (2ms)
> +89ms 	║║Condition #56 evaluated true (9ms)
> +90ms 	║║Cancelling condition #54's schedules...
> +91ms 	║║Condition group #54 evaluated true (state changed) (18ms)
> +93ms 	║║Cancelling statement #57's schedules...
> +97ms 	║║Executed virtual command [Garage Side Door].wait (0ms)
> +98ms 	║║Requesting a wake up for Tue, Apr 19 2022 @ 8:07:00 PM PDT (in 10.0s)
> +102ms 	║╚Execution stage complete. (42ms)
> +103ms 	║Setting up scheduled job for Tue, Apr 19 2022 @ 8:07:00 PM PDT (in 9s)
> +111ms 	╚Event processed successfully (111ms)

#5

Revised my previous post, this one I tested a little.