# Motion sensor and light

**URL:** <https://discourse.nodered.org/t/motion-sensor-and-light/36267>\
**Category:** General\
**Created:** [20 November 2020 23:25 UTC](https://discourse.nodered.org/t/motion-sensor-and-light/36267 "2020-11-20T23:25:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas88103](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@Thomas88103](https://discourse.nodered.org/u/Thomas88103)\
**Post date:** [20 November 2020 23:25 UTC](https://discourse.nodered.org/t/motion-sensor-and-light/36267/1 "2020-11-20T23:25:20Z")

</div>

Hey all. I need little help with my node red automation. I have motion sensor in my bathroom. If motion is detect, turned light on and if no motion detect for 10min then turned light off. This works fine.  
light off after 10min of no motion  
I came to the bathoom again 9min59sec after last motion and light turned off  
And this is my problem  
Light dont turned on if motion is detect at this moment and i dont know why  
Some ideas?  
Sorry for my english, i speak only czech and little bit of english as you probably see 😉

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [20 November 2020 23:42 UTC](https://discourse.nodered.org/t/motion-sensor-and-light/36267/2 "2020-11-20T23:42:12Z")

</div>

Without knowing anything about your flow, it will be hard to help you.

Export your flow and attach it to a reply

---

<div class="post-metadata">

**Author:** ![Thomas88103](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@Thomas88103](https://discourse.nodered.org/u/Thomas88103)\
**Post date:** [21 November 2020 10:27 UTC](https://discourse.nodered.org/t/motion-sensor-and-light/36267/3 "2020-11-21T10:27:40Z")

</div>

i have only this flow

[flows.json](https://discourse.nodered.org/uploads/short-url/puw5TKkF7CYuSLrgv94dnqYNu1B.json) (845 Bytes)

lights are turned on via phillips hue app because via HA is 5sec delay .

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 November 2020 11:19 UTC](https://discourse.nodered.org/t/motion-sensor-and-light/36267/5 "2020-11-21T11:19:03Z")

</div>

For future reference please use [this technique](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506) for posting flows, it saves having to download it.

The flow you posted is only one node, does that do the logic you described with the motion detection and 10 minute delay? I don't use HA so I don't know what that node does.

---

<div class="post-metadata">

**Author:** ![Thomas88103](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@Thomas88103](https://discourse.nodered.org/u/Thomas88103)\
**Post date:** [21 November 2020 23:46 UTC](https://discourse.nodered.org/t/motion-sensor-and-light/36267/6 "2020-11-21T23:46:21Z")

</div>

Okey i'm sorry for my bad flow post.  
Yeah that simple flow works for me. My lights are turned on via automation in hue app and my simple flow turned them off after 10min of no motion. But at the moment when i describe isnt work very well. I'm noob in HA and node red and everything what am i doing now is try-mistake thing  
So if someone can me point at the right direction i will very greatfull

---

<div class="post-metadata">

**Author:** ![Kazzy](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@Kazzy](https://discourse.nodered.org/u/Kazzy)\
**Post date:** [22 November 2020 00:00 UTC](https://discourse.nodered.org/t/motion-sensor-and-light/36267/7 "2020-11-22T00:00:24Z")

</div>

check out [https://flows.nodered.org/flow/9834a2f7aeb397f065912c70b467497a](https://flows.nodered.org/flow/9834a2f7aeb397f065912c70b467497a)

It what i took inspiration from to do my hall/stair motions.. they turn on for two mins, and if  
it detects motion again the time restarts back to two mins until there no motion and the lights then turn off

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [22 November 2020 03:22 UTC](https://discourse.nodered.org/t/motion-sensor-and-light/36267/8 "2020-11-22T03:22:56Z")

</div>

For light sensor? Or motion sensor? Search for NR direct i2c stuff driving a light sensor, I posted a flow to support the light sensor I used at the time.

> [@So you have a tsl2591 sensor? Have I got a deal for you!](https://discourse.nodered.org/t/so-you-have-a-tsl2591-sensor-have-i-got-a-deal-for-you/31480):
>
> The following flow can drive the tsl2591 light intensity sensor. This flow is a bit more involved, based on nodes, than functional code, this was done by design to better illustrate how to use the i2c nodes in NR. Refer to the tsl2591 data sheet for details on gain and integration time settings. This flow does explicit validation for the tsl2591 chip, so it will not work as is with the tsl2561. If someone wanted to send me a tsl2561, I would develop a similar flow for the tsl2561. I have te…

I also now have a '26' sensor, where my original flow above was for the '29' variant. But the flow logic is almost identical, and I as I recall there are a couple of examples for the '26' variant posted already.

For motion sensors there are many variants, PIR, SR04, US-100, even a few fancier ones. At some point I will get around to posting NR examples for each. Even have an IR sensor flow I am testing I use for my garage door controller.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 January 2021 03:23 UTC](https://discourse.nodered.org/t/motion-sensor-and-light/36267/9 "2021-01-21T03:23:07Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
