Groups for Lights

Hey,

im looking for a way to show the status of lighting in areas on the dashboard - while also being able to use the this to control lights in those areas.

For example using switches:
All lights: [Switch showing ON if any light in any area is ON, actuating this switch will turn ON / OFF all lights]

  • Bathroom [Switch showing ON if any light in the area “Bathroom” is ON, actuating this switch will turn ON / OFF all lights in Barhtoom]
  • etc…

As I have a lot of lights I would prefer to not create groups by hand. Is it possible to automatically select all lights of a given area?

Thank you!

Copy-paste the following template in the Template Editor, change kitchen to the name of an area in your system, and confirm it reports a list of all light entities in that area.

{{ area_entities('kitchen') | select('match', 'light') | list }}

works like a charm:

{{ area_entities('kitchen') | select('match', 'light') | list }}

Output:

[
  "light.bad_hochschrank",
  "light.badspot_1",
  "light.badspot_3",
  "light.badspot_2"
]

What’s next?

Based on your requirements, you’ll probably need to create a Template Light.