# Hue light strip turn on/off based on time AND motion sensor

**URL:** https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086
**Category:** Flows
**Tags:** homey-pro, hue
**Created:** [January 1, 2025, 9:42am UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086 "2025-01-01T09:42:23Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Swetsenegger](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/swetsenegger/32/10038_2.png) [@Swetsenegger](https://community.homey.app/u/Swetsenegger)
#### Post date: [January 1, 2025, 9:42am UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/1 "2025-01-01T09:42:23Z")

</div>

I’ve got a hue light strip in my garden which I turn on/off based on time

 ![Scherm­afbeelding 2025-01-01 om 10.20.29](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/b/8bf3e20c4763bb6488b30ed3bcf7ce71ad3f8a1f.jpeg)

So on sunset, if the time is before 22:40, the strip is turned on. It turns off at 22:30 with a 10 minute random delay.

 ![Scherm­afbeelding 2025-01-01 om 10.13.55](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/5/c54decaf3f1b3ebef62e24f79936df63b080a3d8.jpeg)

In the morning at 7:00 it is turned on again as long as the sun isn’t up yet.

 ![Scherm­afbeelding 2025-01-01 om 10.20.54](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/6/26ce3b012db2d289ff234e4f47223c88cff580ca.jpeg)

And turn off at sun rise

 ![Scherm­afbeelding 2025-01-01 om 10.26.19](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/f/8f0255fa46584c0d5614c62f0046617c18f1d75e.png)

At weekends the times are a bit different, turns off in the evening at 23:00 with a 10 minute random delay and in the morning it turns on at 8:30. This is all working very well.

I also have a motion sensor, which turns the strip on/sets it to 100% brightness. But after motion is not detected for 25 seconds it should either turn the strip down to 40% (after sunset but before 22:30 AND before sunrise but after 7:00) OR it should turn off the strip (between 22:40 and 6:59)

Motion detection:

 ![Scherm­afbeelding 2025-01-01 om 10.31.21](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/6/26c879eae603145a6b32ca7de377e504901fa0d1.jpeg)  
Turns the strip on to 100% and pauses the counter

 ![Scherm­afbeelding 2025-01-01 om 10.31.33](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/0/10e1019cbb85ef020bc9c15371b4dbef24fc4f08.png)  
No more motion, sets the counter to 25s

 ![Scherm­afbeelding 2025-01-01 om 10.31.47](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/8/380bdc884619e692aa04810c03864827102eaca4.jpeg)  
Counter is empty. It is _after_ sunset but _before_ 22:40. The strip is dimmed to 40%

 ![Scherm­afbeelding 2025-01-01 om 10.32.00](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/7/e765827503dc431dd9c7c08d82496ebc03e82963.jpeg)  
Counter is empty. It is between 22:41 and 6:59. The strip is turned off.

And I’ve got the same with different days and times for the weekend

**This works.** When I go outside before 22:40 the strip is turned up to brightness 100% and after I go inside, after 25s it goes back to 40%. If I go out after 22:40, the strip is off. It turns on to 100% brightness and turns off again. During the day the strip just stays off as it should. The motion brightness should also work in the morning but haven’t been able to test this yet.

But now the issue… The strip is turned to 40% at night at random times. This night in example at 2:00, 3:29, 4:42. Which shouldn’t be possible based on above logic. It should turn to 100% on motion and then turn off. And I can’t wrap my head around what’s causing it.

Maybe anybody else sees my flaw 🙂

---

<div class="post-metadata">

### Author: ![Hugo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hugo/32/11530_2.png) [@Hugo](https://community.homey.app/u/Hugo)
#### Post date: [January 1, 2025, 10:17am UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/2 "2025-01-01T10:17:48Z")

</div>

Could it be animals, such as cats or any other animal that is big enough to trigger your motion sensor?

---

<div class="post-metadata">

### Author: ![Swetsenegger](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/swetsenegger/32/10038_2.png) [@Swetsenegger](https://community.homey.app/u/Swetsenegger)
#### Post date: [January 1, 2025, 11:36am UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/3 "2025-01-01T11:36:19Z")

</div>

Yes that is very possible. The light should than turn on to 100% and after 25 seconds turn off. It shouldn’t dim to 40%, based on above logic.

---

<div class="post-metadata">

### Author: ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)
#### Post date: [January 1, 2025, 11:50am UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/4 "2025-01-01T11:50:18Z")

</div>

> [@Swetsenegger](#):
>
> This night in example at 2:00, 3:29, 4:42.

 ![IMG_1850](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/6/36bef5315c1a8af1941ad237b450bf2e0f6bd1c6.jpeg)

At 2:00 the card ‘it’s after sunset’ is not true.

So the motionsensor can’t be the trigger.

Try this:

 ![IMG_1851](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/0/b0c7a7e9fdf21fc901ba0a0eb8a0ed14db43e65e.jpeg)  
Or even more simple:  
 ![IMG_1852](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/2/a2db78d722c27b33d901dac64a133e8a43b39a18.jpeg)

---

<div class="post-metadata">

### Author: ![Swetsenegger](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/swetsenegger/32/10038_2.png) [@Swetsenegger](https://community.homey.app/u/Swetsenegger)
#### Post date: [January 1, 2025, 12:24pm UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/5 "2025-01-01T12:24:08Z")

</div>

In that case the light SHOULDN’T turn on, however it does turn on. The problem is it doesn’t turn off but dims to 40%, which is nowhere set in the logic

---

<div class="post-metadata">

### Author: ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)
#### Post date: [January 1, 2025, 1:24pm UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/6 "2025-01-01T13:24:04Z")

</div>

> [@Wim\_Post](#):
>
> So the motionsensor can’t be the trigger.

At least not directly:  
This flow will start the timer no matter what.

 ![IMG_1853](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/0/1051b35170a37d633b014426ff5a18832f2df137.jpeg)

Have you double checked every flow that starts with ‘timer has ended’?

---

<div class="post-metadata">

### Author: ![Swetsenegger](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/swetsenegger/32/10038_2.png) [@Swetsenegger](https://community.homey.app/u/Swetsenegger)
#### Post date: [January 1, 2025, 1:26pm UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/7 "2025-01-01T13:26:59Z")

</div>

Once again, the light turns on fine. It is the turning off which doesn’t work, but only at night.

and these are the flows which are triggered by the timer  
[![](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/8/380bdc884619e692aa04810c03864827102eaca4.jpeg) ](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/8/380bdc884619e692aa04810c03864827102eaca4.jpeg)

[![](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/7/e765827503dc431dd9c7c08d82496ebc03e82963.jpeg) ](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/7/e765827503dc431dd9c7c08d82496ebc03e82963.jpeg)

As said this DOES work. When I test before 22:40 the lights just dims to 40% and If I test at 23:00 the lights turns off as it should.

So it is completely incomprehensible why sometimes the light is at 40% during the night at like 2 am 🤷‍♂️

---

<div class="post-metadata">

### Author: ![Hugo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hugo/32/11530_2.png) [@Hugo](https://community.homey.app/u/Hugo)
#### Post date: [January 1, 2025, 1:59pm UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/8 "2025-01-01T13:59:36Z")

</div>

After twelfe at night it is before 22:40 which means your flow with the dimming 40 % should work.

De tijd is vroeger dan 22:40 should have been: de tijd is NIET tussen 22:40 en zonsopkomst.

---

<div class="post-metadata">

### Author: ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)
#### Post date: [January 1, 2025, 2:12pm UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/9 "2025-01-01T14:12:15Z")

</div>

After midnight the card ‘Het is na zonsondergang’ is false , so this flow shouldn’t run.

---

<div class="post-metadata">

### Author: ![Swetsenegger](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/swetsenegger/32/10038_2.png) [@Swetsenegger](https://community.homey.app/u/Swetsenegger)
#### Post date: [January 1, 2025, 2:12pm UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/10 "2025-01-01T14:12:27Z")

</div>

Hmmm yes, that’s the issue I think. Then I have to build another card for the period between 7am and sunrise

---

<div class="post-metadata">

### Author: ![Swetsenegger](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/swetsenegger/32/10038_2.png) [@Swetsenegger](https://community.homey.app/u/Swetsenegger)
#### Post date: [January 1, 2025, 2:17pm UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/11 "2025-01-01T14:17:08Z")

</div>

Hmmm, this is also true

---

<div class="post-metadata">

### Author: ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)
#### Post date: [January 1, 2025, 4:10pm UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/12 "2025-01-01T16:10:22Z")

</div>

If I may make a few suggestions to reduce the number of flows:

Create a YES/NO-variable ‘lightstrip tuin is aan’

Set this variable to YES when the strip turned on

 ![IMG_1854](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/b/abc637d151ced1254449749f168dd7ac3ce6b6cc.jpeg)  
Do this for every flow

Set to NO when the strip is turned off

 ![IMG_1855](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/b/eb90c1e76d9b3191ff84f251da9f197f3cdad3c0.jpeg)

This way Homey know the state of the strip before motion.

In my case the time between motionalarm on and motionalarm off is 60 seconds. So I start a timer of 60+ 25 seconds (typo in screenprint) and only when it’s dark.

 ![IMG_1856](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/b/cb620787459fe4b53b45820a2f2c680cfd88bbee.jpeg)

So only there’s motion and it’s dark the timer is started. So when the timer is started the strip dims to 100%

 ![IMG_1857](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/f/afe3cf5fcf93f3e16a703e36138db9b282a1c677.jpeg)

When the timer ends the next flow checks the state of the strip before the motion:

If YES dim to 40% else turn off.

 ![IMG_1859](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/2/c29b2cb6e57a3a8838a17468df10278564e2df6d.jpeg)

---

<div class="post-metadata">

### Author: ![Swetsenegger](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/swetsenegger/32/10038_2.png) [@Swetsenegger](https://community.homey.app/u/Swetsenegger)
#### Post date: [January 1, 2025, 5:12pm UTC](https://community.homey.app/t/hue-light-strip-turn-on-off-based-on-time-and-motion-sensor/126086/13 "2025-01-01T17:12:06Z")

</div>

Thats quite elegant, that way I can reduce the cards. Thanks, will think about this!

I’ve made some other changes and made it more robust for edge cases, so will check tonight. And otherwise I maybe have to start considering advanced flows 🙂

-edit- changed it with this logic variable. Reduces my cards significantly and makes it much easier to debug if something goes wrong.
