Homey Community Forum

How to simplify semi-complex lighting scenarios?

#1

I love homey, but in the more complex scenarios with lighting as one example, the flows needed are just nuts. I currently have 8 flows for my bedroom alone, to trigger things based on sensors, time and buttons. Is there any apps that can simplify things?

This is the goal I want to achieve, and I hope there is a simpler way to do it.

Gear:
1 x Hue being ceiling lamp
2 x light strips (under each side of a bed)
2 x motion sensors (detecting motion from each side of the bed)
1 x motion sensor in the hallway (with corresponding lights)

Major objectives:

Triggered on motion (which ever bedside motion sensor)

  • Daytime lighting, weekdays: 8.00-23.00. Generally brighter light on all 3 light sources.
  • Daytime lighting, weekends: 9.00-00.00. Generally brighter light on all 3 light sources.
  • Optional Added complexity: Add lux sensor and decrease/increase based on how well the room is lit

Triggered on motion (Inverted times, night)

  • Triggering left or right side motion detector, with hallway motion detector being off, means you get up at night: Equals Low light on corresponding light strip.
    – In addition, if right side is triggered in this way, it should not light up the left side if left motion detector is triggered.
    – If left is triggered, and there have been motion on the right one the last 10 minutes, then the left light strip should not light up when walking past (to not wake up your partner).
  • If Left motion detector is triggered at night and there have been no movement on right side for a while, light up left one.

In addition I have a Hue Switch for scene selections. For off, bright, relax and romantic scenes. But those are easy to separate and you need one flow each.

As you see, this quickly adds up. You need several triggers, timers, scenes and so on. I would love if there was an app that could define some constants like the time and days, and certain conditions that would should be followed no matter what. Is there anything like this? Is my best option to program this in HomeyScript?

Need some feedback for a flow
#2

Can hou share the flows? Otherwise its hard to determine if it can be simpler.

The way I like to make my flows:

  • more flows is not bad! Splitting up flows can make your flows simpler. (Less change on conflicts)
  • I split my flows in several types:
    ** trigger flows, the WHEN contains a trigger like time motion, etc. The THEN just contains commands to enable/disable flows or to start flows
    ** action flows, The WHEN contains a “when this flow is started”, the THEN contains an action
    ** scene flows, The WHEN contains a “when this flow is started”, the THEN contains setting for a group of lights

So in your case:
A trigger flow would be
WHEN its 23:000 AND its a son-thu THEN enable the actionflow “night wakeup left” and “night wakeup right”
(Same for 00:01 AND fri or sat) ( not sure if 00:00 belongs to the new day or previous, 00:01 is for sure the new day)
The actionflow “night wakeup left” would be:
WHEN motionsensor left is triggered AND motionhall is off THEN start flow “nightlight”
(Right would be alike)
The scene flow “nightlight left” would be:
WHEN this flow is started THEN switch left lightstrip on
(Right side alike)
Etc…

Hope it helps

#3

I like to split flows aswell
But I like to use better logic more.
If I were u I would make this:

1 Flow to put the motion detection to a better logic variable ( Motion THEN set #motionBedsideLeft >> True, Start CountdownTimer Put this on 120 sec or so to make sure that after 2 min the ligts will go out.)

1 flow to put the contdown timer to 0 based on the motion in the hallway. ( Motion hallway THEN set countcowntimer to 1 Sec ( or more sec depending on the delay you want to use) ). So wenn the count down timer is counting down you set the time to 0 sec so the timer will de activate.

1 Flow to activate the lights. ( Wenn the #motionBedsideLeft is changed AND The Motion bedsideleft is True THEN activate the lights OR deactivate the lights )
Lights will go on wen the variable is TRUE and wenn it changes to False the lights will go Out.

and this also for the right side.

#4

Thanks for the suggestions from both of you!

You are right regarding the number of flows. It actually simplifies a bit if you split it up in more logical flows triggering each other. I’m in the process of doing that. My only concern might be if it take longer time to execute the total flow? It could be a problem for things like motion detection perhaps?

I’m currently in the process of splitting up all flows as you suggested.
I’ve added folders for Triggers, Actions and Scenes, then then divided in rooms and then in category. Examples:

Action\Bedroom\Light
Action\Bedroom\Heating
Trigger\Bedroom\Motion
Trigger\Kitchen\Timer
Scene\Kitchen
Scene\Bedroom

Also trying to follow a naming scheme of “Where, what and how [type]”. Makes it a bit easier when searching and seeing the actual outcome of a connected flow. Example:
Bedroom - All Lights - Soft Off [Scene]
Bedroom - All Lights - Relax [Scene]
Bedroom - Left Bedside Lights - Night [Scene]
Kitchen - Kitchen Zone Lights - Soft Dim Warm 30% [Scene]
Kitchen - Dinner Table Lights - Soft Dim Warm 20% [Scene]
Hallway - Floor Heating - Set Comfort Temp [Action]
Kitchen - Coffee Machine - Timer Reach 0 [Trigger]
And so on…

Paul, could you briefly explain the advantage of using better logic compared to the alternatives? I’ve downloaded the app, but I have not had the time to really try it yet. It’s only for creating variables that could be used in other flows, right? I’ve been using the Countdown App so far and it’s proven very useful. I can see the need for other types of variables as well, but it would be great with some creative examples.

By the way, you had a very good suggestion of stopping bedroom timers (turning off lights) when when Hallway motion is detected! This can remove a huge gap in my current logic. Where I tried to time the countdown so low that it would not be irritating at night, and at the same time that it was long enough to be useful. This could also apply at daytime. Thanks.

#5

Hello Mr Haugen,
With better Logic it is easyer to make flows. You heave more Freedom in creation.
The benefit of it you need to find out for your self. Everyone has a different way of programming.

I can give you a example:
I have Hue motion sensors. And I can not use the Lux value in a ‘AND’ statement. But wenn I set the actual value to a logic variable. I can use this variable in a flow.

An other example. I heave 14 rolling shutters. I put all those values to a variable. Then I check " if one of the values is changes and if one of the values is below 10 % to trigger a other flow.

#6

Never had any issues with excution speed, its miliseconds…

Like @paul_van_der_Heijden mentioned: You need to find for yourself what works best for you.
I did more or less the same with the folder, but the other way around: bedroom/lights/on

What I do is “mark” flows to identify them:
@ is a trigger flow with time event
! Is a trigger from a device (motion, temperature, etc)
“>”is an action flow
“#”is a scene

This way I can use the filtering in the flow view to show only my action flows

1 Like
#7

Nice Idea!


I also find grouping the flows by location so that the action, triger and scenes are together for ease of use. (ie your second examples). I also generally try and match to them to the zones as well.

#8

I also grouped my timed triggers (@) in one folder (called it settings)
Because these often trigger and enable/disable multiple flows

  • makes it easy to change when my daily rithm changes
#9

Having a prefix for identification of the type of flows is a good idea. I’ve been using it at the end with letters for [T]=Trigger, [A]=Action and so on. However, your way might make it easier to spot the functionality of the flow faster. Especially as you can not increase the width of the folder structure on the website, so the last part of the flow names are hidden most of the times.

I would have liked to add this type of prefix tot be able to sort on the right type of flow, in a bigger folder with flows. You could drop the folder for different types (triggers, actions and so on). However, the sorting seems to be non existent. On both phone and on flow.homey.app. Even the search function on the website is practically useless. So, to find flows to edit you need a decent hierarchy. I hope they improve the web in time. It’s horrible to use, with flows closing if you try to select text, no way to change order on items or use Else and Or functions.