Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure actions on labels #949

Open
2 tasks done
jftanner opened this issue May 25, 2024 · 13 comments
Open
2 tasks done

Configure actions on labels #949

jftanner opened this issue May 25, 2024 · 13 comments

Comments

@jftanner
Copy link

Checklist

  • I checked for similar existing requests (both open and closed) before posting.
  • My request is generic, other users may benefit from it too.

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.

Copy link

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

@github-actions github-actions bot added the Stale label Jun 25, 2024
@jftanner
Copy link
Author

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

@jftanner
Copy link
Author

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

Copy link

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

@github-actions github-actions bot added the Stale label Jul 26, 2024
@jftanner
Copy link
Author

I'd still like to see this.

@github-actions github-actions bot removed the Stale label Jul 27, 2024
Copy link

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

@github-actions github-actions bot added the Stale label Aug 26, 2024
@jftanner
Copy link
Author

@nielsfaber Would you mind pinning this or rejecting the request?
Or should I just keep replying to the bot every month? :D

@github-actions github-actions bot removed the Stale label Aug 27, 2024
@dannytrigo
Copy link

This is probably simpler to implement than my request for the sensors. I might give a try implementing this one when I get some time

@jftanner
Copy link
Author

I'll just go ahead and bump this now before the bot gets to it. :D

@nielsfaber
Copy link
Owner

Is this request specifically for being able to select labels/areas via the UI (dropdown menus)?
Or are you experiencing errors if you edit the target section manually via YAML?

@jftanner
Copy link
Author

I'm happy to use YAML, but I haven't found a way to successfully use target at all.
Everything I try gives me this error when I click "TRY IT":
image

Working baseline example

This works as expected:

- service: light.turn_on
  entity_id: light.front_downlight
  data:
    flash: long

Failed attempts using target

From the documentation, I'd have expected this to also work:

- service: light.turn_on
  target:
    entity_id: light.front_downlight
  data:
    flash: long

And also this:

- service: light.turn_on
  target:
    label_id: loft_alarm_lights
  data:
    flash: long

But both resulted in the error above.

Failed attempts using label_id

Following the error message, I tried these two:

- service: light.turn_on
  label_id: loft_alarm_lights
  data:
    flash: long

and

- service: light.turn_on
  label_id: 'Loft Alarm Lights'
  data:
    flash: long

Both failed with the same error.

Summary

I haven't been able to find any way to target a label instead of an entity. Or, for that matter, even a list of entities.

I know that this does work if I run it in developer tools:

action: light.turn_on
target:
  label_id: loft_alarm_lights
data:
  flash: long

Maybe the issue is actually in the UI, but I haven't found a workaround.
I tried saving the YAML (without clicking "TRY IT") to see if it would work anyway, but no dice.
And if I open the action again later, my custom YAML is gone.

Copy link

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

@github-actions github-actions bot added the Stale label Nov 20, 2024
@blackbird0589
Copy link

I would also be interested in trigger some automation or other entities and not only switch devices. It would be also helpful to change the "services" to "actions" (according to HA 2024.8)

And over all...thanks for this great tool!

@github-actions github-actions bot removed the Stale label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants