Need help on flow turning lights on based on lux & motion

Hi all,

I’ve been messing around with a flow to get something basic done, but can’t manage to make it work :-/

Context : A neo coolcam PIRV2 is placed in the kitchen. If it is getting dark < 5 lux, than the lights should turn on when there is movement.

First I created a more simple flow, but I’ve been working now on another more robuust flow, that doesn’t work:

Flow a:
If lumonisity has changed
AND tag luminosity < 5
THEN set variable kitchenDARK to true

Flow b:
If there is motion
AND variable kitchendark is true
THEN enable light 1 , enable light 2 and stop countdowntimer KITCHEN

Flow c:
If there is no motion detected
THEN start countdowntimer KITCHEN 5

Flow d:
If Countdowntimer KITCHEN is empty
THEN disable light 1, disable light 2

Flow e:
If luminosity > 10
THEN set variable KitchenDark to False

Whats happening: it’s dark, motion sensor works, put lights won’t turn off… :open_mouth:
Maybe it’s too late for me to work on logical flows, right now, but this is very annoying me :slight_smile:

Has anyone a clue (or flow)…

Much appreciated,

Kind regards,

Bart

I would advice you to doenload papertrails and add logging to your flows.
That way at least you can see what flows are triggering and what are not

Dont know the coolcam pir, but I gues it has something to do with the “no motion” flow

If you are not experienced in building flows I would advice you to take a look at the timer app
https://apps.athom.com/app/com.synplyworks.thenmore

Its an all in one, so you do not need tobother about resetting and counters.
Just use the motion trigger you already have to trigger the timer.

You can do it much simpeler.

Just combine the motion and the lux value in one flow:
If motion
And lux is <5
Then do something.

49

Or just start here. Why reinvent the wheel again?

That’s exactly what I used (using the timer and all) als tutorial. Thanks btw for this clear tutorial @Rocodamelshekima. But somehow, things got really weird. I use this way of working for another motion sensing bulb, and it works just fine. Something is happening in the relation between motion & lux I guess…

Have some Flows similar as written by @neluz with Neo CoolcamV2-Sensors. All have a “Timer-Function” without an extra Timer-App and using Lux-Values. Working fine.

FLOW1
When Motion-Detection On
And Sensor-Lux is not greater 5
And MyBulb is Off
Then Turn On MyBulb

FLOW2
When Motion-Detection Off
And Sensor-Lux is greater 7
And MyBulb is On
Then Run Flow3 after x-Seconds

Flow3
When Flow is triggered
And Sensor-Lux is greater 7
And Motion-Detection is Off
And MyBulb is On
Then Turn Off MyBulb

Flow2 has the “Timer-Time” (after x-Seconds). It starts Flow3 for turning MyBulb off. MyBulb will only turned off if there is a) No Motion-Detection and b) Lux-Value is greater 7.

The difference of 2 Lux (5 = On, 7 = Off) is to prevent always On and Off of MyBulb when there is e.g. fast Cloud-Movements on the Sky.

Also checking the State of MyBulb to prevent Homey always to send On or Off to the Bulb when new Movement-Detected-On or new Movement-Detected-Off (see Flow), for a better performance of Homey itself and a lower Traffic on the Network.

Using in Flow1 the Motion-Sensor of the Room/Area for turning On MyBulb, also in Flow3 to check the State of MyBulb.

In Flow2 using the All-Device-Card. If one of the Sensors at Home reporting Motion-Detection-Off MyBulb in e.g. Room1 will be turned Off when meanwhile the Sensor-Lux of Room1 has reached a Value greater 7 (and Motion-Detection-Off in Room1) equal where a Person is at Home (e.g. MyBulb is in Room1 and a Person is in Room2) > Saves Energy.

So the releation between Motion and Lux is, on my Homey, working as expected.

Thanks for your reply @CyberSponk !!!
Well, the problem is thats I can 't combine the tip sensors from 1 device in one flow: for example, Wegen motion-detection on, I can 't use the lux-sensor in And function. Maybe thats potje problem. Eager to know how @neluz Managed to do so

Didn’t could find/read out why you can’t use it. Motion and Lux should taken from the same Sensor?

Wenn ich den Bewegungssensor in einem Fluss verwende, kann ich ihn nicht mit dem Lichtsensor in demselben Fluss kombinieren

Sure, this works. In When is your Motion-Sensor, in Then your Bulb. What have you in When and Then?

The problem was in the THAN, but I realized I was stukje in my logic: I used the motion sensor in the when and the lux sensor in the AND. I should use a logica function reading out the density