Lovelace: Button card

The built-in adaptation of button-card also has long-press functionality.

Actually, @kuuji, when I think about it there may be a way for your card to piggy-back on the built-in long-press handler as well. Let me know if you’d be interested in details.

Could you implement an icon template? Something like this:

          icon_template: >-
            {% if is_state('cover.garage_door', 'on') %}
              mdi:garage-open
            {% else %}
              mdi:garage
            {% endif %}
1 Like

Thanks for the heads up @Rondom @thomasloven but i cant seem to work out how to make the long press perform an action for a different entity. It will only give me options for the assigned button entity.

Is what im trying to do doable? If you imagine it this way, short press will turn on light.living_room and long press will turn on light.dining_room.

can you do like the example then and use 2 scripts?

- type: entity-button
  name: Turn Off Lights
  tap_action: call-service
  entity: script.light_living_room
  service: script.turn_on
  hold_action: call-service
  entity: script.light_dining_room
  service: script.turn_on

I thought this might be the way to do it. I’ll give a try when i get home from work tonight and report back.
Thanks

1 Like

Hmmm, doesn’t seem to work unfortunately. It just throw and error and doesn’t allow me to load the Lovelace UI :frowning:

Has anybody been able to make this card work on a Fire HD 10 running Fully Kiosk Browser (it works in Chrome and Silk, but not in FKB)? Keep getting the “custom element doesn’t exist” message. All other custom cards work flawlessly. Thanks!

have you make the script that you are calling?

Thats magnificent news! Do you have a link? Anxious to start with that. Been waiting for that since the demise of regular Tiles

Yes, they’re all scripts and i’m calling them as services. It seems as though you cannot have more than one entity per button??

So i can use the different actions ie tap and hold but for only the one entity, not multiple entities.

It’s in the main Tiles thread…

thanks, that’s cool! Missed it completely watching the original repo.

before we needed the input-text for each set of tiles, and put that into a group. Isn’t that required any longer now? Suffices to declare this main tiles set and have it show?

Don’t think so, been a while since I set it up and also left the old one still running. I did have to make a few subtle changes to the code copied from the customize file but it should be fairly obvious what as I remember it didn’t take long to do.

ok thanks.
for now I get this:

39

–edit-- that was a spacing issue. got my first Lovelace tiles!
seems this is not as nifty yet in autmatic spacing, row heights, icon_colors etc yet, so Ill have to keep my carefully configured Tiles in the legacy front-end after all… Hope this will be fixed soon then.
Glad to assist wherever possible

thx for pointing me to this

please help me out here, Im trying to use these apparently available possible settings in my Card:

if(config.title) newConfig.card_settings.title = config.title;
if(config.columns) newConfig.card_settings.columns = config.columns;
if(config.column_width) newConfig.card_settings.column_width = config.column_width;
if(config.row_height) newConfig.card_settings.row_height = config.row_height;
if(config.gap) newConfig.card_settings.gap = config.gap;

if(config.text_align) newConfig.common_settings.text_align_legacy = config.text_align;
if(config.text_uppercase == false) newConfig.common_settings.label.transform = "none";

if(config.color) newConfig.common_settings.background.value = config.color;
if(config.color_on) newConfig.common_settings.background.value_on = config.color_on;
if(config.color_off) newConfig.common_settings.background.value_off = config.color_off;

if(config.label) newConfig.common_settings.label.value = config.label;
if(config.text_color) newConfig.common_settings.label.color = config.text_color;
if(config.text_color_on) newConfig.common_settings.label.color_on = config.text_color_on;
if(config.text_color_off) newConfig.common_settings.label.color_off = config.text_color_off;
if(config.text_size) newConfig.common_settings.label.size = config.text_size;

if(config.label_sec) newConfig.common_settings.label_sec.value = config.label_sec;
if(config.text_sec_color) newConfig.common_settings.label_sec.color = config.text_sec_color;
if(config.text_sec_color_on) newConfig.common_settings.label_sec.color_on = config. text_sec_color_on;
if(config.text_sec_color_off) newConfig.common_settings.label_sec.color_off = config.text_sec_color_off;
if(config.text_sec_size) newConfig.common_settings.label_sec.size = config.text_sec_size;

if(config.icon_size) newConfig.common_settings.icon.size = config.icon_size;

No matter what I try, the only attributes that stick are color_on, color_off and row_height.

I can’t get the icon, label, label_sec or text to color as they should.

this is my global config for a set of tiles:

  - type: custom:tiles-card
    legacy_config:
      columns: 4
      row_height: 70px
      color_on: '#F0C209'
      color_off: '#555B65'
      text_uppercase: false
      text_color_on: '#555B65'
      text_color_off: '#F0C209'
      text_size: 1em
      text_sec_size: 1em
      text_align: center
      entities:

all icons and text show white:

58

while the should show:

41

isn’t this yet fully implemented, or am I doing something wrong here?
thx for having a look! @rodrigodf

Strange, mine’s identical.

Do you have any more input to your readme so I can see how you can use this and what type of different settings you can use?

The original readme is gone also or can you post an example file?

I am doing some work of my own home here and this is what I have been doing so far.
I have made a link-card so I can navigate from a button to a homepage like url: /lovelace/0

I have also made a “space-card” as you can see so it makes a no-card that also effect the spacing on the height for the next button.

2 Likes

Having trouble with the colour of my on/off button for the TV.
Should be red for ‘off’ and green for ‘on’ but the ‘on’ is not showing green. I think it’s because the state changes from ‘off’ to ‘playing’ rather than ‘on’.
Any way around this?

- type: "custom:button-card"
        entity: media_player.lg_webos_smart_tv
        icon: mdi:power
        color: rgb(0, 255, 0)
        color_off: rgb(255, 0, 0)
        show_state: true

Found the ‘state’ option and that fixed it.

- type: "custom:button-card"
    entity: media_player.lg_webos_smart_tv
    icon: mdi:power
    show_state: true
    state:
      - value: 'off'
        color: rgb(255, 0, 0)
      - value: 'playing'
        color: rgb(0, 255, 0)