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

add expand_group filter to recursive include entities of groups #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

spali
Copy link

@spali spali commented Jul 30, 2019

a new group_expand filter, which does list entities of a group recursive but without group's itself.
to be honest, I tested it only with include. But implemented it in a way, that in theory it should work for exclude too.

PostHumanGod and others added 2 commits June 13, 2019 13:23
I believe this is where I picked up the invalid battery attribute, it should be battery_level.
@Mariusthvdb
Copy link

Mariusthvdb commented Nov 10, 2021

please let me add to this, following our chat on Discord:

Using groups with nested groups (eg to allow easy controlling and templating elsewhere) it would be very nice to be able to do:

  - type: custom:auto-entities
    show_empty: false
    card:
      type: entities
      title: Nested groups
    filter:
      include:
        - group: group.doors
          options:
            secondary_info: last-changed

while that group would be:

group:
  Doors:
    entities:
      - group.inside_doors
      - group.outside_doors

currently, that looks like:

Schermafbeelding 2021-11-10 om 15 53 56

which as you can see has an erroneous toggle (there's a issue on that in the Frontend repo) and has a more-entities that is even less attractive:

Schermafbeelding 2021-11-10 om 15 54 07

we have to include both groups separately now, like:

  - type: custom:auto-entities
    show_empty: false
    card:
      type: entities
      title: Verbose groups
    filter:
      include:
        - group: group.inside_doors
          options:
            secondary_info: last-changed
        - group: group.outside_doors
          options:
            secondary_info: last-changed

and of course, set the options twice too. Not a frist world problem, but given the power of auto-entities, something like the group_expand: true which the button-card offers would be awesome.

would be even greater if we could add state: 'on' to the filter, next to the current show_empty: false:

    filter:
      include:
        - group: group.inside_doors
          state: 'on'
          show_empty: false
          options:
            secondary_info: last-changed
        - group: group.outside_doors
          state: 'on'
          show_empty: false
          options:
            secondary_info: last-changed

Hope you can have a look, and ofc, be glad to elaborate if so requested.

ps, I did manage to get it even shorter, but it does require some attention to the naming of the entities :

    filter:
      include:
        - entity_id: binary_sensor.*_door
          state: 'on'
          options:
            secondary_info: last-changed

but thats besides the issue here probably, because many groups consist of differently named entities, and would benefit this use case

@Mariusthvdb
Copy link

hey @spali !
will you fix the conflicts in this PR? would love to see the group_expand feature in auto-entities. Hope you can make it work.
thanks!

@spali
Copy link
Author

spali commented Mar 25, 2022

Hi @Mariusthvdb
As I didn't got feedback since 3 years, not using this feature anymore in auto_entities, so can't test.
But your are welcome to hijack or "clone" this PR. Shouldn't be to hard as it was a small uncomplicated change.

@Mariusthvdb
Copy link

Mariusthvdb commented Mar 25, 2022

right....

Ill have a look. And while at it, it should be expanded to binary_sensor s group, because they use the same format, and we can already use them in the group filter.

Maybe Thomas spots this conversation, and he could comment on the feasibility of the PR I hope..

thanks!

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

Successfully merging this pull request may close these issues.

3 participants