Custom Lovelace Card - Homekit style card

Here is what i get

image

              - entity: sensor.tvatt_status
                name: Tvättmaskin
                timestampFormat: '[in ] h [hour(s) and ] mm [minutes]'
                timestampDiff: true
                state: sensor.washing_machine_washer_completion_time
              - entity: sensor.tvatt_status
                name: Tvättmaskin
                timestampFormat: '[in ] h [hour(s) and ] mm [minutes]'
                timestampDiff: false
                state: sensor.washing_machine_washer_completion_time

Dont matter if its in entity or status.

image

Hi all,
First let me tell you i’m fairly new and having problems with the styling of the tiles.
I’m trying to get a tile filling picture or custom card but keep getting the border around it.
Can someone kick me in the right direction?

type: 'custom:homekit-card'
useBrightness: false
useTemperature: false
enableColumns: false
entities:
  - title: Overig
    entities:
      - card: picture-entity
        wider: true
        widerSize: 3
        cardOptions:
          entity: light.desk_light
          image: /local/images/sprinklers.jpg

Screen Capture_select-area_20210118014530

*** EDIT ***
I’ve found the solution myself which was earlier in this thread.
There is an option called: noPadding: true
That fixed it…
Is there a list with options as i couldn’t find this option anywhere in the documentation.

1 Like

Hi @Jimmy_Berglund,

In your yaml u are using sensor.tvatt_status
and the screenshot is sensor.washing_machine…

You sure sensor.tvatt_status are has device_class timestamp?

Hi @xfinitybanchang,

Yes there is a list on the github page: https://github.com/DBuit/Homekit-panel-card#2-configure-rows-and-tiles a bit below chapter 2 configure rows and tiles there is a table with options.

Yes. i’ve been over that one many times, but 'noPadding" isn’t in that list…
That’s why i asked if there is a complete list.

Is there a simple way to put an image in the background covering the entire tile?
I’m doing it now with an entity or picture card, but then i lose the formatting of the “homekit” style…

I’m also having an issue with the slider.
I’ve enabled it, but i can’t see it in the tile. It is there because when i hover the mouse over the tile, at a certain location it changes from pointer to slider and i can drag it. But the tile doesn’t show the actual slider, it’s all white.
I’ve tried standard width as well as 2 and 3 wide…

My fingers hurt from typing and my head hurts from thinking…
I’ve never done CSS, HTML or any form from programming other than some scripting on my ubuntu machine. I entered the world of Home Assistant a good week ago now and am discovering new things every day. I’m in love with the Homekit Style card, so major kudos to DBuit for writing and supporting it!
I’m nearly done with a card i am ‘fairly’ satisfied with. I’d like you to have a look at it, copy it if you want to, but what i’d really like is your opinion on the code. Am i doing things WAY too complicated, should i do it a different way, or any other form of criticism is well appreciated.

Last bit of help: On the bottom of the rotating sliders card i have the bottom border visible from the entities card inside the homekit tile. Any idea how to remove that?
I’d also like to put an image on the right side of the top tile which is 3 tiles wide. Ideally i’d like the picture to only cover the right side for 33%. So inserting a picture has the tile looking normal only the third bit of the 3 tile wide card should have the picture…

Anyway, here’s the code and screenshots.

P.S. I don’t know how to make animated caps, but if you click on Divider, TV or Sofa the content of the bottom tile changes with help of custom: state-switch.
Cards used:
Homekit Card
Slider Entity Row
State switch

type: 'custom:homekit-card'
useBrightness: false
useTemperature: false
enableColumns: true
statePositionTop: true
rows:
  - row: 1
    columns:
      - column: 1
        tileOnRow: 3
        entities:
          - title: Livingroom
            entities:
              - entity: light.livingroom_lights
                name: Livingroom Lights
                wider: true
                widerSize: 3
                slider: true
              - entity: light.divider_lights
                name: Divider
                tap_action:
                  action: navigate
                  navigation_path: '#p1'
              - entity: light.tv_lights
                name: TV
                tap_action:
                  action: navigate
                  navigation_path: '#p2'
              - entity: light.sofa_lights
                name: Sofa
                tap_action:
                  action: navigate
                  navigation_path: '#p3'
              - card: entities
                wider: true
                widerSize: 3
                noPadding: true
                higher: true
                cardOptions:
                  type: 'custom:state-switch'
                  entity: hash
                  default: p1
                  transition: flip
                  style: |
                    ha-card {
                      margin-bottom: -30px;
                    }
                  states:
                    p1:
                      type: entities
                      entities:
                        - type: 'custom:slider-entity-row'
                          entity: light.divider_top
                          name: Top
                          color: black
                          toggle: true
                        - type: 'custom:slider-entity-row'
                          entity: light.divider_middle
                          name: Middle
                          toggle: true
                        - type: 'custom:slider-entity-row'
                          entity: light.divider_bottom
                          name: Bottom
                          toggle: true
                        - type: divider
                        - type: 'custom:slider-entity-row'
                          entity: light.divider_lights
                          toggle: true
                    p2:
                      type: entities
                      entities:
                        - type: 'custom:slider-entity-row'
                          entity: light.tv_left
                          name: Left
                          toggle: true
                        - type: 'custom:slider-entity-row'
                          entity: light.tv_right
                          name: Right
                          toggle: true
                        - type: 'custom:slider-entity-row'
                          entity: light.striplight_tv
                          name: Striplight
                          toggle: true
                        - type: divider
                        - type: 'custom:slider-entity-row'
                          entity: light.tv_lights
                          name: Group
                          toggle: true
                    p3:
                      type: entities
                      entities:
                        - type: 'custom:slider-entity-row'
                          entity: light.sofa_left
                          name: Left
                          toggle: true
                        - type: 'custom:slider-entity-row'
                          entity: light.sofa_right
                          name: Right
                          toggle: true
                        - type: divider
                        - type: 'custom:slider-entity-row'
                          entity: light.sofa_lights
                          name: Group
                          toggle: true

1 Like

Yes im using the one that comes from the washer.

As in the example:

The first one was just to give a washing status. But ill remove that from the 2 second. And it still the same. And they have the class. Thats whats in the last picture.

              - entity: sensor.tvatt_status
                name: Tvättmaskin
                timestampFormat: '[in ] h [hour(s) and ] mm [minutes]'
                timestampDiff: true
                state: sensor.washing_machine_washer_completion_time
              - entity: sensor.washing_machine_washer_completion_time
                name: Tvättmaskin
                timestampFormat: '[in ] h [hour(s) and ] mm [minutes]'
                timestampDiff: false
                state: sensor.washing_machine_washer_completion_time

sensor.washing_machine_washer_completion_time = This sensor comes from the washer. and has the class

friendly_name: Tid
device_class: timestamp

Ah i see now what you were thinking.

              - entity: sensor.tvatt_status
                name: Tvättmaskin
                state: sensor.washing_machine_washer_completion_time
                timestampFormat: '[in ] h [hour(s) and ] mm [minutes]'
                timestampDiff: true
              - entity: sensor.washing_machine_washer_completion_time
                name: Tvättmaskin
                state: sensor.washing_machine_washer_completion_time
                timestampFormat: '[in ] h [hour(s) and ] mm [minutes]'
                timestampDiff: false

Yes it works when your using it in the normal entity. But can you make it work in the state entity?6

@DBuit i want to put the mini media player card into the homekit style card
this works with this code:

EDIT: i looked up my code and found the error

now i use this code

cards:
  - type: "custom:homekit-card"
    title: "Home"
    useBrightness: false
    useTemperature: false
    titleColor: "#FFF"
    enableColumns: true
    statePositionTop: true
    rows:
      - row: 1
        columns:
          - column: 1
            tileOnRow: 4
            entities:
              - title: Wohnzimmer                          
                entities:                          
                  - card: "custom:mini-media-player"
                    cardStyle: |
                      @media (max-width: 1900px) {
                        ha-card {
                          height: 100%;
                          width: 100%;
                          background: none !important;
                          box-shadow: none !important;
                          position: absolute;
                          image
                          }
                      ha-card{
                      overflow: hidden !important;
                      }
                      :host #primaryProgress{
                      background: #474A52 !important;
                      #display: flex !important;
                      height: 100%;                          
                        }}                           
                      @media (min-width: 1920px) {                        
                        ha-card {
                          height: 167%;
                          background: none !important;
                          box-shadow: none !important;
                          position: absolute;
                          width: initial!important;
                          font-size: 0.5vw !important;
                          image
                        }
                      ha-card{
                      overflow: hidden !important;
                      }
                      :host #primaryProgress{
                      background: #474A52 !important;
                      display: flex !important;
                      height: 100%;
                      }}                 
                    wider: true
                    widerSize: 3
                    noPadding: true
                    border-radius: 0
                    double_tap_action:
                      action: popup
                      entity: media_player.wohnzimmer_sonos
                    cardOptions:
                        artwork: material
                        entity: media_player.wohnzimmer_sonos
                        hide:
                          power: true
                          progress: false
                          runtime: true
                          icon: true
                          name: false
                          source: false
                          volume: true
                          controls: false    

it looks good on pc and iphone and ipad
but only on my iphone i get white borders around this, anyway to fix this?

I wonder if anyone can point out if I’m doing something obviously wrong here or if it’s just a browser issue:

I have this view set to panel mode and I can see this here, with the card icons sticking to the top left.

Yet on the tablet I’m trying to set up as a dashboard, I see the following with the card resolutely in the centre:

My code, if that makes any difference:

enableColumns: true
home: false
tileHoldAnimation: false
icon: 'mdi:home-outline'
rows:
  - columns:
      - column: 2
        entities:
          - entities:
              - entity: light.office_2
                name: Office Light
                useBrightness: true
                slider: true
                wider: true
              - entity: light.bedroom_2
                icon: 'mdi:lamp'
                name: Light
                offStates:
                  - 'off'
                  - unavailable
              - entity: switch.storm_trooper
                name: Wake on LAN
              - entity: sensor.downstairs_motion_temperature
                name: Temperature
                icon: 'mdi:thermometer'
            popup:
              actionsInARow: 2
              brightnessHeight: 350px
              brightnessWidth: 130px
              switchHeight: 300px
              switchWidth: 110px
              type: 'custom:light-popup-card'
            title: Office
        tileOnRow: 10
    row: 2
style: |
  :host {
    --tile-background: rgba(10, 10, 10, 0.22);
    --tile-border-radius: 12px;
    --tile-width: 100px;
    --tile-height: 100px;
    --tile-on-background: var(--card-background-color);

    --tile-name-text-color: rgba(183, 183, 183, 0.59);
    --tile-on-name-text-color: var(--primary-text-color);

    --tile-state-text-color: rgba(183, 183, 183, 0.59);
    --tile-on-state-text-color: var(--paper-item-icon-active-color);

    --tile-state-changed-text-color: var(--primary-text-color);
    --tile-unavailable-state-text-color: rgba(255, 0, 0, 1);

    --tile-value-text-color: var(--primary-text-color);


    --tile-icon-color: rgba(183, 183, 183, 0.59);
    --tile-on-icon-color: var(--paper-item-icon-active-color);

    --tile-icon-size: 30px;
    --tile-padding-top: 0
    --tile-image-radius: 0;
    
    --slider-width: 120px;
    --slider-height: 120px;
    } 
    .icon.image {
          position: absolute;
          width: 100%;
           height: 100%;
          left: 0;
           top: 0;
          z-index: -1;
       }
       .icon.image img {
          height: 100%;
       }
  }
title: Home
titleColor: '#FFF'
type: 'custom:homekit-card'
useBrightness: true
useTemperature: false

Could it be Fixed to work on state? @DBuit

You need to enable panel mode on the tab.

Quite, though as I mentioned, I already have it set to panel.

Using it inside a layout card and setting that to be left aligned has allowed me to get the homekit card on the left, but I had no luck getting it to fill in from the top left as happens on desktop or on my iPad. This being the case, I suspect it’s just something odd about Fully Kiosk Browser (perhaps specifically that I’m running it portrait, not landscape.)

The unwillingness of it to show more than three cards in a row is still confusing me, but I’ve made do with a 3x4 grid.

Sorry i misses that ut had it enabled.

Yeh its cause your browser it kiosk app tells Home Assistant that your a mobile app. I downloaded a app to my iPad that could support desktop mode and it worked. Or its something in your css.
For the hell of it i tried your code in my own home on one tab and it works as it is.
So i would buess its your browser that needs to tell homeassistant the korrekt info. (Desktop mode or Mobile)

Had some free time and was in the mood for another fight with home assistant and the numerous cards…
very short question:

I have a tile that is 3 wide, and would like to use the space on the right…
Can, and if so, how to do? I’d like 3-4 “activate scene” buttons there…
I would also like a picture to fill the entire tile… Is that another possibility?

So I’m trying to make the tiles smaller, but this code just gives me an error.

YAMLException: duplicated mapping key at line 336, column -104: style: ^

How can I make the tiles smaller so that I can fit more tiles in a row?


    cards:
      - type: picture-elements
        image: /local/blurredFloorplan.png
        style: |
          ha-card {
            background: rgba(42, 46, 48, 1)      
          }
        elements:
          - enableColumns: true
            style: |
              :host {  
                --tile-width-mobile: 50px;
                --tile-height-mobile: 50px;
                --tile-width: 50px;
                --tile-height: 50px;
              }

Just wanted to say thanks, this thread has helped my implement a minimalistic tablet to use for ring camera/ha control center

1 Like

How did you manage to get that many tiles on one row?

In this part you tell it how many rows and columns you want, also you specify how many tiles you want on each row with the tileOnRow option

  - row: 1
    columns:
      - column: 1
        tileOnRow: 3
        entities:

Oh an the tablet is a 1024x600 dragon touch, one of the cheapest ones

Ok has somebody found a way to group sonos speakers together, the mini media player

This is my code:

 - card: 'custom:mini-media-player'
                entity: media_player.living_room
                hide: |
                  [[[ 
                    var state = states['media_player.living_room_2'].state ;
                    return (state == 'idle') ||  (state == 'paused'); 
                  ]]]
                noPadding: true
                tap_action:
                  action: call-service
                  service: media_player.media_play_pause
                  service_data:
                    entity_id: media_player.living_room
                double_tap_action:
                  action: call-service
                  service: media_player.media_next_track
                  service_data:
                    entity_id: media_player.living_room
                cardStyle: |
                  ha-card {
                    height: 100%;
                    border-radius: 0;
                    background: none  !important;
                    box-shadow: none !important;
                    position: relative;
                    font-size: 0.5vw !important;
                    border-radius: 12px!important;
                    image
                  }
                  .button.no-padding {
                    padding: 0px !important;
                    margin: 3px 2px !important;
                    border-radius: var(--tile-border-radius, 12px);
                  }
                  ha-card{
                  overflow: hidden !important;
                  }
                  :host #primaryProgress{
                  background: #474A52 !important; 
                  display: flex !important;
                  border-radius: 12px!important;
                  height: 100%;
                  }                    
                cardOptions:
                  entity: media_player.living_room
                  artwork: full-cover
                  hide:
                    power: true
                    progress: false
                    runtime: true
                    icon: true
                    name: true
                    source: true
                    volume: true
                    controls: true
                speaker_group:
                  platform: sonos
                  show_group_count: true
                  sync_volume: true
                  expanded: true
                  entities:
                    - entity_id: media_player.Living_Room
                      name: Sonos Play
                    - entity_id: media_player.Living_Room_2
                      name: Sonos SL
                name: Sonos Play
                icon: 'mdi:speaker-wireless'
                offIcon: 'mdi:speaker'
                offStates:
                  - 'off'
                  - unavailable
                  - paused
                  - idle

What works:
-Hide and show (use another button to play pause)
-Art covering the tile (looks like a square in IOS, its good on android
-Play pause
-Tap actions

What doesn’t work (please help if you have gotten this to work)
-None of the speaker group options
-Controls on tile (they show, they are not formatted( that’s understandable), but don’t work.

Only things I really, and many other sonos users would be glad to get working:
-Volume sync
-Select speakers to play together (when one goes out, its imposible to join from HA)