Useful template examples relating to lights that I wish I had known earlier:

Read up on state objects

Rejects items from a collection based on an attribute of the object (In python, they aren’t attributes, they are properties). Do not confuse the attr of rejectattr with attributes on the state object.

This is the attribute of the states object that you’re rejecting.

Does that attribute exist.

Putting it all together. You’re rejecting lights that have the entity_id attribute. Which specifically targets light groups as they are the only lights that have the entity_id attribute.

1 Like