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

Assign labels to schedules #400

Open
jlaffaye opened this issue Dec 2, 2024 · 5 comments
Open

Assign labels to schedules #400

jlaffaye opened this issue Dec 2, 2024 · 5 comments

Comments

@jlaffaye
Copy link

jlaffaye commented Dec 2, 2024

Proposal

I wish to be able to assign labels to schedules. The end goal being that the switch entity for this schedule will also have this label. I will then be able to switch on/off a group of schedules based on labels.

Example use case: my energy provider has "peak events" that are not predictable and thus can not be handle in one schedule.
I have two schedules: one for "standard" mode and one for "peak" mode (almost always off).
I want to setup an automation to turn off all "standard" schedules when a peak event starts, and turn on all "peak" schedules. At the end of the peak event, do the opposite.

@romainrossi
Copy link

It seems it is already possible to assign Tags in the Entity panel
image

However, trying to switch on/off the Schedules with the "generic_turn_on"/off or the "switch turn on/off" actions doesn't do anything when targeting the Tag (while it works for "normal" switches having the same tag; and it work if the action targets directly the entity).

When the tag is expanded, the scheduler aren't listed :
image
image

@londondev77
Copy link

I was going to create a new feature request when I stumbled on this one.

The scheduler component already supports tags which aren’t the same as labels which I think you’re referring to above?

The component supplies an enable all schedules and a disable all schedules service. Would it be possible to add a variation to enable/disable all services with a tag?

@fabyte
Copy link

fabyte commented Jan 27, 2025

There is a workaround I'm using to turn on/off Schedules by label:

- action: switch.turn_on
  data: {}
  target:
    entity_id: >-
      {{ label_entities('this_is_my_label') | select('match', 'switch.') | list }}

@londondev77
Copy link

And this is what I’m using to select all schedules with a tag containing a string

{{ states.switch | selectattr('entity_id', 'in', integration_entities('Scheduler')) | selectattr('attributes.tags', 'search', 'string’) | map(attribute='entity_id') | reject('eq',None) | list }}

@mistic100
Copy link

En "elegant" solution to this problem I think would be the allow the "disable_all" and "enable_all" service call to specify a tag (I mean the Scheduler Card tags, not the HA labels)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants