Quick question about restrictions

wait
restrictions

#1

I was reading https://community.hubitat.com/t/using-restrictions-in-webcore/89477 about piston restrictions but I have a question that could be added to the website as an example.
It states that restrictions:

Are evaluated when the piston begins execution.

Take a simple execute command

Only when Hallway light is on
Wait 5 mins
Turn off Hallway light

So does that mean after 5 mins, the Hallway Light will just turn off, even if by then the hallway light is back on?
Or are the restrictions reassessed after a wait command before running the action?


#2

Restrictions are re-assessed each time the piston starts, whether a device event or a timer.

If you enable debugging for the piston (and you are on HE), it should tell you what is going on in the logs.

There is an option setting for 'allow prescheduled tasks to execute’during restrictions, but this is for device fades/repeats only.


#3

Okay so if I had a piston that only had one action:

Only when Hallway Sensor is open
Wait 5 mins
Turn off Hallway light

The light would turn off in 5 mins, even if the hallway sensor was closed in 3 mins, because nothing caused the piston to restart so the restriction isn’t re-assessed, correct?

However, if I had

IF
Hallway Sensor is open
OR
Hallway Sensor changes to open

THEN

Only when Hallway Sensor is open
Wait 5 mins
Turn off Hallway light

Then the piston would restart because it was triggered by a sensor state change.


#4

All makes sense to me…

The restriction is not a trigger, but a condition only. Restrictions will never be subscribed to (if they are in the restriction (‘only when’)

Logs on should tell you what is happening also.

If you think you have a bug send piston code and logs


#5

Ok, think I see a possible problem. Put out a fix on HE if you are using HE

HPM repair…