Lovelace: Button card

HI,
trying to add a generic graph to my buttons, I am stuck somehow templating the entity of the button into the graph:

      - type: custom:button-card
        template: button_body
        entity: sensor.cpu_temperature
        name: Cpu temp
        custom_fields:
          plot:
            card:
              type: custom:mini-graph-card
              entities:
                - sensor.cpu_temperature

is the correct functionality, and makes it all happen. Of course, I need to set the entity of the mini-graph-card in the template and tried various optionsā€¦

      - type: custom:button-card
        template: button_body
        entity: sensor.cpu_temperature
        name: Cpu temp
        custom_fields:
          plot:
            card:
              type: custom:mini-graph-card
              entities:
                - '[[[ return states[entity]; ]]]'

or - '[[[ return entity; ]]]' and

- >
  [[[ return entity; ]]]

no luck just yet. could you please have a look how I could accomplish this? Iā€™d like to set this whole config bit as an anchor for the buttons below, or maybe even as a button-card template.

to give you the idea, this is what I copied and edited from Petroā€™s repoā€¦

      - type: custom:button-card
        template: button_body
        entity: sensor.cpu_temperature
        name: Cpu temp
        custom_fields:
          plot:
            card:
              type: custom:mini-graph-card
              entities:
                - '[[[ return states[entity]; ]]]'
              group: true
              points_per_hour: 1
              hour24: true
              line_color: var(--primary-color)
              line_width: 10
              hours_to_show: 24
              update_interval: 600
              show:
                name: false
                icon: false
                state: false
                points: false
                legend: false
                average: false
                extrema: false
                labels: false
                fill: false
                labels_secondary: false
                name_adaptive_color: false
                icon_adaptive_color: false
        styles:
          custom_fields:
            plot:
              - position: absolute
              - top: 55%
              - left: 50%
              - width: calc(100% + 25px)
              - transform: translate(-50%, calc(-50% + 10px))
              - z-index: 3
              - --paper-card-background-color: 'rgba(0, 0, 0, 0.0)'
              - --ha-card-background: rgba(0, 0, 0, 0.0)"
              - --ha-card-box-shadow: 'none'
              - pointer-events: none

showing like:

Schermafbeelding 2021-06-17 om 15.24.24
thanks for having a look

You have to use lovelace gen, config-template-card, or something else that lets you template cards that donā€™t have templating.

no, this does the trick, I just found it in another of my templates. Button-card is so horribly versatile, we can template almost anything!
duh, so silly, I keep forgetting this entity.entity_id:

        custom_fields:
          plot:
            card:
              type: custom:mini-graph-card
              entities:
                - >
                  [[[ return entity.entity_id; ]]]

button card template:

plot:
  custom_fields:
    plot:
      card:
        type: custom:mini-graph-card
        entities:
          - >
            [[[ return entity.entity_id; ]]]
        group: true
        points_per_hour: 1
        hour24: true
        line_color: var(--primary-color)
        line_width: 10
        hours_to_show: 24
        update_interval: 600
        show:
          name: false
          icon: false
          state: false
          points: false
          legend: false
          average: false
          extrema: false
          labels: false
          fill: false
          labels_secondary: false
          name_adaptive_color: false
          icon_adaptive_color: false
  styles:
    custom_fields:
      plot:
        - position: absolute
        - top: 55%
        - left: 50%
        - width: calc(100% + 25px)
        - transform: translate(-50%, calc(-50% + 10px))
        - z-index: 3
        - --paper-card-background-color: 'rgba(0, 0, 0, 0.0)'
        - --ha-card-background: rgba(0, 0, 0, 0.0)"
        - --ha-card-box-shadow: 'none'
        - pointer-events: none

button card config:

      - type: custom:button-card
        template:
          - button_body
          - plot
        entity: sensor.cpu_temperature
        name: Cpu temp

preview:

(noticed I have recorder disabled on a few of them :wink: )

thanks Petro, nice embellishment of the frontend today!

2 Likes

hey @RomRider, trying to develop the above plot: template, I was wondering if I can use a variable for the list of entities in the mini-graph-card. Have a few cards that could benefit from 2 or 3 entities there, and if I could add a variable containing the list that would be awesome.

variables:
  plot_entities: >
    [[[ return [entity.entity_id, second_entity_id]; ]]]

in the card, and then use:

plot:
  custom_fields:
    plot:
      card:
        type: custom:mini-graph-card
        entities: 
          >
            [[[ return variables.plot_entities; ]]]

in the template. Could something like that be possible?

this seems to at least shows the main second entity:

        variables:
          plot_entities: >
            [[[ return entity.entity_id, states['sensor.attic_sensor_calibrated_temperature'].entity_id; ]]]

but wont reveal the second first, main entity_id, no errors in inspector

haha, wait, bingo!

Schermafbeelding 2021-06-18 om 10.16.13

had a ā€˜doubleā€™ list mistake goingā€¦

button:

      - type: custom:button-card
        template:
          - button_body
          - plot_list
        entity: sensor.cpu_temperature
        variables:
          plot_entities: >
            [[[ return [entity.entity_id, states['sensor.attic_sensor_calibrated_temperature'].entity_id]; ]]]
        name: Cpu temp

and template(s) (made 2 of them, 1 for a list, 1 for only the main entity):

plot:
  template: plot_config
  custom_fields:
    plot:
      card:
        type: custom:mini-graph-card
        entities:
          - >
            [[[ return entity.entity_id; ]]]

plot_list:
  template: plot_config
  custom_fields:
    plot:
      card:
        type: custom:mini-graph-card
        entities: >
          [[[ return variables.plot_entities; ]]]

plot_config:
  custom_fields:
    plot:
      card:
        group: true
        points_per_hour: 1
        hour24: true
        line_color: var(--primary-color)
        line_width: 10
        hours_to_show: 24
        update_interval: 600
        show:
          name: false
          icon: false
          state: false
          points: false
          legend: false
          average: false
          extrema: false
          labels: false
          fill: false
          labels_secondary: false
          name_adaptive_color: false
          icon_adaptive_color: false
  styles:
    custom_fields:
      plot:
        - position: absolute
        - top: 55%
        - left: 50%
        - width: calc(100% + 25px)
        - transform: translate(-50%, calc(-50% + 10px))
        - z-index: 3
        - --paper-card-background-color: 'rgba(0, 0, 0, 0.0)'
        - --ha-card-background: rgba(0, 0, 0, 0.0)"
        - --ha-card-box-shadow: 'none'
        - pointer-events: none
1 Like

Hello everyone
Greetings from Switzerland.

I have been pulling my hair in making the attached card using the example in the Card Documentation on Github.

I have been able to bring the card to a certain level.
Can someone please help me on how to change the headings CPU, RAM, and SD to say DEVICE, CURRENT, and CONSUMPTION?
The data shown in the attached demo is correct only headings are wrong.

Regards
ST

1 Like

I use this card with some code I saw in another project, adapted to my own entities. Unfortunatly, when the screen is smaller, the buttons go on top of each other like in the picture. The cards are within a grid card.
How can I solve this?


type: custom:button-card
entity: light.candeeiro_da_sala
name: Candeeiro
icon: mdi:floor-lamp
label_template: >
  var bri = Math.round(states['light.candeeiro_da_sala'].attributes.brightness /
  2.55); return (bri ? bri : '0') + '%';
color: auto
size: 30%
show_state: true
show_label: true
styles:
  card:
    - border-radius: 15px
    - height: 130px
    - width: 130px
    - '--paper-card-background-color': rgb(255, 251, 239)
  icon:
    - padding: 0px 60px 0px 0px
  name:
    - padding: 0px 10px
    - font-size: 13px
    - font-family: Helvetica
    - justify-self: start
    - font-weight: bold
  label:
    - color: gray
    - font-size: 11px
    - font-family: Helvetica
    - padding: 0px 10px
    - justify-self: start
  state:
    - font-size: 11px
    - font-family: Helvetica
    - padding: 0px 10px
    - justify-self: start
    - text-transform: capitalize
    - font-weight: bold
state:
  - value: heat
    styles:
      name:
        - color: white
      state:
        - color: gray
  - value: cool
    styles:
      name:
        - color: white
      state:
        - color: gray
  - value: 'off'
    style:
      - opacity: 0.4
    styles:
      icon:
        - color: '#666666'
      name:
        - color: '#666666'
      state:
        - color: '#666666'
  - value: unavailable
    style:
      - opacity: 0.2
    styles:
      icon:
        - color: '#666666'
      name:
        - color: '#666666'
      state:
        - color: '#666666'

this is as simple as replacing the strings you mention (which are in the custom_fields) with the strings of your choice.

each of those will have something like:

  cpu: >
    [[[ return `<ha-icon icon=mdi:server style='width:12px;height:12px;'> </ha-icon>
                Cpu: <span style='color: var(--text-color-sensor);'>
                ${states['sensor.processor_use'].state}%</span>`; ]]]

you replace the Cpu: in the template with ā€˜Deviceā€™. thats it really.

Of course, for your own sake, I would suggest you also change the name of the custom_field itself accordingly, both in the styles section and in the custom_fields section, like:

styles:
  custom_fields:
    device:
      - padding-bottom: 2px
      - justify-self: start
      - --text-color-sensor: >
          [[[ var state = states['sensor.processor_use'].state;
              if (state < 10) return 'green';
              if (state < 25) return 'darkgreen';
              if (state < 45) return 'orange';
              if (state < 60) return 'maroon';
              return 'red'; ]]]

custom_fields:
  device: >
    [[[ return `<ha-icon icon=mdi:server style='width:12px;height:12px;'> </ha-icon>
                Device: <span style='color: var(--text-color-sensor);'>
                ${states['sensor.processor_use'].state}%</span>`; ]]]

note I only changed cpu into device, and didnt touch any non the other entities you need to change tooā€¦

Iā€™m struggling with grids.
Iā€™d like to replicate the behaviour of ā€œdwainā€™s dashboardā€:
image

Anyone here managed this ?
My issue: how can I get the roomā€™s icon to be that big, and with status icons on the right ? (it could be underneath alsoā€¦)

thanks a lot!

Asking for help :mask:
I want to create a template for a button that is square, rounded corners, background color changes with theming (or just set) and this button/card is to show the temperature value of a sensor. And for the love of me, I cant find any simple resource to learn this. I have the custom card button addon via HACS installed and ready to be utilized.

This is what Iā€™m working with in regards to my lights;

image

button_card_templates:
  light:
    aspect_ratio: 1/1
    color: auto-no-temperature
    color_type: card
    tap_action:
      action: toggle
    hold_action:
      action: more-info
    show_icon: true
    show_name: true
    custom_fields:
      info: |
        [[[ if (entity.state == 'on' && entity.attributes.brightness) {
            const brightness = Math.round(entity.attributes.brightness/2.54);
            const radius = 20.5; const circumference = radius * 2 * Math.PI;
            return `<svg viewBox="0 0 50 50"><circle cx="25" cy="25" r="${radius}"
            stroke="var(--active-color)" stroke-width="2" fill="none"
            style="transform: rotate(-90deg); transform-origin: 50% 50%;
            stroke-dasharray: ${circumference};
            stroke-dashoffset: ${circumference - brightness / 100 * circumference};" />
            <text x="50%" y="54%" fill="white" font-size="16" 
            text-anchor="middle" alignment-baseline="middle">
            ${brightness}<tspan font-size="10">%</tspan></text></svg>`;} ]]]
    styles:
      custom_fields:
        info:
          - position: absolute
          - right: 6%
          - top: 6%
          - width: 30%
      card:
        - font-size: 90%
        - border-radius: 1ems
    state:
      - value: 'off'
        styles:
          icon:
            - color: grey
      - value: 'on'
        styles:
          icon:
            - color: white

I would like to match this, but for temperature, but Im not sure how to to this

Could some kind internet-person please assist me in ā€œcreatingā€ this card, it would be greatly appriciated
Best regards from Sweden

Hello Folks. I am still struggling with the transition to fire-dom-event. This popup works as a standard button card, but not as a custom button card. With the custom button card, the popup just, doesnā€™t popup. Iā€™ll be supremely grateful if some kind and wise soul could please help me out!

Not working:

type: custom:button-card
icon: mdi:microsoft-xbox
name: Xbox Remote
layout: icon_name
tap_action:
  action: fire-dom-event
  browser_mod:
    command: popup
    title: Xbox Remote
    card:
      type: vertical-stack
      cards:
        - type: horizontal-stack
          cards:
            - type: custom:button-card
              color_type: blank-card
            - type: custom:button-card
              color_type: blank-card
            - type: custom:button-card
              color_type: card
              color: rgb(223, 255, 97)
              icon: mdi:volume-plus
              tap_action:
                action: call-service
                service: media_player.volume_up
                service_data:
                  entity_id: media_player.xbox
            - type: custom:button-card
              color_type: card
              color: rgb(223, 255, 97)
              icon: mdi:volume-minus
              tap_action:
                action: call-service
                service: media_player.volume_down
                service_data:
                  entity_id: media_player.xbox
            - type: custom:button-card
              color_type: blank-card
            - type: custom:button-card
              color_type: blank-card
        - type: picture-elements
          image: >-
            data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjEwIiBoZWlnaHQ9IjkwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogPG1ldGFkYXRhPgogIDxyZGY6UkRGPgogICA8Y2M6V29yayByZGY6YWJvdXQ9IiI+CiAgICA8ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD4KICAgIDxkYzp0eXBlIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiLz4KICAgIDxkYzp0aXRsZS8+CiAgIDwvY2M6V29yaz4KICA8L3JkZjpSREY+CiA8L21ldGFkYXRhPgogPGc+CiAgPHRpdGxlPmJhY2tncm91bmQ8L3RpdGxlPgogIDxyZWN0IGlkPSJjYW52YXNfYmFja2dyb3VuZCIgeD0iLTEiIHk9Ii0xIiB3aWR0aD0iODAyIiBoZWlnaHQ9IjYwMiIgZmlsbD0ibm9uZSIvPgogPC9nPgog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haW50LW9yZGVyOnN0cm9rZSBmaWxsIG1hcmtlcnMiLz4KIDwvZz4KPC9zdmc+Cg==
          elements:
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: Up
              style:
                top: 45.35%
                left: 14.3%
                width: 6.2%
                height: 15%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: Down
              style:
                top: 74.7%
                left: 14.3%
                width: 6.2%
                height: 15%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: Left
              style:
                top: 60%
                left: 8.05%
                height: 14.4%
                width: 6.4%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: Right
              style:
                top: 60%
                left: 20.65%
                height: 14.4%
                width: 6.4%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: A
              style:
                top: 82.5%
                left: 80.05%
                width: 10.5%
                height: 24.4%
                border-radius: 100%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: X
              style:
                top: 60.0%
                left: 70.6%
                width: 10.5%
                height: 24.4%
                border-radius: 100%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: B
              style:
                top: 60.0%
                left: 89.5%
                width: 10.5%
                height: 24.4%
                border-radius: 100%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: 'Y'
              style:
                top: 37.9%
                left: 80.05%
                width: 10.5%
                height: 24.4%
                border-radius: 100%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.toggle
              service_data:
                entity_id: remote.xbox_remote
              style:
                top: 80.2%
                left: 47.2%
                width: 7%
                height: 16%
                border-radius: 100%
                overflow: hidden
            - type: service-button
              title: ''
              service: media_player.play_media
              service_data:
                entity_id: media_player.xbox
                media_content_type: ''
                media_content_id: Home
              style:
                top: 22.2%
                left: 47.2%
                width: 13.4%
                height: 31.2%
                border-radius: 100%
                overflow: hidden

Working:

type: button
icon: mdi:microsoft-xbox
name: Xbox Remote 2
layout: icon_name
tap_action:
  action: fire-dom-event
  browser_mod:
    command: popup
    title: Xbox Remote
    card:
      type: vertical-stack
      cards:
        - type: horizontal-stack
          cards:
            - type: custom:button-card
              color_type: blank-card
            - type: custom:button-card
              color_type: blank-card
            - type: custom:button-card
              color_type: card
              color: rgb(223, 255, 97)
              icon: mdi:volume-plus
              tap_action:
                action: call-service
                service: media_player.volume_up
                service_data:
                  entity_id: media_player.xbox
            - type: custom:button-card
              color_type: card
              color: rgb(223, 255, 97)
              icon: mdi:volume-minus
              tap_action:
                action: call-service
                service: media_player.volume_down
                service_data:
                  entity_id: media_player.xbox
            - type: custom:button-card
              color_type: blank-card
            - type: custom:button-card
              color_type: blank-card
        - type: picture-elements
          image: >-
            data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjEwIiBoZWlnaHQ9IjkwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogPG1ldGFkYXRhPgogIDxyZGY6UkRGPgogICA8Y2M6V29yayByZGY6YWJvdXQ9IiI+CiAgICA8ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD4KICAgIDxkYzp0eXBlIHJkZjpyZXN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EyNiA5Ljc0ODcgMi40NzM3IDIuOTAzOSA2LjgzNzEgMy4yNTcyIDkuNzQ4NyAwLjc4MzU4IDEuNTUxOC0xLjMxMzYgMi40MzUyLTMuMjQ5NiAyLjQzNTItNS4yODUzIDAtMi4wMjA0LTAuODkxMTMtMy45NDEtMi40MzUyLTUuMjQ2OXoiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9Ii43NjgyMiIgc3R5bGU9InBhaW50LW9yZGVyOnN0cm9rZSBmaWxsIG1hcmtlcnMiLz4KIDwvZz4KPC9zdmc+Cg==
          elements:
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: Up
              style:
                top: 45.35%
                left: 14.3%
                width: 6.2%
                height: 15%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: Down
              style:
                top: 74.7%
                left: 14.3%
                width: 6.2%
                height: 15%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: Left
              style:
                top: 60%
                left: 8.05%
                height: 14.4%
                width: 6.4%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: Right
              style:
                top: 60%
                left: 20.65%
                height: 14.4%
                width: 6.4%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: A
              style:
                top: 82.5%
                left: 80.05%
                width: 10.5%
                height: 24.4%
                border-radius: 100%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: X
              style:
                top: 60.0%
                left: 70.6%
                width: 10.5%
                height: 24.4%
                border-radius: 100%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: B
              style:
                top: 60.0%
                left: 89.5%
                width: 10.5%
                height: 24.4%
                border-radius: 100%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.send_command
              service_data:
                entity_id: remote.xbox_remote
                command: 'Y'
              style:
                top: 37.9%
                left: 80.05%
                width: 10.5%
                height: 24.4%
                border-radius: 100%
                overflow: hidden
            - type: service-button
              title: ''
              service: remote.toggle
              service_data:
                entity_id: remote.xbox_remote
              style:
                top: 80.2%
                left: 47.2%
                width: 7%
                height: 16%
                border-radius: 100%
                overflow: hidden
            - type: service-button
              title: ''
              service: media_player.play_media
              service_data:
                entity_id: media_player.xbox
                media_content_type: ''
                media_content_id: Home
              style:
                top: 22.2%
                left: 47.2%
                width: 13.4%
                height: 31.2%
                border-radius: 100%
                overflow: hidden

Hi all
I am trying to make a simple (I think card) but canā€™t find the right way.
I have the following card and I want to just add the watts of a sensor

color: rgb(253, 106, 2)
color_type: label-card
name: Kid Room
type: custom:button-card

sensor = sensor.sonoff_1000fe3b9b_power

Ideally I would like to in the name to add the watts. like the example below

Kid room: 1.200 watts

Any help how I can get there?

image

you could of course have a look at the documentation which explains this: button-card/README.md at master Ā· custom-cards/button-card Ā· GitHub

did you try any of this?

Donā€™t set the width and the height, use aspect_ratio instead.

Dwains dashboard is based on button-card (for most of the buttons), you can find all the templates in his github repository.

Where do you want to display the temperature? Like the percentage of brightness (which is also supposed to draw a circle but doesnā€™t display it)?

Did you clear your cache? Make sure you do it on ALL your devices aā€™d also make sure you are running the latest version before that. Also try in private navigation mode, if it works there, itā€™s 200% a caching issue.

2 Likes

Hi
Temperature in the middle of the card/box. And maybe the possibility to add ā€œCā€ for Celsius after?

hi,
for the fun of it, I am trying to have a custom-fields button spin, with a speed based on the actual fanspeed of an entity, sensor.argon_one_addon_fan_speed, and following the states it can have, as you see in the color template below

Of course Iā€™ve read @Ildar_Gabdullin on Lovelace: mini graph card - #1706 by Ildar_Gabdullin but am still a bit stuck on how to move that to a button-card, so seek some assistance pleaseā€¦

this is my button:

Schermafbeelding 2021-06-24 om 23.56.26 Schermafbeelding 2021-06-25 om 09.55.54

template:
  - button_body
  - plot_list
entity: sensor.cpu_temperature
variables:
  plot_entities: >
    [[[ return [entity.entity_id,
                states['sensor.attic_sensor_calibrated_temperature'].entity_id
                ];
    ]]]
name: Cpu temp
custom_fields:
  fan:
    >
      [[[ return `<ha-icon icon=mdi:fan style='width:15px;color: var(--speed-color);'> </ha-icon>
          <span style='color: var(--primary-color);'>
          ${states['sensor.argon_one_addon_fan_speed'].state} % </span>`; ]]]

styles:
  custom_fields:
    fan:
      - font-size: 11px
      - font-weight: bold
      - padding: 0px 3px
      - position: absolute
      - right: 5%
      - top: 10%
      - --speed-color: >
          [[[ var speed = states['sensor.argon_one_addon_fan_speed'].state;
              var mapper = {0:'green',
                            1:'darkgreen',
                            3:'orange',
                            33:'orangered'
                            66:'maroon'}
              return mapper[speed] ? mapper[speed] : 'red' ; ]]]
state:
  - operator: '<'
    value: 50
    styles:
      card:
        - color: green
  - operator: '<'
    value: 60
    styles:
      card:
        - color: darkgreen
  - operator: '<'
    value: 70
    styles:
      card:
        - color: orange
  - operator: '<'
    value: 80
    styles:
      card:
        - color: maroon
  - default:
    styles:
      card:
        - color: red

appreciate a little help here, thanks!

Hi Marius, is it typo?

yepā€¦ C&P error, edited it nowā€¦ sorry
I could of course also add it to a top variable, and use it in the styles for the colorā€¦ same for the speed could be done:

      speed-rotation: >
          [[[ var speed = states['sensor.argon_one_addon_fan_speed'].state;
              var mapper = {0:'0',
                            1:'4s',
                            3:'3s',
                            33:'2s',
                            66:'1s'}
              return mapper[speed] ? mapper[speed] : '0.3s' ; ]]]

maybe the 0 should be taken out, and a condition on state not being 0 should be included.

that way I could use the variable speed-rotation in the animation?>

Trying to simulate your case, can I have a code for

template:
  - button_body
  - plot_list

?

sure, theyā€™re all here