Generic lighting automation to light area and adjacent areas as you move around

Hi there!

I am setting up a new HA, and want to try and improve on my previous one. Existing setup has a lighting automation mechanism I call “choose your own adventure”, where motion in an area will turn on lights in that area to max, and all adjacent unoccupied areas to 20%. If the adjacent areas remain unoccupied for the next 10 seconds, the lights in those areas turn off. Meanwhile lights stay on in the area where motion was detected, for a much longer timeout of a few minutes to an hour depending on what kind of area it is.

The overall effect is that as you walk around, the path lights up ahead of you.

I’ve been doing this with Node-RED, with a separate workflow for each area, but it’s tedious to maintain. I’d like to do it generically, using one single automation that works something like this:

  1. Motion is detected on any motion sensor
  2. Identify which area the sensor is in
  3. Turn on lights in that area if none are already on, and mark the area as occupied
  4. Identify which areas count as ‘adjacent’, and for each one:
    a. if the area is unoccupied, turn on lights at 20%
    b. wait 10 seconds
    c. if the area is still unoccupied, turn lights off
  5. Wait 10 minutes (or ideally an area-specific period)
  6. Turn lights off
  7. Mark the area as unoccupied

In Node-RED, I use flow data to set the occupied state of the areas. It seems hard to do this generically in Node-RED, because it doesn’t seem to have access to the area an entity is associated with when a state change event happens, and also although a call service node can turn on lights based on an area name, I don’t think I can specify the area name using JSONata/payload data.

Any suggestions?

1 Like

Wow! Great concept :smiley:
I can’t help you with this, especially step 4 to generic identify the adjacent areas, but I really like this idea, so I hope you get this done.