Basic rules

Im getting fluent with basic rules but not hubitat logic. First if someone can post a link to a how to logic for hubitat might help, for both basic and rules machine. Thank You. Now to the question or problem. Im trying to set up the following rule. If 1hr before sunset to 1hr after sunrise AND motion sensor is triggered then turn game room lights on until no motion is sensed for 5min then off. So I got the time correct but when I try to get a action, everything but motion sensor and switches are listed. Not sure where I went wrong.

I can't point you to a set of notes for the logic, even though there may be some in existence...

So as a Work in Progrss.... And thinking about this as a Rule Machine Rule more than a Simple Rule....

Required Expression:
Time between Sunset - 1 hour and Sunrise + 1 hour

Trigger:
Motion Sensor becomes Active

Actions:
Turn on Game Room Lights
Wait For Event - Motion Sensor Becomes Inactive
Turn off Game Room Lights

There's some things left out of the rule, including the 5 minute delay after motion becomes inactive. There will need to be some input from others on some of these aspects....

1 Like

I have always found the tutorials helpful with regard to learning Basic Rules and RM. Not sure if you will find the logic you are looking for.

With regards to the specific question, Rule Machine would definitely work as @sburke781 describes. Basic Rule should also work. I haven't tested it but here is an example....

Another option is the new Room Lighting app which is also powerful and easy to setup

1 Like

@sakman i have ton of these rules setup but if you add before sunset and after sunrise you have no option to use a switch or motion sensor as the next trigger. So my logic as in ISY would be
If -1 hu sunset to +1hr sunrise
(and)
Game room motion sensor is on
(then)
turn on game room light on
(else)
(if) motion sensor is inactive for 5min
turn game room light off
This is how I would write it in the ISY well using drop down menu.
Hubitat has same logic foe most part but in a different structure. Iv watched some of the videos but several are outdated as hubit keeps evolving and changing for the better. They do give a basic way of doing things but if your new and see that there should be a drop down menu next and video shows it but in newer updates it not there then one can get lost and confused. So the videos are great but outdated. Obviously you cant make a video for every release especially how often hubitat is updated since conception.

I am not familiar with ISY, but if you use Basic Rules as in my example, after you enter the logic to turn on and off based on motion, there are options for restrictions, where you would enter the sunset-sunrise times. Try it and you will see.

If you use Rule Machine, as in @sburke781's example, you would enter the sunset-sunrise times first as a required expression.

If you want to try the new Room Lighting app, which I recommend, there are options to restrict activation between two times.

Edit.....here is a marked up example of Basic Rule showing the restrictions.....

4 Likes

Thats exactly what I was looking for the isy wants restrictions first to see weather it should run where as hubitat wants actions then see if it should run. This is my disconnect with the logic. I think that way more traffic could be avoided if the logic restriction comes first where as it wont even look at a program if conditions are not
meet rather then look at actions then restrictions. But Im not certain to internal operations or logic behind hubitat. Maybe it does same thing just obviously in different order, anyways thanks. Also with isy you would do 1 long program eg. if between 10-12 turn lights on 50% or if between 5-9 turn lights on 70% or if xxxxx continues where hubitat uses rules for each scenario. So for each of these examples I would need another rule. Ill get it with time and help of community. My problem was I added the restriction first rather at the end. This is why I didnt have option for motion or switches. Thanks

2 Likes

100% correct.

And this is why @sburke781 suggested creating your rule with Rule Machine. The equivalent of a Restriction in ISY is a "Required Expression" in Rule Machine.

2 Likes

In RM:

In fact my personal feeling is that even newbies might as well go straight to RM as they usually end up having to go there, and it saves learning an extra skill. Also most of the people in this community who are actively helping people with questions are using Rule Machine more than the other rule apps, and therefore it's easier to help with RM.

2 Likes

sorry for tardy reply im painting cuz soon to be wifie wants a nice house yet she pushes me to get automation right. I have a lil downtime and will play with rm where it per screenshots seems to be more of the logic im used to but many have said not to play with it as it could reek havoc. Im used to the if, then/or, execute logic not the execute but if not meet dont. Basically a condition needs to be meet before it can determine if it needs to continue on, rather then a condition exists and looks for restrictions. Im not sure if one and the same but I will play with rm a bit and glad to hear there are more people there because my setup is good and strong and getting past basic rules