Homey Bridge: Turn on bedroom light with a motion sensor

Hi guys.
I am new to Homey Bridge, and have a problem. I want to be able to turn on one lamp in the bedroom when I need to go to the bathroom, should be working after 11PM and until sunrise, and then turn off again after there is no motion on the sensor.
I am able to turn on the light with a flow, but when I add some extra conditions like the timing (11-sunrise), and turn off the light after no motion, nothing is working.
Is there a clever one that can help me with making a flow for the Homey Bridge, please?
Thank you very much in advance.

Hi,
please share your flow(s), maybe there is only a small mistake.

This time in english language.

Try it after you removed the else.

1 Like

What is turned on?

Only a bulb at first - normally just one lamp.

As @Ria_Banis already suggested, remove the else part and create a second flow:

When…
– The motion alarm turned off

And…
– The bulb is turned on
– The time is between 23:00 and 05:00

Then…
– Turn off

You may run into another problem, and that is that the lamp keeps turning on and off. However, this depends on how the motion sensor works and/or is set up, as well as on the use case. If you run into this problem, let us know. Then we will find a better solution.

I tried that, and nothing is working. The motion sensor is Aqara Motion Sensor thru homey Aqara app, the lamp is Philips Hue thru Hue app on Homey.

So what is going wrong in this setup? :confused:

Try
— Time is not between 05:00 and 23:00
(Time from the original post)

I was happy .- for a minute :slight_smile: It worked when I reversed the time for both flows to be the reverse - but after it worked one time, it then stopped working again the 2nd time, I tried it. :frowning:

I put on another new Aqara M S to see if it was the sensor, but it is still the same: nothing happens.

I tested and tested, and came to this: When I press Test to test the first part, the lamp goes on, no matter if motion or not, and when I activate the M S, the 2nd part of it - flow 2, turns off the light when the sensor goes to idle - so - the last part seems to work, but not the first part.

When you test a flow, you emulate the trigger, in this case the motion trigger. So it doesn’t matter if there’s no motion.
It just tests the conditions and the actions of a flow.

I suggest to add timeline notifications to each Then and Else parts of the flows, then you can review what’s happening, and what’s not.

2nd flow:
Why do you have a timeframe as condition to turn a light OFF? Now the light is never switched off when the motion alarm turns off between 13:00h and 5:00h… But maybe that’s what you want?

Also, I’d remove the “and if light is turned on” condition.
To me, it doesn´t matter to turn off a light which is off already.

And when it works, then you can always add conditions, one by one.

Peter, the timeframe in 2nd flow was suggested earlier in the replies, thats why it was put in, to test it :slight_smile:
I decided to start all over again, removed everything, including the sensors, and restarted the Homey Bridge. Then I only added the sensor, and the lamp in the flow, and it worked. Then I added the time condition to the 1st flow, and now it works like a charm.
Thank you for your suggestion about the timeline notifications, it was a perfect idea, that I didnt think of.
Thanks to everyone being involved into this frustration
:smiley:

2 Likes

Right, it depends on what he wants to realize. And because he asked for flow during the night, I added the time flow-card also for turning off the light. Now, without the time flow-card, the flow runs always completely through including switching off the lamp, also between 05:00 and 23:00 when there is possible no need for that.
And this is the straight way to the second point:

The flow-card “The bulb is turned on” prevents Homey to run the complete flow if the lamp isn’t switched on, or if the lamp was switched off manually in the meantime. I guess and hope, but this is my personally assumption, that this option saves Homey’s resources and saves unnecessary traffic.

Hi Dirk,

No worries, I just quickly looked at the two last shared flows and gave my thoughts on what could be the issue. I did not read everything written earlier.
I did not know you suggested the timeframe in the ‘off’ flow, so nothing personal :upside_down_face: I think otherwise I would have tagged you.

The second point is indeed how one looks at things, or how our Homey is running (white or redhot :stuck_out_tongue_winking_eye: )
That’s why I wrote, “to me it doesn’t matter to turn off a light which is off already”, but I meant of course:
“to me it doesn’t matter to turn off a light which is off already for this situation”

Why?
A motion sensor is in general not sending alarm-OFF signals every 1 or 3 seconds, and does not cause a big load on Homey or the used protocol (in my eyes).
When an ‘every 1 or 3 second trigger’ is the case, I would also add a condition like “and light is off”.

Also, when troubleshooting, I think it’s a good idea to (temporary) remove anything I don’t need for the basic function of the flow.