Confused by the behaviour of this piston


#1

1) Give a description of the problem
The piston is running every minute, I think I know why I just don’t know how to stop it. I have the lux sensor reporting what the lux is every minute, which when I had the piston set to “is below” it was obviously triggering the piston every minute, however I changed this to “drops below” which I thought would prevent it doing this, but it is still happening.

2) What is the expected behaviour?
I am hopping to have the piston run only when the lux value from my sensor drops below the required value, or rises above. Obviously running every time it gets an update is not very efficient as it will run every minute when it should only run if the threshold is breached.

3) What is happening/not happening?
mentioned this above

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

5) Attach logs after turning logging level to Full
No logs, can provide if anyone needs them but I think I just need guidance on the correct setting to chose or the correct evaluation to set the trigger to


#2

if anyone wants to import the whole piston its code is 44jh

be aware that this piston does a lot more than just the snippet above


#6

This is totally true, and the core concept of webCoRE. When you “subscribe” to a device (in your case, Motion Sensor 1’s illuminance), you will see lightning bolts in the left margin. What this does is monitor that device’s attribute, and executes the piston at each changed event…

In your case, when illuminance changes (in either direction), the piston will run thru the entire piston (top to bottom), and execute anything not blocked by conditions.


Two tips concerning this?
Slow down the lux reporting… and/or… Keep a large encompassing block right at the top to immediately cancel out if not “X”… This second tip won’t stop the one minute trigger, but will at least keep the code processing brief.


#7

thanks mate, that gives me some food for thought. I want the lux to report every minute so that as soon as the threshold is breached the lights turn on/off, however I need to find a way to delay the running.

What I might try is to put code at the top like you suggest.

Do you think something like this would work

if the lux reading is more than 100 different to the threshold
cancel the piston run
else
keep running


#8

something like this


#9

this was going to cause issues with other parts of the piston so I opted to set the lux sensor to still report every minute but only report lux if there is a change of 100 or more. This seems to have fixed it.