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

**URL:** <https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460>\
**Category:** Flows\
**Created:** [May 26, 2020, 7:40pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460 "2020-05-26T19:40:49Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon61197305](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anon61197305](https://community.homey.app/u/anon61197305)\
**Post date:** [May 26, 2020, 7:40pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/1 "2020-05-26T19:40:49Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [May 27, 2020, 7:21am UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/2 "2020-05-27T07:21:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon61197305](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anon61197305](https://community.homey.app/u/anon61197305)\
**Post date:** [May 27, 2020, 8:11am UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/3 "2020-05-27T08:11:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [May 27, 2020, 8:55am UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/4 "2020-05-27T08:55:01Z")

</div>

> [@anon61197305](#):
>
> Motion trackers is not a good option (peeing in the night triggers awake, while it shouldn’t).

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.

---

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [May 27, 2020, 9:49am UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/5 "2020-05-27T09:49:24Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![anon61197305](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anon61197305](https://community.homey.app/u/anon61197305)\
**Post date:** [May 27, 2020, 7:47pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/6 "2020-05-27T19:47:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)\
**Post date:** [May 27, 2020, 8:33pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/7 "2020-05-27T20:33:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [May 28, 2020, 5:28am UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/8 "2020-05-28T05:28:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jamie](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jamie/32/5274_2.png) [@Jamie](https://community.homey.app/u/Jamie)\
**Post date:** [July 17, 2020, 3:44pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/9 "2020-07-17T15:44:16Z")

</div>

> [@Telling the house about day-, evening-, and night mode](https://community.homey.app/t/telling-the-house-about-day-evening-and-night-mode/10739/2):
>
> What you need to do is set up a set of ‘points’ which determine whether your awake or not. ie. movement in the bathroom between 12am and 5am may give you one point. Where as turning on the shower may give you 7 points. And turning on the radio give + 4 points Ideally you set as many of these up as possible, as well as setting up items which give negative points for things which would indicate your are not awake. -3 points if your electric blanket is on. etc. If points \> 10 - then its morning. …

Its called Bayesian Probability 🙂

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [July 17, 2020, 3:57pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/10 "2020-07-17T15:57:22Z")

</div>

Okay, I understand. But relatively complex and you have to think carefully about which action gets which score. But definitely an option. 👍🏼

---

<div class="post-metadata">

**Author:** ![Jamie](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jamie/32/5274_2.png) [@Jamie](https://community.homey.app/u/Jamie)\
**Post date:** [July 17, 2020, 3:59pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/11 "2020-07-17T15:59:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [July 17, 2020, 4:02pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/12 "2020-07-17T16:02:31Z")

</div>

> [@Jamie](#):
>
> I thought it was worth posting the name of it so if anyone else would like to look deeper into it.

Definitely! 👍🏼

---

<div class="post-metadata">

**Author:** ![levi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/levi/32/33662_2.png) [@levi](https://community.homey.app/u/levi)\
**Post date:** [October 5, 2021, 2:13pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/13 "2021-10-05T14:13:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon61197305](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anon61197305](https://community.homey.app/u/anon61197305)\
**Post date:** [October 7, 2021, 10:01am UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/14 "2021-10-07T10:01:43Z")

</div>

I am very curious about this.

---

<div class="post-metadata">

**Author:** ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)\
**Post date:** [January 14, 2022, 8:34pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/16 "2022-01-14T20:34:40Z")

</div>

> [@levi](#):
>
> 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

@levi how is your app doing?

---

<div class="post-metadata">

**Author:** ![levi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/levi/32/33662_2.png) [@levi](https://community.homey.app/u/levi)\
**Post date:** [January 14, 2022, 9:01pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/17 "2022-01-14T21:01:20Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![anon61197305](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anon61197305](https://community.homey.app/u/anon61197305)\
**Post date:** [January 17, 2022, 12:52pm UTC](https://community.homey.app/t/best-way-to-set-an-awake-boolean-which-is-used-for-motion-sensors-light/30460/18 "2022-01-17T12:52:58Z")

</div>

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…
