thomasloven/lovelace-fold-entity-row

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

ajma opened this issue · 7 comments

ajma commented

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.

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 commented

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

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 commented

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 commented

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 commented

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 commented

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