Help im new to rule machine and hubitat

When I close the door the lights don't change to 100 brightness why is this? FYI im new

Update they change to 100 brightness after 5 minutes then 5 seconds later then turn back to 20 brightness why is this?

UPDATE: lol, I'm dumb forgot to check if the door was open on the motion one well wondering tho is there any way to improve this automation? FYI The automation I have works now.

1 Like

I'm not sure if this is just best practice but when mixing AND and OR statements in an IF statement I always use sub-expressions as it defines the logic in an unambiguous manner, these are displayed within Brackets.

Edit:
It would look something like this:
image

2 Likes

What are your triggers for this rule? Post a screen shot of the entire rule. Also, you have a lot of dead spots in your time conditions.

For example:
Time between 2:00 PM and 4:00 PM
is evaluated true between 2:00:00.000 and 3:59:59.999. It's fine to have the end of one time condition the same time as the beginning of another.

And just to be complete
Time is 2:00 PM
is evaluated true between 2:00:00.000 and 2:00:59.999

2 Likes

like this?

Yes that's what I meant. :+1:

The last two ELSE-IF's may also be competing with one another, one waits for the contact sensor to open, the other checks if it is open, but one block turns the lights off, the other dims to 20. I know they are checking at different times, but I expect this will only be evaluated when the rule triggers.

Looking more broadly at the rule, it looks like you are wanting different behaviour at different times of the day, plus a few other conditions around your motion, contact and lux sensors. I suggest it may be worth splitting the rule up, potentially into the logic for different times throughout the day, to keep the logic being considered at any one time more easily understood. You could use Required Expressions to ensure separation of when each rule is in play. That said, you will need to consider (like you do have to already) how to manage when the rule has fired and is actively waiting across time periods, like the issue I mentioned above.

Another more general comment, I tend to avoid automating my lights based on sequences of events, like a contact sensor opens, turn the lights on, wait for it to open again, turn them off. If people don't follow the exact pattern of behaviour the rule can quickly get out of sync with what people expect / need. Typically a longer cool-down period and / or use of motion sensors (or both) can keep the lights on in most cases long enough.

You don't technically need the parenthesis around the first group of AND statements, but can understand if you have them in there already it can sometimes be a bit awkward to remove them.

question how do I make it so that if there is no motion for 5 minutes turn off the lights? I only had this hub for about 3 days now so I'm still learning

everything works?

There are quite a few different ways of achieving this.... But it also depends on how your rule is triggered.

One option is to have a rule triggered by motion becoming active, then in the actions waiting for motion to become inactive, then waiting a further 5 minutes, making sure that these can be cancelled by motion becoming active again (I often struggle remembering how some of this works...).

Another is to install and configure the Zone Motion Controller Built-In App. This allows you to combine motion sensors together to produce a single motion sensor device. You can also control the cool-down time, i.e. how long before it goes inactive, which you could set to 5 minutes or something smaller to account for the cool-down on your own physical motion device. You could then use this zone motion device in your rule.

More generally, you may want to look at the Room Lighting App. It's a steep learning curve for some, but I would argue no more than setting up a complicated RM rule. It has some more targetted settings for the kind of things you are trying to achieve in your rule, without the need for you to consider some of the finer details in setting them up, like this 5 minute time period.

Guessing you mean the ELSE-IF's... Yeah, I think you're right, not an issue, ignore me.... :slight_smile:

Oh okay well you have a great day :slight_smile:________________

I see thanks and 1 more question how would I slowly dim the lights over 20 seconds until motion is detected again and if the motion was not detected over 20 seconds the lights turn off?

This may depend on what your lights are capable of (within HE), but there is often a start and stop level change I think it's called. I think you should be able to initiate it as an action, then wait, making sure to cancel it if something needs to interrupt the dimming.

I use sengled color bulbs

alr well thanks for the help

One thing that stuck out is you can cut out a number of lines of the rule to make it a little clearer to read. Instead of saying

IF(time between A and B AND contact open) THEN
****Stuff****
IF(time between A and B AND contact closed) THEN
****Other stuff****

You can say:

IF(time between A and B) THEN
     IF(contact open) THEN
           ****stuff****
     ELSE
           ****other stuff****
     END-IF
END-IF
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.