Boolean Variable Value (Default)

59 views
Skip to first unread message

Bill L

unread,
Jul 7, 2020, 3:42:39 PM7/7/20
to ImSmart.tech
Hi there,

I'm new to all this and learning as I go. I did find my own solution, but I am wondering if there is a better way to achieve this.



so it all works the way I have it, but i'm wondering if there's anyway to have a variable automatically default back to a setting after being changed...

i have in IFTTT

weather app at sunset to webhook Sunset variable to True, and another to webhook Sunrise variable to False, also 2 more for the opposite...so at sunrise..Sunrise goes True, and Sunset goes false, and the opposite happens at sunset.

Ring Var to go true when doorbell is rung. and trigger for Ring true AND Sunset true = Action turn on porch lights.




Since that will evaluate the trigger at sunset each day, if Ring stays true...it will set off trigger actions every day at the time of sunset. 

So i currently have a ringGoFalse webhook to webhook  set Ring to false setup in IFTTT and a 2nd trigger...

Ring true = Action 10 second delay, then ringGoFalse............so it will flip the variable back to false after it happened.



is there an inherent way to do this? or is what I setup the way it would have to be done?

thanks!

Bill L

ImSmart.tech

unread,
Jul 7, 2020, 3:54:55 PM7/7/20
to ImSmart.tech
Hi Bill,

I think you can simplify.
Just have a single variable Sunlight.
At sunset you set it to False
At sunrise you set it to True

Then call appropriate action on each trigger.

Paul
ImSmart.tech

Bill L

unread,
Jul 7, 2020, 3:59:38 PM7/7/20
to ImSmart.tech
I will definitely simplify that, thanks...

but what about the doorbell ring?

There is no way to have it the variable go back to false on its own, correct?

like evaluate to true when pushed so the trigger can fire, but immediately go back to false?  

Like i said, it works with my 2nd trigger setting it back to false with a 10 second delay, but just wondering if there was some setting to have a variable go back to a default value on it own.

no biggie either way, just figured I would ask

ImSmart.tech

unread,
Jul 12, 2020, 10:54:21 PM7/12/20
to ImSmart.tech
The way you do it works but that's not the point of a variable.
A variable is a state and does not change its value without an event but using a delay to call an event works.

I am just wondering why you need it to go back to false. Think about the variables as a state and a trigger (or an event) that calls an action when a variable changes.

Regarding the doorbell, you know that you can have IFTTT to call ImSmart to evaluate a trigger. Then you can have your doorbell trigger to be evaluated and turn on porch light if Sunlight = False.
You can a second action 5 minutes later to turn off the light if you wish.

Paul
ImSmart
Reply all
Reply to author
Forward
0 new messages