Lovelace: Button card

Double check how your script is named.
Here’s a working example.

type: custom:button-card
name: Test
tap_action:
  action: toggle
entity: script.meals

The meals script

sequence:
  - service: light.toggle
    data: {}
    target:
      entity_id: light.meals
mode: single
icon: mdi:lightbulb

Hi, tried your way, but a get Following error on pop up card:

Entities must be specified
type: entities
entities: >-
  - sensor.docker_alpine_state<br>- sensor.docker_alpine_cpu<br>-
  sensor.docker_alpine_memory_percent<br>- sensor.docker_alpine_up_time<br>

As you can see is printed what code is, and not the result of code. MMaybe some typo?

I talked about a custom field in custom:button-card.

Hi, i tried in the following way, but i get same result:

    hold_action:
      action: fire-dom-event
      browser_mod:
        command: popup
        deviceID: this
        title: Informazioni
        card:
          type: entities
          custom_fields:
            info_popup:
              entities: |
                [[[ 
                  return '- ' + variables.name_sensor + '_state<br>- ' + variables.name_sensor + '_cpu<br>- ' + variables.name_sensor + '_memory_percent<br>- ' + variables.name_sensor + '_up_time<br>' ;
                 ]]]

and in the buttom card:

type: custom:button-card
template: docker_button
entity: switch.docker_alpine
variables:
  name: Alpine
  container_state: sensor.docker_alpine_state
  name_sensor: sensor.docker_alpine
triggers_update: sensor.docker_alpine_state
custom_fields:
  info_popup: ''

What’s wrong?

That’s another card :wink:

hello =)

I have a template that I would like to have printed out on my card.

It works in the developer tools, but I don’t get it printed as a “name”.

{{ distance(53.519606, 7.278606, 'device_tracker.iphone_von_karsten') }}


this is wrong:

custom_fields:
  distance:
    card:
      type: custom:button-card
      name: >-
        [[[ return
        `{{ distance(53.519606, 7.278606, 'device_tracker.iphone_von_karsten') }}`
        ]]]

maybe we will also get the state:attribute directly involved? instead of 53,51… and 7,27…
${states['sensor.tankerkoenig_shop_chill_diesel'].attributes.latitude}
${states['sensor.tankerkoenig_shop_chill_diesel'].attributes.longitude}

Sorry, but cannot follow you.
If you want show me how it should work. I found way to print my built entities but they just are printed out as strings.

@DavidFW1960 I know I can download it manually, but it is a hassle for anyone that wants to try my dashboard.

I tried to fork the repo, but when adding my repo in HACS it will always say Repository structure for master is not compliant. I have tried releasing different versions and even tried using the current stable version but for some reason whatever I do it will keep throwing this error. (I have had more success with other stale repositories that I just forked, fixed and added as a custom repo).

Would you maybe have an idea? (or anyone else ofc)

where is the forked repo? I’ll have a look

I didn’t change anything, I just want to be able to get the ‘beta’ release in HACS :joy:

Edit: I removed the releases, since they didn’t do much good anyways, it always throws the same error. Even if I release some version (just by releasing it through the already existing tags), but instead of master it will show that version number instead.

is package.json throwing it off with the wrong repo name in there?

Something looks wrong in RomRider repo anyway… Was Dec 2020 really the last release of this card? Surely now.

Yeah seems to be the latest stable release. I use fire-dom-event quite a bit.

I really hope the card wont suffer the same fate as when it was abandoned by kuuji a few years back. I remember this card being broken for months…

Jerome took it on pretty quickly… He is pretty busy with Apex Charts and is a very active dev but it has concerned me in the past that his very high level of responsiveness to every request etc will just burn him out… and I use so much of his stuff it’s a worry.

Yeah he did and made it much better too. He’s a great person imho. His cards are the best around, but indeed as you say I hope he doesnt get burnt out by it.

Its for that reason I tried to fork it and just release the latest beta (people could then add it as a custom repository) which would be enough currently. But my knowledge of HACS is well, mediocre at best.

1 Like
`{{ distance(53.519606, 7.278606, 'device_tracker.iphone_von_karsten') }}`

delete the signs after and before your expression. This is not necessary.

   {{ distance(53.519606, 7.278606, 'device_tracker.iphone_von_karsten') }}

hey =)

but I can’t use it alone behind the return…

  km: |
    [[[
      var b = states['sensor.tankerkoenig_shop_chill_diesel'].attributes.latitude;
      return {{ distance(53.519606, 7.278606, 'device_tracker.iphone_von_karsten') }};
    ]]]

Ah, sorry. I’ve overseen something. You mixing up different languages.
{{ … }}is jinja which doesn’t work in a button card.
I don’t know if there is an expression similar to distance available there.

My recommendation: Create a template sensor and display this.
In configuration.yaml

sensor:
- platform: template
    sensors:
      karstes_distance_from_next_gas_station:
          value_template: "{{ distance(53.519606, 7.278606, states('device_tracker.iphone_von_karsten') }}"

In the button card:

[[[
  return states['sensor.karstes_distance_from_next_gas_station'].states;
]]]

ahhhh as a sensor… thanks
…too bad, I thought i could implement that directly into the map
thank you very much!

Means that you want transport variables from a button_card_template into Browser_Mod. I assumed (wrong) that you were using a custom:button-card. Since I don’t use browser_mod, I can’t say whether the fields are templatable.

You can try it with


  entities: |
    [[[
     var items = ['- ' + variables.name + '_state', '- ' + variables.name + '_cpu', '- ' + variables.name + '_percent', '- ' + variables.name + '_uptime'];
     var list = items.join('<br/>')
     return list
    ]]]

which computes

  • entity_id_state
  • entity_id_cpu
  • entity_id_percent
  • entity_id_uptime

But as said, I don’t know if this works for browser_mod.

Unfortunatly not.
Same result …Immagine 2022-03-15 144850