Are you a Newbie, this is your post


#1

Hi and welcome to Webcore.
I’m creating this post to help out Newbies faster.
I will share some basic but most asked situations in this post.
please jump in and add your ideas but please let’s keep it simple so that the post serves new users.
I will be adding new situations as comes to my mind.

#1 - Lights on with motion and lights off if no motion X minutes.
#2 - Lights on with motion and lights off if no motion X minutes BUT with different CONDITIONS.
#3 - Nested IFs and two seperate IF blocks are NOT the SAME.

#1
Lights on with motion and lights off if no motion X minutes.

Probably almost every smarthome user wants to do this as a first thing.
Here is one of the best ways of doing this:

52%20PM

Tips: We tend to use WAIT instead of STAYS INACTIVE but go with STAYS INACTIVE if you don’t want to get your partners annoyed. :joy:

#2
Lights on with motion and lights off if no motion X minutes. BUT with different CONDITIONS

A CONDITION decides when trigger will continue to execute.
Let’s say you want your lights to turn ON only after X time (in this example sunset) but keep them off during the day.

19%20PM

_Tip : Do not use the same condition when turning lights OFF because, If your lights turn ON at 11.59pm and stays INACTIVE for 2 minutes, NOW, it’s past midnight. Your lights will remain ON until next sunset.

#3
Nested IFs and two seperate IF blocks are NOT the SAME.

Line #17 is where your first IF block starts
Line #36 is where that IF block ends.

16%20PM

IF you add another IF - line #27 in this example - this piston won’t work as the one above (example #2)
“IF within IF” works if you have additional conditions.

such as,

10%20PM

In this example,

  • motion sensor gets triggered,
  • piston checks if time is between sunset and midnight
  • IF both are TRUE, now moves on to next statement,
  • IF switch X (could be home status etc) is OFF
    then turns the lights ON.

#2

This thread is a great idea…

If I may give one suggestion it would be to add import codes for the examples.
Some of the simplest commands can be tricky to find for new users.


#3

That is a great idea. I already deleted the above examples but I will keep this is mind for the future pistons.


#4

Thanks.
Can you please elaborate this: " *Tips: We tend to use WAIT instead of STAYS INACTIVE but go with STAYS INACTIVE if you don’t want to get your partners annoyed."