šŸ”¹ fold-entity-row - Hide away stuff in entities cards

You are not getting the difference.
In case of using a ā€œstack methodā€ you only need card-mod in places like ā€œadd a non-folded row on a root level - for that place Entities card with removed top or bottom margin/paddingā€.
In case of using YOUR method you need to WIDEN the Entities card (by negative margins) for EACH list.

Probably you should make a simple TRY.
I stopped convincing you.

face palm I understood the difference 10 posts back. Its not a solution.

hello,

First of all thanks for you great add on, i have been using it for a while now! Very convenient!

is it possible to add an icon for the word ā€œrolluikenā€.
My try doesnt workā€¦ (so the ā€œicon: mdi:windows-shutterā€ part)ā€¦

type: custom:fold-entity-row
head:
  type: section
  label: Rolluiken
  icon: mdi:window-shutter
entities:
  - type: custom:fold-entity-row
    head: cover.woonkamer
    entities:
      - entity: cover.kids_corner_zuid
      - entity: cover.kids_noord
      - entity: cover.wk_achter
      - entity: cover.wk_voorzijde
      - entity: cover.zitkamer_zuid
  - entity: cover.kantoor
  - entity: cover.slaapkamer_a
  - entity: cover.keuken

Not related to fold-entity-row.
Probably you need to use:
ā€“ either a conventional entity row with an icon - but with hidden ā€œstateā€ part (card-mod);
ā€“ or template-entity-row to specify a name, an icon and w/o showing a ā€œstateā€ part.

Hello All,
I have been using fold-entity-row for a long time and have found it really usefull, thank you Thomas!

Recently I added a fold-entity-row instance to a card which uses config-template-card - which may or may not be a supported combination. The foldable row can be unfolded and folded using the chevron. However, while unfolded if one of the entities ā€˜in the foldā€™ changes state the folded row folds back up.

The card I am using includes a lot of templated values to operate, but this simplified example which removed most of the templating demonstrates the same behaviour. In this example, if the folded row is unfolded, instead of staying unfolded indefinitely it folds when the state of switch.esp_fs_relay changes state.

If line 3 ( - switch.esp_fs_relay) is removed from this example the fold/unfold state is maintained is the state of switch.esp_fs_relay changes, but the change of entity state is not shown on card.

It seems that config-custom-card monitors the state of the entities and triggers an update of the entities card, but the folded/unfolded state of the fold-entity-row reverts to folded.

Should what I am trying to do possible (ie. Using config-custom-card in conjunction with fold-entity-row), or is there an issue with config-custom-card or fold-entity-row?

type: custom:config-template-card
entities:
  - switch.esp_fs_relay
  - binary_sensor.esp_fs_status
  - binary_sensor.esp_fs_ac_sense
card:
  type: entities
  title: '*** Test Card  1 ***'
  entities:
    - type: custom:fold-entity-row
      head:
        name: Status
        entity: binary_sensor.esp_fs_status
        state_color: true
      entities:
        - binary_sensor.esp_fs_ac_sense
        - switch.esp_fs_relay

It triggers rebuilding the card - and this causes a folding.
Try using CTC not for the whole card but for a particular row only.

Thank you for the reply. Your suggestion does work, and prevents the rold-entity-row reverting to the folded state when one of the entities changes state.

However, wrapping each row in a CTC looses the advantage of using CTC in the first place.in my usage case, which without some of the simplification looks like below. The same card definition is used many times in my frontend, with only the ā€˜NODE_NAMEā€™ changing. Multiple CTCs would make the card definition far longer and more complex, and NODE_NAME would need to be changed in many places.

I donā€™t really understand why when CTC is not being used fold-entity-row remembers itā€™s folded/unfolded state when an entiry state changes and the card is rebuilt, but wrapping the card in CTC makes fold-entity-row revert to folded with every card rebuild? Iā€™m not clear whether a very small change (to either my config, fold-entity-row or CTC) could make this work, or whether what I am trying to do is not possible for a good reason.

type: custom:config-template-card
variables:
  NODE_NAME: '''esp_fs_e8bb0c'''
entities:
  - ${'switch.'+NODE_NAME+'_relay'}
  - ${'binary_sensor.'+NODE_NAME+'_status'}
  - ${'sensor.'+NODE_NAME+'_location'}
  - ${'sensor.'+NODE_NAME+'_uptime'}
  - ${'binary_sensor.'+NODE_NAME+'_ac_sense'}
  - ${'sensor.'+NODE_NAME+'_signal'}
  - ${'sensor.'+NODE_NAME+'_ac_on'}
  - ${'sensor.'+NODE_NAME+'_kwh'}
  - ${'sensor.'+NODE_NAME+'_cost'}
  - ${'sensor.'+NODE_NAME+'_ip'}
  - ${'sensor.'+NODE_NAME+'_esphome_version'}
  - ${'sensor.'+NODE_NAME+'_source_file'}
  - ${'switch.'+NODE_NAME+'_auto_led_dim'}
  - ${'switch.'+NODE_NAME+'_man_led_dim'}
  - ${'switch.'+NODE_NAME+'_power_led_diags'}
  - ${'switch.'+NODE_NAME+'_wifi_led_diags'}
  - ${'switch.'+NODE_NAME+'_cron'}
  - ${'button.'+NODE_NAME+'_restart'}
  - ${'sensor.'+NODE_NAME+'_heap_free'}
  - ${'sensor.'+NODE_NAME+'_ssid'}
card:
  type: entities
  title: ${ NODE_NAME }
  state_color: true
  entities:
    - type: custom:fold-entity-row
      head:
        name: Status
        entity: ${'binary_sensor.'+NODE_NAME+'_status'}
      entities:
        - type: custom:hui-element
          card_type: custom:template-entity-row
          entity: ${'sensor.'+NODE_NAME+'_esphome_version'}
          name: Node Name
          state: ${ NODE_NAME }
        - entity: ${'sensor.'+NODE_NAME+'_esphome_version'}
        - entity: ${'sensor.'+NODE_NAME+'_source_file'}
        - entity: ${'switch.'+NODE_NAME+'_auto_led_dim'}
        - entity: ${'switch.'+NODE_NAME+'_man_led_dim'}
        - entity: ${'switch.'+NODE_NAME+'_power_led_diags'}
        - entity: ${'switch.'+NODE_NAME+'_wifi_led_diags'}
        - entity: ${'switch.'+NODE_NAME+'_cron'}
        - entity: ${'button.'+NODE_NAME+'_restart'}
        - entity: ${'switch.'+NODE_NAME+'_relay'}
        - entity: ${'binary_sensor.'+NODE_NAME+'_ac_sense'}
        - entity: ${'sensor.'+NODE_NAME+'_heap_free'}
        - entity: ${'sensor.'+NODE_NAME+'_ssid'}
  show_header_toggle: false

Create a folded row, make F5, and see your state reverted.

As for your code - CTC not required here. Use decluttering card.

I already use the decluttering card, but I have tried to keep my sample code as simple as possible to demonstrate the issue I have. I agree that ā€˜config-template-cardā€™ (CTC) is not required for the simple example I have given. However, my cards use templates for things like the card title and a PIN for a restrictions card, so I do want to use CTC.

Without the CTC wrapper the entities on an unfolded ā€˜fold-entity-rowā€™ update as they change state, and the rows remain unfolded. The rows remain unfolded until they are manually closed

When using CTC, if an entitity on an unfolded ā€˜fold-entity-rowā€™ change state, the rows immediately fold.

In the example I have given if I unfold the fold-entity-row and toggle the switch (switch.ā€™+NODE_NAME+ā€™_relay) the rows immediately fold. If I remove the CTC wrapper and hard code everything I can toggle the switch without the rows folding.

I am looking for a way of using ā€˜fold-entity-rowā€™ in conjunction with ā€˜config-template-cardā€™ without the rows folding very time an entity changes state, if that is possible.

Already answered about the only way of using them together without folding/unfolding on a stateā€™s change.

Is there an easy way to tie the expand/collapse to the status of a switch entity?

I have opensprinkler and the dedicated card is VERY nice but thereā€™s a lot to it. When opensprinkler is disabled (like it is during the Winter), Iā€™d love to have the fold-entity-row card collapse this down to the single ā€˜enable opensprinklerā€™ entity. Is it possible? Something like this:

Collapsed when the entity is disabled:
image

Expanded when the entity is enabled:

Can you share the code please :slight_smile:

I just found your reply because I wanted to create a nested fold-entity-row based on the value (or lack thereof) in an input_text.
Unfortunately it seems that defining state_not: '' is invalid, so I cannot have the card appear as soon as there is a value in the input_text.

Do you (or does anybody else) know an alternative way to make a fold-entity-rowconditional?

 - type: entities
    entities:
      - entity: switch.hot_water
        icon: mdi:shower
      - type: custom:fold-entity-row
        head:
          type: section
          label: Schedule
        items:
          - input_boolean.hot_water_schedule
          - type: custom:fold-entity-row
            head:
              type: section
              label: Weekdays
            items:
              - input_datetime.weekdays_am_hot_water_on
              - input_datetime.weekdays_am_hot_water_off
              - input_datetime.weekdays_pm_hot_water_on
              - input_datetime.weekdays_pm_hot_water_off
          - type: custom:fold-entity-row
            head:
              type: section
              label: Weekends
            items:
              - input_datetime.weekends_am_hot_water_on
              - input_datetime.weekends_am_hot_water_off
              - input_datetime.weekends_pm_hot_water_on
              - input_datetime.weekends_pm_hot_water_off
1 Like

Is it possible to have the fold open by default on PC. And closed by default on a phone?

How do I use other cards instead of the normal entity cards? I would like to use mushroom-light-card for this, but setting that as head doesnā€™t work. This is what I have now and does work, but it would be great if I could use it with mushroom cards.

type: entities
entities:
  - type: custom:fold-entity-row
    head:
      type: section
      label: Lampen
    open: true
    entities:
      - entity: light.lamp_slaapkamer
        name: Grote lamp
        icon: mdi:ceiling-light
        secondary_info: brightness
        state_color: true
      - entity: light.smartsleep
        name: Wake up light
        icon: mdi:bed-clock
        secondary_info: brightness
        state_color: true
      - entity: light.smartsleep_night
        name: Nachtlampje
        icon: mdi:moon-waxing-crescent
        secondary_info: brightness
        state_color: true
  - type: custom:fold-entity-row
    head:
      type: section
      label: Verwarming
    open: true
    entities:
      - entity: switch.kacheltje
        icon: mdi:radiator
  - type: custom:fold-entity-row
    head:
      type: section
      label: Wekker
    open: false
    entities:
      - type: custom:time-picker-card
        entity: input_datetime.smartsleep
        name: Tijd
        hour_mode: 24
        hour_step: 1
        minute_step: 5
        layout:
          hour_mode: double
          align_controls: right
          embedded: true
          thin: true
        hide:
          seconds: true
      - entity: switch.smartsleep_alarm0
        name: Aan/uit
      - entity: select.smartsleep_alarm0_days
        name: Voor wanneer ingesteld?
title: Slaapkamer
show_header_toggle: false

mushroom in a fold:

    - type: entities
      card_mod:
        style:
          fold-entity-row$: |
            ha-icon {
              color: rgb(var(--rgb-disabled-color));
              margin-right: 24px;
            }
          .: |
            .card-content {
              padding: 0;
            }

      entities:
        - type: custom:fold-entity-row
          head:
            type: custom:mushroom-entity-card
            card_mod:
              style: |
                ha-card {
                  box-shadow: none;
                }
            entity: group.hub_device_trackers
            name: Lounge Amps
            icon: mdi:audio-video
            icon_color: light-blue
            tap_action:
              action: toggle
          padding: 0
          entities:
            - type: custom:auto-entities
              card_param: cards
              filter:
                include:
                  - group: group.hub_device_trackers
                    options:
                      type: custom:mushroom-person-card
                      <<: &style_card
                        card_mod:
                          style: |
                            ha-card {
                              margin: -8px 0px 0px 0px;
                              box-shadow: none;
                            }
                      icon_color: light-blue
                      tap_action:
                        action: toggle
              card:
                type: grid
                columns: 2
                square: false
                <<: *style_card
              sort:
                method: friendly_name

This doesnā€™t work at all. Tried copying what you did. Only thing that happens is that my section name does not show, as I head to change type: section to type: custom:mushroom-entity-card

type: entities
card_mod:
   style:
     fold-entity-row$: |
       ha-icon {
         color: rgb(var(--rgb-disabled-color));
         margin-right: 24px;
       }
     .: |
       .card-content {
         padding: 0;
       }
entities:
  - type: custom:fold-entity-row
    head:
      type: custom:mushroom-entity-card
      card_mod:
        style: |
                ha-card {
                  box-shadow: none;
                }
      label: Dakraam
    open: true
    entities:
      - name: Auto open en dicht
        entity: input_boolean.dakraam_open
      - name: Handmatig bedienen
        entity: cover.shelly_shsw_25_c8c9a3741ba6
        secondary_info: position
title: Badkamer

there is no entity in the head?

over than that, its not clear what you are trying to do. you wanted mushroom cards inside the fold, but now use plain type: entities ?