Lovelace: Button card

sorry,but dont understand it,if you could show me with a example…:no_mouth: :expressionless:

I am terribly sorry if this question might have already been asked. Anyways, is it possible to template the spin option? I can’t seem to get it to work. What I’d like to do is something like this:

  - spin: "[[[ if (states['sensor.vacuum_cleaner_status_sensor'].state == Charging) return 'false'; else return 'true' ]]]"

though you should probably quote ‘Charging’ , I don’t think we can. Have been struggling with that also, so if this could be added, a +1 for that!
thanks for asking

Can someone give me an example about how to create a button which changes his entity_picture when the ‘home’, ‘not_home’ state changes?

If u read some post before ,ull find some example

entity_picture: >
          [[[
          if (entity.state !== 'Not set') return '/local/badges/alarm.png';
          return '/local/badges/alarm_off.png';
          ]]]

Change state to ‘not_home’

I tried with custom_field too but same result,please could u show me a example how u do,this the last card I must change to template from anchor and I not able to do, I see that sometimes I need to restart to aplicate changes
Million thanks again

Thanks a lot… and if i want to change also the name of the card?
Actually i have this:

              - type: custom:button-card
                show_entity_picture: true
                entity: device_tracker.life360_xxxxxxxxx
                entity_picture: >
                  [[[
                    if (entity.state !== 'home') return '/local/lovelace/images/Maurizio_away.jpg';
                    return '/local/lovelace/images/Maurizio.jpg';
                  ]]]
                name: Maurizio
                aspect_ratio: 1/1
                color: auto
                size: 90%

The name of the card?? I don’t understand that, maybe name of entity?

No, i mean how to change the ‘name: Maurizio’ when the state changes from home to not_home.

Try same in name: >

1 Like

Great ! Yes, it works… Thanks again.

This is the current state of my Lovelace dashboard with button cards.

4 Likes

Really cool. Havent gotten around building a Proper desktop/tablet view yet. I mainly focus on smartphone interfaces. But this is real inspiring. Thanks for showing us!

Thank you @jimz011! I use the tablet mainly at home. My phone theme is similar but not ready yet. :slight_smile: In the past I used the Appdaemon but the button card gives more possibilities and flexibilities plus I can use the native Lovelace benefits, for example popup windows.

How you get popup windows with button-card? Or maybe i misunderstood what you mean?
Where you get all those icons? Only mdi icons?

You can use the deprecated popup cards or the browser mod for popup windows with the button card. For example:



I use bha icons for some lights, it can be found on Github.

You can find an older setup here:

Thanks, can you give me a little example code using popup card with button card ?

I made a sample, you have to use the browser mod:

border-radius: 15px
color: null
color_off: null
color_type: icon
entity: group.all_lights
layout: name_state
show_icon: true
show_name: false
show_state: true
size: 50%
styles:
  card:
    - font-size: 16px
    - width: 132px
    - height: 132px
    - border: 'solid 1.5px rgba(125,125,125)'
    - background: 'rgba(0,0,0,.7)'
    - transform: scale(1)
tap_action:
  action: call-service
  service: browser_mod.command
  service_data:
    card:
      type: entities
      entities:
        - light.kitchen
        - light.living_room
        - light.bedroom
    command: popup
    deviceID:
      - this
    title: lights       
type: 'custom:button-card'

This part belongs to popup:

tap_action:
  action: call-service
  service: browser_mod.command
  service_data:
    card:
      type: entities
      entities:
        - light.kitchen
        - light.living_room
        - light.bedroom
    command: popup
    deviceID:
      - this
    title: lights      

Ok, but what you mean with browser mod? Sorry for my poor knowledge about this…