#Bubble Card template show_state of sub_button

1 messages · Page 1 of 1 (latest)

tough kraken
#

Hi,
I am using bubble cards as my main dashboard cards and I have a Button with multiple sub-buttons, one of which contains my shoppinglist todo entity. I would like that sub-button to only show the state (number of entries in the list) when it is greater than 0.

In the documentation I only found a way to template the main button state/name. My button looks something like this, shortened to the part I want to change:

type: custom:bubble-card
card_type: button
entity: light.eingang
sub_button:
  - entity: todo.einkaufsliste
    show_state: true
    show_icon: true
    icon: mdi:shopping-outline

Help would be very much appreciated 🙂

GitHub

Bubble Card is a minimalist card collection for Home Assistant with a nice pop-up touch. - Clooos/Bubble-Card

vivid surge
#

visibility condition was added to sub buttons recently

tough kraken
#

The button itself should always be visible. I am looking to only shown state in the sub-button when the state is above 0. Sorry for the misunderstand, I can see how my description wasn't super clear

vivid surge
#

you could create another sub button that is only visible when its below 1 with different settings that you want shown. that way whilst there is 2 buttons only 1 will be visible at a time and it will appear to a user as 1 button that changes

tough kraken
#

While that is true and a very pragmatic solution I havent thought about yet, I would prefer having something along the lines of this, only for the sub-button.

type: custom:bubble-card
card_type: button
entity: todo.einkaufsliste
icon: mdi:shopping-outline
show_attribute: true
styles: >
  ${card.querySelector('.bubble-state').innerText =
  hass.states['todo.einkaufsliste'].state >= 1 ?
  hass.states['todo.einkaufsliste'].state : ''}

Your solution might be a workaround for me though until I find a way to do it with a template like this 🙂

vivid surge
#

yeah i have a setup with 2 entire cards that switch over depending on a state. it works great for that. i imagine it should be fine for sub buttons too. although i will admit its maybe not a perfect solution

#

you could try the bubblecard subreddit too. Clooos is pretty active there

tough kraken
#

I change my dashboard setup fairly frequently. I just want to avoid having to change 2 buttons, in case I want to change something again and then missing something

tough kraken