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

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

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.

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

And turn off at sun rise

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:


Turns the strip on to 100% and pauses the counter


No more motion, sets the counter to 25s


Counter is empty. It is after sunset but before 22:40. The strip is dimmed to 40%


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 :slight_smile:

1 Like

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

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.

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

So the motionsensor can’t be the trigger.

Try this:


Or even more simple:

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

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

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

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

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 :man_shrugging:

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.

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

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

Hmmm, this is also true

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


Do this for every flow

Set to NO when the strip is turned off

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.

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

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

If YES dim to 40% else turn off.

1 Like

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 :slight_smile:

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