Add/remove entities from group from lovelace? ("Dynamic groups")

Hi.
I have a Node-Red flow that is doing light effects (colorloops ect)
Let’s say I have these three entities for light that I want to do colorloop on:

  • light.celling
  • light.behind_tv
  • light.under_sofa
    Sometimes celling and behind_tv, sometimes behind_tv and under_sofa, sometimes under_sofa and celling.

groups are great to do same things with a group of entities, but what if i want these entities to be different. can I in some way make a dynamic group that entities can be added/removed from in lovelace?
Lets say the group is group.light_effects.

image

You assign the group.set to the tap actions of your ‘Add’ buttons and the group.remove service to your ‘Remove’ buttons.

looks like i can use group.set to:

  • add entity to grup
  • Replace all entities with X
  • Replace all entities with nothing (use [] o clear)

What I can’t do is:

  • Remove only one or some of the entities in a group

group.remove I think can only remove the whole group, not single entities in it.

I got this to work btw, like this:

6 Likes

Very very cool example.
One question, is there a way to implement the whole thing with the new groups (from version 2022.4)? Unfortunately, I can’t find any service: group.set anymore?

Hi @tom_l,
is it possible to update an existing group of light that is defined in lovelace?
Technically i want to edit this light group dynamically but if i use those method it crate a new group.lumiere_escalier_1er toute it do not edit light.lumiere_escalier_1er_toute:

min_color_temp_kelvin: 2700
max_color_temp_kelvin: 6500
min_mireds: 153
max_mireds: 370
supported_color_modes:
  - color_temp
  - onoff
  - rgb
  - rgbw
  - rgbww
color_mode: null
brightness: null
color_temp_kelvin: null
color_temp: null
hs_color: null
rgb_color: null
xy_color: null
rgbw_color: null
rgbww_color: null
entity_id:
  - light.lightesc1droite_light
  - light.lightesc1gauche_light
  - light.light1_coul1er
  - light.light2_coul1er
  - light.light3_coul1er
  - light.lightesc1guirlande_switch
icon: mdi:lightbulb-group
friendly_name: lumiere escalier 1er toute
supported_features: 40