Custom Lovelace Card - Homekit style card

Yes. I’ve been using this sensor for various things for quite some time. It’s just easier to remember sensor.denon_source in an automation than having to remember the full template.

    sensors:
      denon_source:
        value_template: >
          {% if is_state("media_player.denon_avr_x1600h", 'on') %}
            {{ states.media_player.denon_avr_x1600h.attributes.source }}
          {% else %}
            PowerOff
          {% endif %}

Cool.
Just got everything working so that i shows whats aktive. Thx again for sharing the code.

I’ve sorted out the CSS part. Now I just need to figure out if it is possible to have a conditional satatement for the higherSize value. Would like it to be 2 for the mobile app and 4 for desktop.

            entities:
              - card: calendar
                noPadding: true
                wider: true
                widerSize: 3
                higher: true
                higherSize: 4
                cardOptions:
                  entities:
                    - calendar.family
                    - calendar.birthdays
                  card_mod:
                    style: |
                      ha-card {
                        --ha-card-background: #FFF;
                        --primary-text-color: black;

                      }
                      :host {
                        
                      }

@Jimmy_Berglund
I’ve edited my post above with updated code. It functions exactly the same, I just removed some fluff that was not needed.

has someone a idea why my popup dont work?
i installed the popup card and the popup card works with my other code

useTemperature: false
useBrightness: true
statePositionTop: true
slider: false
entities:
  - title: Row 1
    popup:
      type: custom:light-popup-card
      scenesInARow: 2
      brightnessWidth: 130px
      brightnessHeight: 350px
      switchWidth: 110px
      switchHeight: 300px
    entities:
      - entity: switch.shelly_tischbeleuchtung
        name: Küchen Tisch
        icon: mdi:power-plug
      - entity: light.led_stripe_kueche
        icon: mdi:led-strip-variant
        name: LED Streifen
      - entity: switch.sp220_weihnachtsbaum
        name: Baum
        icon: mdi:power-plug

Cool.

For me it changed abitt cause the icons and card became mutch smaller then the original from earlier.
But fixed that with adding switch hight etc.
But a question. Are you using a ios based phone or Android?

Im having a problem that i realy need to hold down the button a long time for it to pop upp correcly. And thats that only buttom i have this problem with. Im starting to wonder if its the button cards code thats the problem. Sins allso the problem stayed after i tried your latest code.

This is what im using as of now.

              - entity: sensor.harmony_activity
                hideState: true
                name: Media Vardagsrum
                icon: mdi:television-guide
                offIcon: mdi:power
                offStates:
                  - PowerOff
                popupExtend:
                  type: custom:switch-popup-card
                  icon: si:dolby
                  noActiveState: 'Off'
                  entity_value_path: state
                  switchHeight: 300px
                  switchWidth: 180px
                  entities:
                    - sensor.harmony_activity
                  buttons:
                    - icon: mdi:power
                      value: PowerOff
                      name: Power
                      service: script.turn_on
                      service_data:
                        entity_id: script.tvoff
                    - icon: mdi:apple
                      value: Apple tv
                      name: Apple TV
                      service: script.turn_on
                      service_data:
                        entity_id: script.apple_tv
                    - icon: si:playstation
                      value: Playstation
                      name: Playstation
                      service: script.turn_on
                      service_data:
                        entity_id: script.ps5
                    - icon: mdi:kodi
                      value: Htpc
                      name: Htpc
                      service: script.turn_on
                      service_data:
                        entity_id: script.htpc
                    - icon: mdi:television-guide
                      value: Tv
                      name: Tv
                      service: script.turn_on
                      service_data:
                        entity_id: script.tv
              - entity: sensor.harmony_sovrum_activity
                hideState: true
                name: Media Vardagsrum
                icon: mdi:television-guide
                offIcon: mdi:power
                offStates:
                  - PowerOff
                popupExtend:
                  type: custom:switch-popup-card
                  icon: si:dolby
                  noActiveState: 'Off'
                  entity_value_path: state
                  switchHeight: 300px
                  switchWidth: 180px
                  entities:
                    - sensor.harmony_sovrum_activity
                  buttons:
                    - icon: mdi:power
                      value: PowerOff
                      name: Power
                      service: script.turn_on
                      service_data:
                        entity_id: script.tvoff
                    - icon: mdi:apple
                      value: Apple TV Sovrum
                      name: Apple TV Sovrum
                      service: script.turn_on
                      service_data:
                        entity_id: script.sovrumappletv
                    - icon: si:playstation
                      value: Playstation
                      name: Playstation
                      service: script.turn_on
                      service_data:
                        entity_id: script.pssovrum
                    - icon: mdi:television-guide
                      value: Tv Sovrum
                      name: Tv Sovrum
                      service: script.turn_on
                      service_data:
                        entity_id: script.tvsov

Definitly an Andriod house. I don’t have any Apple products. Putting tileHoldAnimation: true at the beginning of my configuration seemed to make it much easier to long press anything, along with adding a nice little animation.

Yeh i use that to. Ok must be a iOS thing then. Or companion app. Or switch popup card.

Made some conditional buttons that display when Android TV is on. Pressing one opens the corresponding app.

              - card: custom:button-card
                noPadding: true
                hide: |-
                  [[[
                    var state = states['sensor.denon_source'].state;
                    return (state == 'PowerOff') | (state == 'Switch') | (state == 'Xbox One');
                  ]]]
                cardOptions:
                  icon: si:plex
                  color: '#e5a00d'
                  tap_action:
                    action: call-service
                    service: androidtv.adb_command
                    service_data:
                      entity_id: media_player.android_tv
                      command: >-
                        am start -a android.intent.action.VIEW -d -n
                        com.plexapp.android/com.plexapp.plex.activities.SplashActivity
                  show_state: true
                  name: Plex
                  styles:
                    card:
                      - width: 120px
                      - height: 120px
                      - font-size: 14px
                    name:
                      - justify-self: start
                      - padding-left: 10px
                      - padding-bottom: 25px
                    img_cell:
                      - justify-content: start
                      - padding-left: 25px
                    icon:
                      - justify-self: start
              - card: custom:button-card
                noPadding: true
                hide: |-
                  [[[
                    var state = states['sensor.denon_source'].state;
                    return (state == 'PowerOff') | (state == 'Switch') | (state == 'Xbox One');
                  ]]]
                cardOptions:
                  show_entity_picture: true
                  entity_picture: >-
                    https://cf-homeassistant.duckdns.org:8123/local/images/media_icons/disney+.png
                  tap_action:
                    action: call-service
                    service: androidtv.adb_command
                    service_data:
                      entity_id: media_player.android_tv
                      command: >-
                        am start -a android.intent.action.VIEW -d -n
                        com.disney.disneyplus/com.bamtechmedia.dominguez.main.MainActivity
                  show_state: true
                  name: Disney+
                  styles:
                    card:
                      - width: 120px
                      - height: 120px
                      - font-size: 14px
                    name:
                      - justify-self: start
                      - padding-left: 10px
                      - padding-bottom: 25px
                    img_cell:
                      - justify-content: start
                      - padding-left: 25px
                    icon:
                      - justify-self: start
              - card: custom:button-card
                noPadding: true
                hide: |-
                  [[[
                    var state = states['sensor.denon_source'].state;
                    return (state == 'PowerOff') | (state == 'Switch') | (state == 'Xbox One');
                  ]]]
                cardOptions:
                  icon: si:primevideo
                  color: '#00A8E1'
                  tap_action:
                    action: call-service
                    service: androidtv.adb_command
                    service_data:
                      entity_id: media_player.android_tv
                      command: >-
                        monkey -p com.amazon.amazonvideo.livingroom -c
                        android.intent.category.LEANBACK_LAUNCHER 1
                  show_state: true
                  name: Amazon Prime
                  styles:
                    card:
                      - width: 120px
                      - height: 120px
                      - font-size: 14px
                    name:
                      - justify-self: start
                      - padding-left: 10px
                      - padding-bottom: 25px
                    img_cell:
                      - justify-content: start
                      - padding-left: 25px
                    icon:
                      - justify-self: start
              - card: custom:button-card
                noPadding: true
                hide: |-
                  [[[
                    var state = states['sensor.denon_source'].state;
                    return (state == 'PowerOff') | (state == 'Switch') | (state == 'Xbox One');
                  ]]]
                cardOptions:
                  icon: si:hbo
                  color: '#FFF'
                  tap_action:
                    action: call-service
                    service: androidtv.adb_command
                    service_data:
                      entity_id: media_player.android_tv
                      command: >-
                        monkey -p com.hbo.hbonow -c
                        android.intent.category.LEANBACK_LAUNCHER 1
                  show_state: true
                  name: HBO Max
                  styles:
                    card:
                      - width: 120px
                      - height: 120px
                      - font-size: 14px
                    name:
                      - justify-self: start
                      - padding-left: 10px
                      - padding-bottom: 25px
                    img_cell:
                      - justify-content: start
                      - padding-left: 25px
                    icon:
                      - justify-self: start
              - card: custom:button-card
                noPadding: true
                hide: |-
                  [[[
                    var state = states['sensor.denon_source'].state;
                    return (state == 'PowerOff') | (state == 'Switch') | (state == 'Xbox One');
                  ]]]
                cardOptions:
                  icon: si:spotify
                  color: '#1DB954'
                  tap_action:
                    action: call-service
                    service: androidtv.adb_command
                    service_data:
                      entity_id: media_player.android_tv
                      command: >-
                        am start -a android.intent.action.VIEW -d -n
                        com.spotify.tv.android/.SpotifyTVActivity
                  show_state: true
                  name: Spotify
                  styles:
                    card:
                      - width: 120px
                      - height: 120px
                      - font-size: 14px
                    name:
                      - justify-self: start
                      - padding-left: 10px
                      - padding-bottom: 25px
                    img_cell:
                      - justify-content: start
                      - padding-left: 25px
                    icon:
                      - justify-self: start
1 Like

How did you do the text explanations next to your Scenes?

I don’t use this design anymore (it’s a more than 2 year old post). But I used a horizontal stack inside a vertical stack. So the icon (custom button card) and markdown card inside a horizontal stack (which makes them be side by side). Then multiple of these stacks inside a vertical stack.

Thanks. I figured it was a button next to a markdown card. I’m just trying to get the CSS part working for the transparent markdown card. I can set --ha-card-background: rgba(0,0,0,0.0); but the normal card tile beneath is visible. I can’t seem to set it to be transparent without effecting all the other --tile-on-background or --tile-background

@DBuit For some reason light entities are not respecting the --tile-on-icon-color: #13485f;. It doesn’t seem to matter if I set useBrightness: to true or false. Config for the pendant light is below (other lights are similar).

              - entity: light.living_room_pendants
                name: Pendant Lights
                icon: mdi:ceiling-light-multiple
                popup:
                  type: custom:light-popup-card
                  displayType: slider
                  scenesInARow: 2
                  brightnessWidth: 130px
                  brightnessHeight: 350px
                  switchWidth: 110px
                  switchHeight: 300px
                  icon: mdi:ceiling-light-multiple

I have a question about hold_action configuration. On iOS a long press triggers the associated action and haptic after a delay (500 ms. by default I think). This gives an intuitive visual and tactile feedback that you’ve held the button long enough and can release it. The lovelace deep_press module by roflcoopter has the same behavior. Is there a way to configure this on the Homekit style card? Whatever I try the action and haptic feedback always happen on button release. @DBuit If it’s not possible please consider this a feature request:-)

Is it possible to turn on home: true for only the companion app (mobile)? I’m using the sidebr card on desktop, and that info is repeated in the sidebar so I don’t need it. Any way to do this with a template?
sudocode:

home: | [[[
   if (mobile_app ==true) { 
       return true;
   } else {
       return false;
   }
]]]

Hi,
Did you find a solution?

Hi, how did you make only the active have a frame?

No purtroppo Grazie comunque

All of my popups are full screen. Any idea how to change that? If I set fullscreen: false it moves the card to the top left but the dimmed background is still full screen. With fullscreen: true the card is centred.

  - row: 2
    columns:
      - column: 1
        tileOnRow: 3
        entities:
          - title: Lounge and Study Lights
            entities:
              - entity: light.lounge_lamp
                icon: mdi:lamp
                slider: true
                double_tap_action:
                  action: more-info
                  entity: light.lounge_lamp
                popup:
                  type: custom:light-popup-card
                  switchWidth: 110px
                  switchHeight: 300px
                  icon: mdi:lamp
                  settings: false
                  sliderColoredByLight: false
                  actions:
                    - service: scene.turn_on
                      service_data:
                        entity_id: scene.lounge_lamp_dim
                      color: '#FDCA64'
                      name: DIM
                    - service: scene.turn_on
                      service_data:
                        entity_id: scene.lounge_lamp_bright
                      color: '#FDCA64'
                      name: BRIGHT
                    - service: script.turn_on
                      service_data:
                        entity_id: script.yee_reset
                      name: RESET

                style: |
                  ha-dialog {
                    --mdc-dialog-min-width: 250px !important;
                    --mdc-dialog-max-width: 700px !important;
                    --mdc-theme-surface: rgba(0,0,0,0.5);
                  }
                  .content {
                   width: auto !important;
                  }
1 Like