Motion light by time and lux

Just trying to think the most efficient way to write the rule
If motion, and lux less than 50 then
If between 7.30 and 8 on brightness to 10%
If between 8am and 8pm on brightness 90%
Else turn off after 5min no motion

Here is a rule I have for a hall light.
The dimmer level is set by mode.
Instead of using modes in the IF-THEN add Time is between a and b and set level to x.
Follow it with an ELSE-IF time is between c and d set level to y.


Or this maybe.


hows that look, ive done the simple one first, the plan is to clone it and add more time variables

or should i have, else if sensor inactive and light on THEN
??

Personally I only like my rules to be fully evaluated when I want them to. i.e. when lux is below 50. Hence the first IF and Exit Rule.
Your complete rule will be evaluated every time motion changes and it will turn the light off even though you are in bright sunshine and the light is off.
I would also put the cancel delayed actions in the rule itself.
Also you can put both times in the same rule. Have a look at my second post and see what you think.
That's just my preference though and there are lots of ways to skin a cat as they say. :wink:

Many ways hence the post to get alternatives and feedback
Thought process...
Cancel - put first to purge any delays
No exit rule - always turn off light when its bright ie if light was turned on out of time window, if curtains are opened when light was on.

But I could move the else if to the beginning and have exit rule, would that kill the delay?

I would leave it as it is then.
Maybe turn on all logging for the rule and let it run.
Have a look at the logs and see how 'chatty' it is and whether it throws up anything that you might need to change to make it more efficient.
If it works, it works and that is all that really matters. :+1::grin:

this?
image

it seams exit rule kills the timer v3
edit i was wrong with "it seams exit rule kills the timer"
image

You don't need two rules. Just put the other dim level into an else wtihin the one rule. Having two rules trigger will end up causing double messaged to turn the lamp off.

That looks better than your first attempt.
Personally I hate having 2 IF-THENs in a rule that is why I use IF-THEN followed by ELSE-IF if needed.
You could have just copied mine above and deleted the IF >50 EXIT RULE part at the beginning. It would work the same as you are proposing.

Again, lots of ways you can do things.

I've been using this for nearly 2 years now... the only thing I did recently was added modes (yes slow to the mode party)

Enjoy whatever you decide to implement
Rick

v4 - exit dosnt kill the rule, i didnt have logging on :confused:
image

v5 o so many options
image

cloned version
image

but will have to create from scratch as there is a bug where it hangs onto the old values




@mike.maxwell should the 'FB' variables still be there?

No you don't. Once you modify the rule it will use the new values. The old values in the rule's properties screen will not be used. This is cosmetic and an artifact.

Well using the rule as above it's been locking my z-wave repeatedly. Flicked it back to motion lighting and touch wood no lock up.

@bobbyD, @mike.maxwell are we sure these ghost in app's arnt causing problems in the background?