#Conditional header appearance on dashboard

1 messages · Page 1 of 1 (latest)

opal mural
#

i've created a section on my dashboard dedicated to firmware updates with a subtitle header called 'updates'.

right now, each firmware update tile is configured to only be visible if a firmware update is available.

if no tiles are visible, i'd also like the 'Updates' header to not be visible. right now, i'm using conditional or statements in the visibility tag of the header to control this, but it is quickly growing unwieldy as i add my firmware update tiles.

is there an easier way to make something conditional like this?

novel birch
#

Isn't it HA way just to create a new template sensor and use it in the condition? 🙂

novel birch
#

Well, I think you wanted to avoid listing all the possible update possibilities anywhere except in tiles - and only show header when there are some tiles visible, right?

I don't know if that is doable, but instead I might just list them inside the boolean template sensor which results in 'true' once there are any update available.

#

Are you autogenerating the tiles somehow?

opal mural
#

i'm not. i'm just using visibilty to control whether the tiles should also be available (if firmware update status is yes).

serene totem
#

I just wanted to throw this out there. Instead of making individual cards (and subsequently toggling its visibility conditionally) for the firmware updates, consider auto entities. In the example show here, I used the domain for updates, but you can change your syntax to find entities that meet a certain name pattern, for example. Something like binary_sensor.firmware_update* with a state of yes.

#
type: custom:auto-entities
card:
  type: grid
  columns: 3
  square: false
card_param: cards
filter:
  include:
    - domain: update
      state: "on"
      options:
        type: custom:button-card
        name: "[[[ return entity.attributes.friendly_name.replace(/ update/ig,''); ]]]"
        show_entity_picture: true
        state:
          - operator: template
            value: "[[[ return entity.attributes.in_progress == true ]]]"
            styles:
              icon:
                - animation: blink 1.5s ease infinite
        hold_action:
          action: call-service
          service: update.install
          data:
            entity_id: this.entity_id
  exclude:
    - state: unavailable
    - entity_id: "*demo*"
else:
  type: markdown
  content: <ha-alert alert-type="info">No updates available</ha-alert>
sort:
  method: name
  reverse: false
  numeric: false
show_empty: true