Execute only once


#1

Hello, thanks for all the examples and code here and the ST forum!
I was trying to get some piston to wake me up if my son’s room is cold in the night so i can close the window.

My piston pretty much looks like this:

if
Alex Room’s temperature is less than 78°F
and
Alex Night Light’s switch is on
and
Date & Time is between sunset and sunrise
then
with
Master Bedroom Lamp
do
Turn on;
end with;
else
end if;
end execute;

This works great, the problem is that the temp sensor reports the temperature every 15 mins and if the temperature hasnt rised, the light keeps on turning on and wakes me up. How would i add any code to do this only once each night? So if it happens tonight at 12.56 it will turn on the light and it will not turn on the light again, until next night if the temp drops below the set point?

Thanks!


#2

I am doing something some what similar…

Maybe you can get some ideas of the code I did.


#3

Change the condition. You have it as temperature is below 78

Swap it to temperature drops below 78

This way it will only happens after the temp dips below the threshold


#4

Simpler way, on the action change the option to only execute on condition state change. It’s called TEP.


#5

thanks for the suggestion.
I will change to drops below, but although it will almost never happen what if the temp goes to over 78 since the window is closed (after i was alerted) and now for some reason the temp drops again under 78, it will alert me again .
The TEP thing sounds more like it, so that will do it only once a day?


#6

It will do it once then require that the condition becomes false before it can do it again. Kind of a rearming mechanism.


#7

I see, could you please help me find TEP? I cannot find it anywhere? Any steps
Thanks!


#8

Here is a piston I use to only have something happen once a day. Create a variable called lastday and compare it to $day.


#9

Click on the with for the master bedroom lamp. and you will see this. Change the TEP


#10

Thank you for that post. I’m seeking to begin working with variables, but the examples out there have too much going on… this one is simple and direct, easy to emulate and then build on.


#11

Sounds like you’re in the boat that I was in 5 months ago. Variables used to confuse the crap outta me, now I’m grasping them.


#12

thanks for the suggestions and screenshots guys , i will implement today and let you know how it went, but pretty sure it will work, thanks again!


#13

Thanks for sharing. Just applied it to a piston I have and it works perfect.


#14

Thanks guys! so far so good! Its working like a champ!