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

Can't include head: options when using inside a auto-entities group filter #230

Open
4 tasks done
ajma opened this issue Sep 26, 2022 · 7 comments · May be fixed by #231
Open
4 tasks done

Can't include head: options when using inside a auto-entities group filter #230

ajma opened this issue Sep 26, 2022 · 7 comments · May be fixed by #231

Comments

@ajma
Copy link

ajma commented Sep 26, 2022

My Home Assistant version: 2021.09.7

Fold-entity-row version (FROM BROWSER CONSOLE): 20.0.12

What I am doing: Trying to set head inside a auto-entities group filter

What I expected to happen: entity shows up with secondary-info in the head

What happened instead: secondary-info isn't showing up. the entities inside the group are showing up with the right state but without the secondary info

Minimal steps to reproduce:

# The least amount of code possible to reproduce my error

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - group: light.downstairs
      or:
        - state: 'on'
      options:
        type: custom:fold-entity-row
        head:
          entity: light.downstairs
          secondary_info: last-changed
        group_config:
          secondary_info: last-changed


# End of code

Error messages from the browser console:


By putting an X in the boxes ([X]) below, I indicate that I:

  • Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).
  • Have made sure I am using the latest version of the plugin.
  • Have followed the troubleshooting steps of the "Common Problems" section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.
  • Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.
@ildar170975
Copy link

The code is wrong.
A proper code is clearly described in the docs.

type: entities
entities:
  - type: custom:auto-entities
    filter:
      include:
        - group: # add group sensor
          # add whatever you want
    card:
      type: custom:fold-entity-row
      head:
        entity: # add your entity
        secondary_info: last-changed
      group_config:
        secondary_info: last-changed

@ajma
Copy link
Author

ajma commented Sep 28, 2022

But doesn't that make everything in the auto-entities list a fold-entity-row? I only want that single group to be a fold-entity-row. My code almost works, it does everything except show secondary-info in the head

@ildar170975
Copy link

ildar170975 commented Sep 28, 2022

My code almost works, it does everything except show secondary-info in the head

It cannot work.
Check your code:

      options:
        type: custom:fold-entity-row
        head:
          entity: light.downstairs

which means - each row in the Entities card is fold-entity-row with some head and undefined folded entities.

You may do this:

type: custom:auto-entities
filter:
  include:
    - group: group.demo_lights
card:
  type: entities

which creates just a list of entities, w/o fold-entity-row.

I only want that single group to be a fold-entity-row

then just add these entities after your auto generated fold-entity-row
image

@ajma
Copy link
Author

ajma commented Sep 28, 2022

Here's what I have:
image

groups.lock is just there to show that I'm using auto-entities to expand other groups into normal entities
but light.downstairs is expanded into the three rooms which are each fold-entity-row where the children have the secondary-info but I can't figure out the yaml to make the head also show secondary-info

@ajma
Copy link
Author

ajma commented Sep 28, 2022

The last example in the readmd has this:

type: custom:auto-entities
card:
  type: entities
  title: All groups
filter:
  include:
    - domain: group
      options:
        type: custom:fold-entity-row

I'm basically trying to use this but also set the secondary-info in the head but it looks like head is getting completely dropped.
Even if I do

head:
  type: section
  label: test

it doesn't keep label. I'm starting to wonder if this is an auto-entities issue.

@ajma
Copy link
Author

ajma commented Sep 28, 2022

Ok, so I looked at the code and my current hypothesis is that it's because of https://github.com/thomasloven/lovelace-fold-entity-row/blob/master/src/main.ts#L54 which is let head = ensureObject(this._config.entity || this._config.head);. My hypothesis is that auto-entities is setting _config.entity, so the head is getting ignored. I'll see if I can setup a dev environment and test it out.

@ajma ajma linked a pull request Sep 28, 2022 that will close this issue
@ajma
Copy link
Author

ajma commented Sep 28, 2022

Ok, I tested it and it turned out to be right. I submitted a PR.

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 a pull request may close this issue.

2 participants