Best way to set an 'awake' boolean, which is used for motion sensors light

I want my lights go on full when we are awake, but dimmed if it’s night (sleeptime). So for all motions sensors I have a flow that when there is motion, and awake is true, go full. When there is motion, and awake is false, go dim.

But Now the boolean.
The start is quite easy. The same time every weekday and another time on weekends.
The awake is false is more random. It is: after a certain time (9 pm) but not when there is a light on in the living room or bedroom. Or after a certain time (11 pm) or when the light in the living room or bedroom is turned off earlier.

But it feels like a lot of flows. Is there a better way? Any suggestions? How do you do this?

If you want to set your Sleep/Awake status with the mentioned conditions, there must already be several flows (side information: some have more than 500 flows in use).

But there are many other ways to set the Sleep/Awake status, e.g. by a switch or button, by motion sensors, by power consumption when charging the mobile phone overnight, by using the Withings Sleep Tracking Mat.

I use the Hank Scene Controller (Z-Wave) to trigger various flows, partly depending on the time. In addition, I monitor the power consumption while charging the mobile phone in the bedroom. So I can make sure that the motion sensor in the bedroom does not turn on the light when someone is already in bed.

I has te be automatic with a low partner acceptance rate.
A switch/button is not really an option.
Motion trackers is not a good option (peeing in the night triggers awake, while it shouldn’t).
My iPhone charger isn’t connected to anything for power consumption (and not always charging).
I don’t have a sleep mat.

It should be based on time, specific lights that are on. I have to figure a couple of flows which don’t bite each other.
There is specific sleep card, I think it’s from Withings? Hard to see in the flow editor. But I only have a scale, so it’s no use I guess.
Edit: wait no, there is a withints card and a presents card about sleep… how does that work?

You can prevent this with the sleep status “Sleep”.

Are your lamps only turned on and off by motion sensors, or also by switches? Even by switches, which one?

Anyway, what you wish is more or less possible, but not with 1 or 2 flows.

The amount off flows is irrelevant in my opinion because Homey seems not to have problems with the amount of flows, but can have problems with the amount off triggers the sane time.

I have made a flow for awake with a situation it’s certain someone is awake. For everyone that will be different.

The awake flow is not a certain time, but a certain action only awake people do. In my situation that is coming down the stairway after 5am(motionsensor in the hall).

What some use as trigger is a vibration sensor in the drawer.

The sleep modus is when there has been no motion in the house for 30 minutes and it is after 10pm. And an extra trigger(vacation mode) when there has been no motion for 24 hours, but only no motion upstairs(in case neighbours feed our cats downstairs)

1 Like

Before Homey my Motion sensors triggered the lights. Based on time and an other light it was bright or dimmed (day or night).
I want to keep it that way. So “are we awake” is the condition (AND block) for them.
Some do also have a Hue dimmer switch.

That is no problem, but it is nice to keep everything a bit clear. And the idea to have the “are we awake” flow separate is quite fine, for easy adjustments. The motion > put the light on flow don’t have to be adjusted then.

But it’s quite difficult to understand the cards like countdown, delay and such.

@Marcel_Ubels: the “are we awake” flow and boolean is not so hard. I can combine factors together that set that boolean. It’s the motion that turns on the light with a countdown to turn it off and continued motion should reset the countdown or timer.
So the default sleep modes is useless for me. My motion sensors trigger lights, not awake states.

Some time agoo I read an interesting approach on “awake/sleep” home/away status
I did not implement it myself but it sounded promising.

The idea is build on what you already concluded: there are many ways to determine sleep/awake but they are not all ver conclusive (motion is great but not at night when going tomthe bathroom)

So the idea is:

  1. create a number variable that represents “the chance that we are awake”
  2. now determine what activities can determine that you are awake
  3. now decide on weightfactors for these activities, based on if it happens how certain are you that you are awake
    4] when an activity occurs, it is multiplied by the weightfactor and then added to the number variable.
  4. when the variable is larger then a certain number you activate the awake boolean variable

When no motion is detected in any zones for a long time you are probably asleep or away
When the house alarm is on you are probably asleep or away
When the alarm clock has rang, add some points to the counter
When the coffee machine is on add so e points o the counter
When the tv is on…
Welll I geuss you get the point


Without a clearly defined action as mentioned above, it will probably be very difficult to automatically switch the sleep mode on or off.
In my opinion, Marcel_Ubels and FKey have already proposed good solutions.

I would like to hear about further possibilities myself.

Its called Bayesian Probability :slight_smile:

1 Like

Okay, I understand. But relatively complex and you have to think carefully about which action gets which score. But definitely an option. :+1:t3:

I’ve never implemented it on Homey, though I would like to try one day. Your right it would require its own spreadsheet to figure / record / tweak numbers.

I thought it was worth posting the name of it so if anyone else would like to look deeper into it.

Definitely! :+1:t3:

I’m currently working on a new homey app that will introduce the bayesian sensor :slight_smil😊

I’ll keep you posted on the progress


I am very curious about this.

@levi how is your app doing?

Well, this is a bit awkward to say. I enjoyed homey a lot and it was the best device to get started with.

Unfortunately I got hooked by all this IoT stuff and at this point in time I have about 20 sensors, advanced room presence detection based on 5 cameras and about 10 raspberries. Add 30+ smart bulbs with about 10 smart speakers, displays and tv’s.

TL;DR Homey didn’t fit my purpose anymore and I switched over to Home Assistant (which has the bayesian sensor built-in).

I’m not ranting about Homey. I still recommend it to friends and people who ask me. But managing over 400 flows was starting to become really complicated.

If you ever become interested in joining the blue side; start with node-red. It’s an awesome tool. It’s like Homey flows on steroids.

Sorry tho!


I can understand that completely. Home Assistant has a bigger community and is awesome. In my opinion also a lot more work (partly because it is so full of possibilities.
I think about it too. Especially when something on Homey doesn’t work and take a lot of time to fix…