# Presence sensor with plugs and lights

**URL:** <https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106>\
**Category:** Questions & Help\
**Created:** [September 3, 2026, 8:33am UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106 "2026-09-03T08:33:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![KiOtO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kioto/32/166109_2.png) [@KiOtO](https://community.homey.app/u/KiOtO)\
**Post date:** [September 3, 2026, 8:33am UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106/1 "2026-09-03T08:33:31Z")

</div>

I did two flows. It works perfectly. But I have a problem after midnight the plug or lights turn on out of the active time from sunset to 23.30 hour. How can I do this right so plug does not go on after midnight? Thank you!

 ![Screenshot 2026-09-03 at 10.26.38](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/f/bfc1bb8bbcfb5646337f5d99fcf52cd7d2f96194.jpeg)

 ![Screenshot 2026-09-03 at 10.26.25](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/6/86bb4870081d6bb40410ea2896c4a5caf124fd7f.jpeg)

---

<div class="post-metadata">

**Author:** ![SunBeech](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sunbeech/32/111391_2.png) [@SunBeech](https://community.homey.app/u/SunBeech)\
**Post date:** [September 3, 2026, 9:07am UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106/2 "2026-09-03T09:07:16Z")

</div>

Try adding an additional AND condition: ‘it is after sunrise’. I am not sure though whether the period before 23:30 then still works correctly.

---

<div class="post-metadata">

**Author:** ![KiOtO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kioto/32/166109_2.png) [@KiOtO](https://community.homey.app/u/KiOtO)\
**Post date:** [September 3, 2026, 9:16am UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106/3 "2026-09-03T09:16:46Z")

</div>

Where should I put the and detail first second or third place?

---

<div class="post-metadata">

**Author:** ![smarthomesven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/smarthomesven/32/79712_2.png) [@smarthomesven](https://community.homey.app/u/smarthomesven)\
**Post date:** [September 3, 2026, 9:22am UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106/4 "2026-09-03T09:22:05Z")

</div>

It doesn’t matter, they all run at the same time

---

<div class="post-metadata">

**Author:** ![SunBeech](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sunbeech/32/111391_2.png) [@SunBeech](https://community.homey.app/u/SunBeech)\
**Post date:** [September 3, 2026, 10:05am UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106/5 "2026-09-03T10:05:29Z")

</div>

Indeed, the order does not matter.

Just FYI: Athom once [explained](https://community.homey.app/t/how-homey-implements-sunset-and-sunrise/151358/18) how the sunset/sunrise flowcards work and thus when the ‘it is after sunset’ and ‘it is after sunrise’ flowcards return true of false. Or at least, that is how it should work.

Since the sunset/sunrise conditions go beyond the current day and continue into the next day, this might result into some unexpected results when creating flows.

I created a picture, based on Athom’s linked explanation, on when the two conditions are true/false:

 ![Sunset v Sunrise](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/b/8b32139c97a4bcd7217801d6ab141b8b8ab9429a.png)

---

<div class="post-metadata">

**Author:** ![KiOtO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kioto/32/166109_2.png) [@KiOtO](https://community.homey.app/u/KiOtO)\
**Post date:** [September 3, 2026, 11:32am UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106/6 "2026-09-03T11:32:52Z")

</div>

Thank you for the Info!

---

<div class="post-metadata">

**Author:** ![KiOtO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kioto/32/166109_2.png) [@KiOtO](https://community.homey.app/u/KiOtO)\
**Post date:** [September 3, 2026, 6:32pm UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106/7 "2026-09-03T18:32:45Z")

</div>

> [@SunBeech](#):
>
> ‘it is after sunrise’.

I put ‘it is after sunrise’.in the flow it does not work. plug does not go on before 23.30.

 ![Screenshot 2026-09-03 at 20.31.05](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/d/9de74abc36be5e5962128fd65854aafdb1f8f321.jpeg)

---

<div class="post-metadata">

**Author:** ![SunBeech](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sunbeech/32/111391_2.png) [@SunBeech](https://community.homey.app/u/SunBeech)\
**Post date:** [September 3, 2026, 7:29pm UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106/8 "2026-09-03T19:29:51Z")

</div>

What if you use the following AND-conditions

- It is after sunset
- The time is between 16:00 and 23:30

This will ensure the flow does not run during the night. Make sure to use a start time that lies before the typical sunset in your location.

---

<div class="post-metadata">

**Author:** ![KiOtO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kioto/32/166109_2.png) [@KiOtO](https://community.homey.app/u/KiOtO)\
**Post date:** [September 3, 2026, 8:58pm UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106/9 "2026-09-03T20:58:56Z")

</div>

It works now before 23.30. I have to see what happens after midnight now! Well respond later.Thank you!

---

<div class="post-metadata">

**Author:** ![KiOtO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kioto/32/166109_2.png) [@KiOtO](https://community.homey.app/u/KiOtO)\
**Post date:** [September 4, 2026, 7:48pm UTC](https://community.homey.app/t/presence-sensor-with-plugs-and-lights/159106/10 "2026-09-04T19:48:29Z")

</div>

Thank you for the help! It works perfectly now! And after midnight the plug or light stays off like it should. Comes on only between sunset and 23.30! Thanks again!
