Tutorial - Advanced automatic light control with flows

Great flow, this is what i`m looking for years. I have a few questions:

  • How do you do the presence check that one of you is sleeping?
  • When I test the BR_ev_LumChanged_Dark it gives an error at the logic part BR_DarkLight is not exactly dark… I don`t know where that is coming from?
  • I m using the hue motion sensor which also has the Lux sensor in it. But when I create the flow the flow will be inactive. I don`t know why.
  • Your memory function is great, but it is a lot of work when I want do that with all the lights, is somethign also possible with the hue scene`s?
1 Like
  • I use a flic button (but you can use any smart button) to mark myself as asleep/awake,. You can also buy products like Under-mattress sleep tracker - Sleep Analyzer | Withings or even DIY one: Building a bed occupancy sensor for Home Assistant - Everything Smart Home
  • It is probably because you have not provided a value for the variable ‘BR_DarkLight’ before hitting ‘test’. Before testing a flow, you have to provide values for any variables that are used in the flow
  • I would need a bit more context before I can help you out with the lux sensor :wink:
  • It sure is a lot of work, but it does allow granular control over your lights. It is definitely possible to stick to the Hue scenes, but I don’t really see how that would help with the memory functions. A nice ‘middle way’ is disabling the automatic light flows whenever manual control is used. That way you do not have to store the brightness in variables, but can still override the programmed values for your lights. Then you can use a timer to re-enable automatic lights when you please.

Hi Marvin, thanks for your reply.

  1. Yes the button that’s simple and good idea.

  2. See my screenshots. I do not know what I`m doing wrong. Wk_ev_LumChanged_Dark|333x500

  3. The flows with Lum sensor are inactive.
    Flow_inactive_with_Lum_sensor|602x500 Does the motion sensor needs to be configured in the hue app? Now it is also already detecting motion and its working.

  4. Great idea.

  1. You probably need to supply a value for ‘Helderheid’ in order to test your flow. I wouldn’t worry too much about it, this flow looks fine and should work as expected
  2. Your flow is not disabled. The grayed-out icon means you just cannot run this flow on demand (by pressing the icon). This is usually the case for flows the trigger based on events that supply data that is used in the flow (e.g. the ‘Helderheid’ in your case). Flows that just ‘do stuff’ without using data from the event can be manually triggered :).

Just wanted to say that this is a really fantastic tutorial! Have set it up this afternoon for my living room and entrance way, now just waiting for it to start getting darker to see it in action. Thanks for spelling everything out so clearly, it’s super appreciated!

1 Like

Hi there. Little bit of an update. I added a (THEN) ‘Stop Countdown’ step in the BR_ev_Motion_on_dark flow as I kept finding that my lights would randomly (or not randomly, but actually when the timer hits zero) go out and leave me in the dark. Think it’s because my Light/motion sensors (Develco) don’t detect lux/motion nearly often enough. Will see if this step helps keep the lights on, literally :wink:

Also, I’m trying to wrap my brain around how to make it so that in my Kitchen, when lux is between two values (i.e. 40 & 100) then only one of my four lights (kitchen bench) comes on. Then, once lux drops below 40, it reverts back to all lights. Will this require new flows and additional variables? Or is there some way to strong-arm it in somewhere? I’m new to Homey so all the flows and variable can get a bit overwhelming :sweat_smile:

There is a problem with Fibaro Dimmer 2. When turning off, the Dim_Level is set to zero. Any idea on how this can be resolved? The result is that the light doesn’t turn on again since the parameter is set to zero.

Can’t say I have the same thing. Turning off just turns off.

It it’s with Fibaro Dimmer 2, it sounds like you either have an error in the settings, or in the Flow. Try reset the Dimmer 2, I had an issue that was similar, and used the dimmer from an old Smartthings config. Resetting the dimmer, solved it. But the problem with Dimmer 2 is still that turning it off, sets the dimming to zero

Maybe you can use an extra condition in your flows that set the brightness:

  • Light is on
  • or [Leve] is not equal to 0

This way the brightness is only saved when the light is on.

The problem is that Fibaro sets the DimLevel to zero when it turns off. I can’t see how your rule will help in any way? Maybe you can avoid storing the DimLevel when turning off somehow, but I can’t figure out how.

It should be possible to store the level before turning it off, and then set the DimLevel again, but if you do to, the dimmer turns on again….

I have sporadically experienced (mostly not!) the same thing with the fibaro dimmer 2 as well as the RoBBsmarrt zigbee dimmer.

When the light is turned on, sometimes it stays off because the dimmer is set to level 0. In the end I have solved this with every ‘on’ command, after 1 second setting the dim level to a certain fixed value.

Hope this helps.

Hi Marvin!

Thank you for a great tutorial!
I have a conundrum i want to run by you, you see i have been looking into organizing the scenes in the same way as you do, but the more i have been thinking of it, the more i seem to realize that we are not realy gaining any flexibility by introducing that (“virtual”) layer of abstraction.

so basically my argument is this; if you have a virtual switch for each scene, that starts a dedicated flow for the scene, why not trigger the flow directly? as far as i can see it would simplify the complexity and remove the task of turning all the other switches of.

Im looking forward to hear your take on it :slight_smile:

// Christian

Hi Christian,

Good question and interesting look on the situation. The reason I use the virtual layer is so that I can always check which scene is currently active (by looking at the state of the virtual devices) and use that in other flows as a condition. If you are not interested in this then I think you can safely omit the virtual layer and just use “scene flows” directly.


For anyone interested, I just found out about the Zone Luminance app.
Just like Zone Activity does for motion- and contactsensors, you can replace or add, or remove your 2nd or 3rd luminance sensors this way, without the need to repair all related flows.

Also the Zone Memory app can come in handy!

Hi Marvin, could I use this great tutorial and translate it to Czech?

Of course :). Let’s share the <3 as much as possible

1 Like

As a IOS user, I find it much and much more easier to define and maintain scenes in Homekit.
You can use the Virtual Devices that were created in the example Homey flows above for that.
Using the Homeykit app, these Virtual Devices will also become visible in Homekit.
Then create a new Homekit automation that starts whenever the specified VD becomes active and as action starts a predefined Homekit scene.

This way I use the best features of both Homey and Homekit combined.
I use Homekit mainly for creating scenes and I use Homey for the flows.

Thanks for excellent post. How can I best include different automatic dim levels during the day? Standard for me is 95%, but in the afternoon/evening it would be nice to have a more dimmed light (20-30%) and decreasing until bedtime. Should I use IFFTT or other apps? Use the clock? Or do I need to make several flows with different time points using the clock or luminance option?