Convert Node red into HA automations

After a few years using Node Red as starting point for all automation I’m trying to convert all flows to HA automations.
I have a few difficult ones for which I hope you can help me out (Node Red works flawless, but why use node red when HA automations should do the trick :smiley: )

image

Above ‘simple’ NR flow is the first I’m trying to convert.
In short: I have a Hue outdoor motion sensor and based upon the Lux value it should switch lights, but only within a certain time
And each day after a specific time the light should switch off randomly within 5 till 25 minutes

My guess is I have to work with a trigger (Hue motion sensor) and with conditions (Lux and time). But I need some guidance how to correctly setup the automation.

Thank you

On

Triggers:

  1. Lux below 50 (numeric state trigger)
  2. 15:00:01 (time trigger)

Conditions:

  1. Lux below 50 (numeric state condition)
  2. Time between 15:00 and 22:55 (time condition)

Action:

  1. Turn on the light

Off

Trigger:

  1. Time (time trigger)

Actions:

  1. Random delay between 5 and 25 minutes (using templates - delay)
  2. Turn off the light

Thanks, I will give this a try.
Question: why is the lux value both a trigger and a condition?

Because triggers are always any.

If you have 4 triggers then any of them can start the automation processing. If you want when all these are true you need to “duplicate” the triggers and conditions. This talks about that a bit more,

1 Like

How i programmed it for my living room light:

trigger: Time pattern /5 minutes (checks every 5 minutes)

Conditions:
1: time condition
static time: past 15:00
static time: before 22:00

2: numeric condition
illuminance static value below 150 lux

3: State condition
check if light has manualy turned off (throug helper sensor)

Actions:
turn on light scene
turn on helper sensor

This helper sensor is automaticly throug a automation turned off at night.
By doing this, the living room light could turned off manualy for that day. and is never going be turned on automaticly again that day.

for the front door light, i switch it off after 22:00 if everyone is inside the house.