nielsfaber / alarmo

Easy to use alarm system integration for Home Assistant
1.24k stars 117 forks source link

Configure actions on labels #949

Open jftanner opened 1 month ago

jftanner commented 1 month ago

Checklist

Proposal

I would like to be able to select labels (or areas, etc) when configuring actions, rather than only entities. Ideally, the actions should support any of the targeting modes for services.

Additional info

This works in an action to trigger a single light to turn on full red, then flash for a while:

# Turn on one light to full red.
- service: light.turn_on
  entity_id: light.back_downlight
  data:
    rgb_color:
      - 255
      - 0
      - 0
    brightness_pct: 100
    transition: 1

# Make it flash for a while
- service: light.turn_on
  entity_id: light.back_downlight
  data:
    flash: long

However, to do the same for multiple lights, I would need to a) create two more service calls for each one, or b) create a script and trigger that. Either option is excessively complicated.

Instead, it would be preferable to use something this:

# Turn all the lights to full red.
- service: light.turn_on
  target: # Note the target field.
    label_id: loft_alarm_lights # Note that this is label_id instead of entity_id (though that could be used as well)
  data:
    rgb_color:
      - 255
      - 0
      - 0
    brightness_pct: 100
    transition: 1

# Flash the two downlights for a while
- service: light.turn_on
  target:
    entity_id: # Note that entity_id can also be a list (as can the others)
      - light.front_downlight
      - light.back_downlight
  data:
    flash: long

These list items work as expected in the service dev tool, so presumably it's just a matter of having Alarmo pass along the target field (and not breaking the yaml when loading the UI view, which happens now.)

This would make Alarmo actions a lot easier to set up without making a bunch of extra scripts.

github-actions[bot] commented 1 week ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

jftanner commented 1 week ago

I'd still really like this feature. I hope it gets considered.

jftanner commented 1 week ago

There's a similar open request for sensors by label. Implementing both would be ideal.