Lovelace: Button card

You need a matching state e.g.

state:
  - value: 'on'
    spin: true
1 Like

Those are valid requests, but unfortunately not yet possible :slight_smile: Could you please create 2 feature requests on github? :slight_smile:

I still cant get it to work… The icon remain black even if I use red and yellow as color… :confused:

         - type: horizontal-stack
           cards:
            - type: "custom:button-card"
              entity: input_boolean.alarm_1_mon
              name: Mon
              icon: mdi:alpha-m-box-outline
              tap_action:
                action: call-service
                service: input_boolean.toggle
                service_data:
                  entity_id: input_boolean.alarm_1_mon
              show_state: false
              show_name: true
              color_type: icon
              styles:
                icon:
                  - color: >
                      [[[
                        if (states['input_boolean.alarm_1_mon'].state == 'on' && states['input_boolean.alarm_1_enable'].state == 'on') return 'blue';
                        return 'yellow';
                      ]]]

The configuration seems correct. Are you sure you’re using the latest version? Please clear your browser cache and retry.

I was on 2.0.4 but I didn’t see that there was any change that I used…
I swapped to 2.0.5 and now it works… Sorryl :smiley:
And thx for the help! :smiley:

please note that since you are using the entity input_boolean.alarm_1_mon for your button, you can also use this as your template:

                  - color: >
                      [[[
                        if (entity.state == 'on' && states['input_boolean.alarm_1_enable'].state == 'on') return 'blue';
                        return 'yellow';
                      ]]]
1 Like

Thanks @RomRider I’ll put through the requests today.

Hi again, its possible agree a camera entity to this card?

that is awesome then I can copy-paste it to the rest without changing the code! Thx dude!

I have my custom buttons showing up beautifully, however they are not clickable, any ideas?

I did define an action type service.

Without your config it will be hard to help you :slight_smile:

Valid point :slight_smile:

https://pastebin.com/R9REyapd

That config is valid for version 0.0.4, we’re now at 2.0.5, please read the documentation

I seem to be missing “something”:

  • type: “custom:button-card”
    color_type: card
    tap_action:
    action: call-service
    service: remote.send_command
    service_data:
    entity_id: remote.living_room_remote
    device: 64382946
    command: ‘Mute’
    icon: mdi:volume-off
    color: rgb(75, 75, 77)

Indentation maybe?, update to the latest version and clear your browser cache please:

type: “custom:button-card”
color_type: card
tap_action:
  action: call-service
  service: remote.send_command
  service_data:
    entity_id: remote.living_room_remote
    device: 64382946
    command: ‘Mute’
icon: mdi:volume-off
color: rgb(75, 75, 77)

Mixing config that is with one that isn’t compatible (one button was right the other wasn’t) with the current version was the culprit. All is well now.

Any way to allow for unit_of_measure as a true/false config state?

I tried using custom_fields, but somehow the field won’t show up on Chrome on my Android phone.

custom_fields:
  states: >
    [[[
      return `${entity.state}`
    ]]]

Everything is in the documentation:
show_units: false

Thank you and sorry.
I must be sleepy or something :slight_smile:

I can’t seem to find a way to color the card AND the icon, not possible?