Illuminance-based replacement for Mode Manager by RM4.0?

I'd like to use RM4.0 to make a replacement for Mode Manager that changes mode in part based on illuminance rather than just sunrise/set +- X minutes. It'll work better on cloudy days. Has anyone done this?

Is this a duplicate post? If so, one of the two should be deleted.

I flagged the other post for deletion by moderator. Can't do it by myself. I think this section may be a better fit for the topic.

So, you're going to try and use Rule Machine? How familiar are you with rule machine? Something as complicated as this shouldn't be the first rule you attempt.

Here are some of the questions you'd need to answer before being able to design a set of rules to manage this:

You say "in part"...what would the other part of the mode management be?
How many modes do you want to break the day up into?
Will you have separate corresponding modes for away or only one away mode?
What about sleeping, will it have it's own mode or do you just want the mode based on luminescence?
How are you going to measure it? Have a physical sensor or going to simulate?
Have you established at what levels you want the mode to be what?
Everywhere in Hubitat where you use mode (HSM, Rule Machine rule with Set dimmer by mode, etc) will have to be expanded to the number of modes you create here.

See what I mean? There are a lot of things to consider. That's why Mode Manager is there, to get you started using mode so you can see what it can do for you and make changes to your setup quickly and easily without breaking anything.

My recommendation, since it seems like you're relatively new to Hubitat is to stick to Mode Manager and see what it does for you.

On a side note, I actually went 10 times deeper than Rule Machine and wrote a custom app and a driver to do this for myself. After finishing it all, I compared when things happened using lux and when they would have happened using sunrise/sunset....only on the extreme weather days (very, VERY cloudy) did it really make that much of a difference. There's a reason Sunrise/Sunset are popular triggers....they work a lot of the time for a lot of people (depending on your climate). In a place like San Diego, it's going to be down-right perfect almost.

If you set up Mode Manager based on Sunrise/Sunset and one day it's getting really dark early because of a storm, you can always change the mode early manually via a dashboard tile. It won't revert back to the setting based on time of day unless you hit a transition time or a transition event occurs (i.e. someone returning).

I'm definitely new on Hubitat, but this is my 3rd smarthome rodeo in approximately 10 years (ISY and a Wink 2 came before). Have been programming for over 45 years.

I have always run sunrise/set +-X before, and am doing it now, but it's really unsatisfactory on dark rainy days. I have a weather sensor in the yard (Ambient WS-2000) which via custom driver gives me an updated value for illuminance every 5 minutes.

The number of Modes I have now should be sufficient and my rules are working OK as is. I just want to trigger one morning-time transition of Mode based on a rising lux value of about 600, and also trigger one evening-time transition of Mode based on a falling lux value of around 400. These transitions are currently triggered by sunrise+10 minutes and sunset+10 minutes respectively. Beside the obvious effect of heavy cloud cover, I find myself adjusting the +X value for winter differently than summer since the sun's arc is so much lower in winter. I'm thinking a couple of illuminance-based transitions would work better than sunrise/set has.

Then that would be easier to do but I will tell you, anything to do with numbers in Hubitat is tricky. Because the rule that you write will fire every time that a value meets the trigger criteria, not just the first time. That is why I found it easier to write my own app, so I could control the device subscriptions. I would first break them up separately, one rule for each. Don't try to join them, you're just going to cause unnecessary headaches.

Once you do that, take a look at what criteria you want to have to make that change. What modes you would want to transition from? For example, would you want it to happen in the morning if you were in away mode. Then build a conditional action based on those criteria. Then you want to include a boolean variable of some type to prevent the rule from firing multiple times, unless you want to maintain the mode if it shifts away from what the rule sets.

I'm using the lux estimation from the excellent Darksky driver to set my Evening mode earlier if it gets dark and reset it to Day​ if it brightens up again. It actually seems to work quite nicely.

1 Like

@Ryan780, thanks for the tips, I'll start keep the rules separate. I still hope that replacing Mode Manager with four or five mode transition rules in RM4 is the cleanest way to go.

@Angus_M, Did you use rule machine to make the Mode changes with lux?

Yeah, using RM. Sorry was away so couldn't easily post how I did it. Here you go....

So I use specific time normally to set modes. But this overides that if it happens to get dark (eg. during bad weather). It seems to work quite well. Will probably replace it with an actual local lux sensor at some point but this works for now.

Thanks! I'll try something similar.

I think you only want to make it day if it gets light early when its night, and you are not away. Also make it evening if it gets dark and mode is day, and not away.

image

I don't use Away mode. I use a separate switch for that.

I separate modes, which for us are time-based due to our schedules and are used for indoor lighting, from outdoor lighting which is triggered by very simple rules based on a lux value or sunset/sunrise. This way on a dark afternoon the outdoor lights may come on before sunset and on a dark morning they may stay on after sunrise. Some trial and error was needed to get the lux value correct but it's working well now. I am using the Sensative Strips sensor located on my front (North facing) porch for the lux value.

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