Advanced light automation

Tags: #<Tag:0x00007f7c611634d0>

I’m using home assistant in a venv on ubuntu with Lifx bulbs. I’d like to be able to handle scenarios like:

  1. Turn on all lights in this group
  2. After 10 minutes, dim all lights in the group
  3. After 3 minutes, if they are still dim, turn them off
    I’m happy with the manual controls offered by light groups (particularly the ability to set color and brightness for a whole group, including subgroups, from one UI element) but I can do the automation inside or outside of home assistant.

I think to do it inside home assistant, I need to be able to retrieve attributes from the light that may not be present in the standard light entity or define an extended entity with those attributes (i.e., is this light subject to auto-shutoff, boolean.) I could pack those into the light location or group as defined by the Lifx bulbs, but I’m not sure if I can read those in home assistant. I could fudge it by setting an attribute trigger (i.e., set the group to 99% brightness, if it’s been at 99% brightness for 10 minutes, take it to 50, if it’s been at 50 for 3 minutes, turn it off.) but I don’t know how to set triggers for attributes rather than states, and creating sensors for every light and/or group and separate automations for those seems like it might be over-complicated versus using another tool. I have a lot of experience with python and jinja2.

To do the automation outside of home assistant, I’d like to be able to get a list of all physical devices in a home assistant light group. I’ve read these two threads:

among others, and I think I’m almost there but not quite. I want the final result to include every Lifx device in the group and its subgroups but no group entities. Something like this may be what I need:

but if anyone has a suggestion in the interim, I’d appreciate it.