Trigger based on a specific point in time


#1

1) Give a description of the problem
I am trying to understand the best way to cause something to happen at a specific point in time that is calculated based on other activity. So in this example I am trying to control lights based on a motion sensor.

2) What is the expected behavior?
Basically, I want the lights to turn off only if there has been a certain period of time with inactivity. The problem I’m having is figuring out how to structure the piston to accomplish this.

3) What is happening/not happening?
The piston I have shared works… most of the time. And I believe the flaw is in the fact that the second if statement is not actually a trigger. Therefore, if the trigger on the motion detector does not occur at the right point in time, the second if never gets executed and the lights never get turned off.

Also, I would like to read any further documentation on webCoRE that may help me understand fully how the system works. It is great and kudos on the design, I just wish I could get a deeper understanding of how the pistons work.

4) Post a Green Snapshot of the pistonimage


#2

Is this the type of thing you are looking for.


Just change for your additional requirements.


#3

This won’t work for what I’m trying to do. Here you’re waiting a set amount of time and then taking the action. In my attempt, more activity will reset the timer causing it to wait longer before turning the light off. I’m basically trying to say, on first activity turn the lights on, if continued activity then leave them on, and if no further activity turn the lights off a set amount of time after the last activity was captured.


#4

That is what this does.
Can you see the red N by the with?
This is Task Cancellation Policy set to never.
This means if the sensor becomes active again within the 10 minute window.
The timer stops and will restart from 10 minutes again when the sensor becomes inactive.
In theory this could carry on indefinitely and the light would never turn off.


#5

I apologize, I clearly have a lot to learn about the language for these pistons. What is the condition for the @luxvalue about?

And can you point me to any reference documentation that would explain things like the task cancellation policy further? I’m struggling to find anything more than the basic stuff in the wiki.


#6

The global variable @luxvalue is a couple of lux sensors that I use to save the value into the variable.
I then use this as a condition for my lights.
If the light level is above a certain value then the lights don’t turn on.
I use a variable because if I need to change the sensor I only need to alter the variable not 10 pistons.