Rule don´t trigger when lux is 0, why?

Have created a rule that should turn on lighting on weekday mornings if it's dark outside

The rule's log shows that it was triggered at 05:18 this morning

I do not understand why it is not activated at 04:33 when the sensor reports a current value of 0 lux. The rule is not activated until 05:18 when the sensor reports 1 lux, why?

These are the sensor settings.

Really appreciate if someone can take the time to explain what this is due to and suggest a solution that will trigger the rule as desired.

Most likely it was not seen as an Event by RM, because, I'm assuming, the reading prior to 4:33 was also zero and so there was no change in it's state at 4:33. To confirm my theory, you could open the Device page for the sensor and look at the Events section (there's a button at the top of the page to access these). I believe the entries in there should line up with what would be considered events that could trigger automations. Just because the driver chooses to record an entry in the log, does not mean an Event fired, they can be two separate things.

There are probably a few different options.... Best I can think of would be....

Given light in theory would only be increasing at this time of the morning, if changing at all, I think you could just have a trigger for 4:30am in the morning. Then add an IF condition around all the Actions, checking that the lux is <10.

If the lux is >10 at 4:30am then nothing will happen.

What do you think?

Thanks for quick reply. As a novice it is not always easy to understand answers from more experienced users, but now I have understood the difference between Log and Event, you were right in your assumption. Another piece of the puzzle has fallen into place :-).

Regarding your proposed solution (I live in Sweden which means there is a difference of about 6 hours between when the sun rises in summer and winter respectively, that's why I created this rule).
If you use the lux value in an Action, instead of as a Trigger, does it use the latest Log value or the latest Event value?
Is this how you envisioned the rule to look?

After similar issues with a rule, another (more experienced) user suggested I set up an individual rule to capture the transition to a specific lux level. That rule switches a hub variable true/false and that variable is then used in the rule. It ensures the rule only fires once. Here's an example of mine, which I'm using for some outdoor lighting:

The above captures the moment the lux falls below 15. I then use that variable being true as a required expression in the rule that switches my outside lights.

1 Like

You don't need to worry about the log, that is purely there to capture whatever the developer of a driver or app chooses to, when they choose to and configuration you choose may also influence what get's logged.

What RM (and other apps) will refer to in situations like a condition in the actions section will be the current state, typically displayed on the right hand side of the device screen. So, the easiest way to think about it is, you have an attribute of some kind that helps describe what is happening with the device, lux, temperature, etc. At any time the value of that attribute can be checked, e.g. in conditions this case. When that attribute moves from one value to another, that is what we would call an event. These events can be used to trigger something to happen, such as in a Rule.

Hopefully that helps....

With the rule, that is essentially what I was thinking. You can remove the ELSE at the bottom of the Actions.

The only other thing to point out is that the lights will only ever turn on at 4:30, then turn off whenever the lux is > 14 or you reach 7:30am. The only time they won't turn on at all will be if it is light enough at 4:30am, i.e. lux > 10. Will that satisfy your situation?

Another good option @johnwill1. I think the rule @svanberg_pierre has setup still caters for that in one rule, but it's always good to have options. The variable would also be useful if you wanted to trigger a few different rules off the same event, allowing you to manage the logic in one spot.

1 Like

@sburke781 Many thanks for your help and for taking the time to explain in detail. Yes, that's exactly the feature I'm looking for.
@johnwill1 that was interesting, I have a number of different rules governing indoor and outdoor lighting, the solution you use might be something for me to try.


Download the Hubitat app