I have gone through a lot of different methods of automating the lights in my house to hit the best trade off between doing the thing you expect, being energy efficient, and good household approval factor. I’ve ended up using Node-RED to build two flows and with all the improvements to native automations, I’m wondering if these could be done natively now.
The way my “ON” automation works is:
- Trigger on any “motion start” event anywhere
- Get the area name of the area in which the event happened
- Get the light entities that have an
automate
label and are in that area - Remove from the list any entities whose state was changed within the last hour by something other than an automation (to avoid ‘fighting’ with someone trying to manually control the lights)
- Calculate a target brightness for each light individually based on a list of configured brightnesses for:
- That entity and system mode combination (eg
light-bathroom-1/night_mode
) - That entity, for any system mode (eg,
light-bathroom-1/*
) - The current system mode for any entity (eg, `*/night_mode)
- That entity and system mode combination (eg
- Remove from the list of entities any whose current brightness is higher than the calculated target
- Adjust brightness of light entities
Benefits of this approach:
- I can freely add, remove and move around the lights in my house without having to remember to create and update automations
- At night, lights can come on at a suitably low ‘dimmed’ brightness which tends to vary (10% for one light might not actually turn it on at all, while for another it might be too bright)
- If you take manual control using a light switch, the house doesn’t fight you
I suspect steps 3 and 4 would be achieveable in a template. I’m not sure steps 5 and 6 are possible right now. Any thoughts on how acheivable this is or what I should/could do instead would be much appreciated!
Incidentally I have also gone through a phase of mapping lights to sensors using custom attributes and using that mapping to select the lights to turn on rather than using the ‘area’ but the principle is the same.