MCPcopy Index your code
hub / github.com/DBuit/Homekit-panel-card

github.com/DBuit/Homekit-panel-card @0.6.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.6.3 ↗ · + Follow
36 symbols 84 edges 3 files 1 documented · 3% updated 15mo ago0.6.3 · 2022-09-11★ 31727 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

hacs_badge

homekit-card

Homekit style Home Assistant card

This card is best used with panel: true so the card fills up the whole page. The purpose of this card is to fill a page with tiles in homekit style. You can add entities and define multiple rows with your own title to create your homekit style page.

It is possible that an entity is not standard and is not shown as you expected. An example of this is weather entity, for this I have therefore added a separate tile to the card so that it is displayed in the correct way. If you have an entity that is not displayed properly, create an issue.

You can also adjust the pop-up that opens when you hold down a tile. You can have the pop-up open another lovelace card so that you can show other info in the popup, you can also just use the standard. For lights I have developed a separate card that also has the style of homekit, which you can use well in combination with this card. You can find this card here: https://github.com/DBuit/hass-custom-light-popup-card

Do you have ideas for a custom pop-up create an issue then I can see if I can help with this :)

Buy Me A Coffee

Configuration

Installation instructions

HACS installation: Go to the hacs store and use the repo url https://github.com/DBuit/Homekit-panel-card and add this as a custom repository under settings.

Add the following to your ui-lovelace.yaml:

resources:
  url: /hacsfiles/Homekit-panel-card/homekit-panel-card.js
  type: module

Manual installation: Copy the .js file from the dist directory to your www directory and add the following to your ui-lovelace.yaml file:

resources:
  url: /local/homekit-panel-card.js
  type: module

Wanna use the popup functionality?

The popups use browser mod to display any lovelace card in a popup. To use the popups install browser mod: https://github.com/thomasloven/hass-browser_mod And also install card-mod so the custom styles can be applied to the popups: https://github.com/thomasloven/lovelace-card-mod

Configure the card in your lovelace-ui.yaml

I will break up the configuration of the card to a few levels. 1. First some global stuff you can configure 2. The rows with tiles that can be configured 3. A specific tile/entity that can be configured

1. Global configuration

First use the custom card and set the panel: true so that it fills up the whole screen.

views:
  - title: "Home"
    icon: mdi:home-outline
    path: "home"
    panel: true
    cards:
      - type: "custom:homekit-card"

in the card we can define some global configuration below you can find these options:

Name Type Required Default Description
home boolean optional false When true this creates extra space above your tiles where you can show a title and display rules
title string optional "" When home is true you can give your page a title
rules string optional 400px When home is true you can define rules in template to display stats like how many lights are on or I use it to set a message that I need to put the trash out.
rulesColor string optional "#FFF" Default the text is white and this can be overwritten with a new color
tileHoldAnimation boolean optional false When true the tile with grow in size when holding :)
title string optional "" When home is true you can give your page a title
useRGB boolean optional true When true the lights rgb value is used to color the icon
useBrightness boolean optional true When true the lights brightness is used to color the icon
useTemperature boolean optional false When true the temperature is used to color the icon
titleColor number optional Titles above a row of tiles is colored by them this can overwrite this color
horizontalScroll boolean optional false Default when a tile doesn't fit on the screen it goes to a next row, when you enable this it won't break to a next row but it will be scrollable
enableColumns boolean optional false When enabled you can make rows with a title and tiles but also define columns within these rows
masonry boolean optional false When enabled it will order the tiles by size and makes sure there are no blank space on a row. This is usefull when using wider and higher options on a tile so everything fits nicely, check out the website of the plugin builder to get an idea of what it does: https://masonry.desandro.com/
statePositionTop boolean optional false Default the brightness (for lights) and last_changed (for sensors) is shown in the title next to the current state (on/off) when this is true this state if chown next to the icon in a circle (inspired by: https://community-home-assistant-assets.s3.dualstack.us-west-2.amazonaws.com/optimized/3X/d/c/dcf67fccb5fa3772b2db6d38aeef307d01ba3bc8_2_1380x862.jpeg)
style string optional css Use the style option to add extra CSS default there is a list of variables to easily overwrite colors, sizes of the tiles see the list of variables under the table
haptic string none success, warning, failure, light, medium, heavy, selection Haptic feedback for the iOS Companion App
doubleTapFallback string optional tap double tap default fallback to a tap action, you can also change this to hold so it will fallback to hold action which default opens the more info popup
doubleTapDisabledWhenNoActionSet boolean optional true This works togheter with the doubleTapFallback so when this is set to false there is a little delay on tap actions to determine if it could be a double tap, by setting this to true double tap is not used so it will just be 2 single tap actions without any delay

Css variables and default values

Example config:

- type: "custom:homekit-card"
  style: |
    :host {
      --tile-background: rgba(255, 255, 255, 0.8);
      --tile-border-radius: 12px;
      --tile-width: 100px;
      --tile-height: 100px;
      --tile-on-background: rgba(255, 255, 255, 1);

      --tile-name-text-color: rgba(0, 0, 0, 0.4);
      --tile-on-name-text-color: rgba(0, 0, 0, 1);

      --tile-state-text-color: rgba(0, 0, 0, 0.4);
      --tile-on-state-text-color: rgba(0, 0, 0, 1);

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

      --tile-value-text-color: rgba(255, 0, 0, 1);


      --tile-icon-color: rgba(0, 0, 0, 0.3);
      --tile-on-icon-color: #f7d959;


      --tile-width-mobile: 90px;
      --tile-height-mobile: 90px;

      --min-header-height: 150px;

      --tile-icon-size: 30px;

      --tile-image-radius: 100%

      --slider-width: 120px;
      --slider-height: 120px;
    }

2. Configure Rows and Tiles

At this point our configuration looks like this for example:

views:
  - title: "Home"
    icon: mdi:home-outline
    path: "home"
    panel: true
    cards:
      - type: "custom:homekit-card"
        home: true
        rules: |
          {% if "Vandaag" in states('sensor.blink_gft') %} <li>Vandaag groenebak aan de straat</li> {% endif %}
          {% if "Vandaag" in states('sensor.blink_papier') %} <li>Vandaag oudpapier aan de straat</li> {% endif %}
          {% if "Vandaag" in states('sensor.blink_pmd') %} <li>Vandaag plastic aan de straat</li> {% endif %}
          {% if "Vandaag" in states('sensor.blink_restafval') %} <li>Vandaag grijzebak aan de straat</li> {% endif %}
          {% if states('sensor.current_lights_on') | float > 0 %} <li>{{states('sensor.current_lights_on')}} lampen aan</li> {% endif %}
          {% if states('sensor.current_media_players_on') | float > 0 %} <li>{{states('sensor.current_media_players_on')}} speakers aan</li> {% endif %}
        title: "Demo"
        useBrightness: false
        titleColor: "#FFF"
        enableColumns: true
        statePositionTop: true

Now we want to create rows and tiles to display our entities. In my example I enabled the enableColumns but I will first show the configuration if enableColumns: false.

We start with entities:, every item in the entities is a row with tiles, and every row can have it's own title. So below statePositionTop: true in our example we add the following:

        entities:
          - title: Row 1
            entities:

As you can see we started with entities inside the entities we defined 1 item with a title rows and an empty list of more entities. These entities are the tiles we want to display in the row. let's add these tiles! You can also get haptic feedback for iOS user, this can be enabled globally or on each row by adding haptic.

        entities:
          - title: Row 1
            haptic: success
            entities:
              - entity: light.zithoek
              - entity: binary_sensor.wasmachine_status
              - entity: media_player.keuken
          - title: Row 2
            entities: 

As you can see we can set a list with entities and each one will be one tile. and then we can start a new row by adding a new - title with entities.

In the above example we only set the entity: for a tile that is enough to let it work but we can do more to customize this.

Name Type Required Default Description
entity string required light.example The only required one is the entity
icon string optional "" (for alle types except climate this shows the temperature)
offIcon boolean optional 'mdi:icon' if you set an offIcon than this icon will be showed when the entity state is equal to an state in the offStates (default offStates: off or unavailable).
image string optional "/path/to/image.png" path to an image (for alle types except climate this shows the temperature)
offImage string optional "/path/to/image.png" if you set an offImage than this image will be showed when the entity state is equal to an state in the offStates (default offStates: off or unavailable).
name string optional You can overwrite the name shown on the tile
offStates array optional - "paused" Default the "off" and "unavailable" state will show the tile greyed out but you can set your own list of states that should be considered as off
state boolean optional false The tile show extra state info like brightness for lights and last_changed for sensors on the tile you can also set an entity here and the state of this entity is shown on that place
statePath boolean optional false In combination with state you can also display other values besided the entities state. for example you can set this to attributes.brightness to display the brightness of the entity you have set in state
hideState boolean optional false When you do not wan't the last updated or brightness for lights is displayed you can hide the state by setting this to true
timestampFormat string optional '[Klaar over] h [uur en ] mm [minuten]' When you have a sensor with the device_class timestamp you can use the timestampFormat to format the timestamp to a readable date and time. Use text in [] brackets to add text
timestampDiff boolean optional false When you use a sensor with device_class timestamp and this display a timestamp in the future with the purpose to display in how many days/hours etc. the event takes place set this to true so it will calculate the different from now till the timestamp
tap_action number optional See actions can be used to customize the action on tap/click (lights and switches have already a tap action)
hold_action boolean optional See actions Set a custom action for hold, default it opens the more-info pop-up
double_tap_action boolean optional See actions Set a custom action for double tap. If no double tap is defined this will default trigger the tap action
spin boolean optional false If true this will let the icon spin when the entity is on
wider boolean optional false If true the tile will be the size of 2 tiles
widerSize number optional 1,2,3,4,5 or 6 When wider is enable it makes the default tile width 2 tiles wide, with widerSize you can make make it up to 6 tiles wide
higher boolean optional false If true the tile will be the height of 2 tiles
higherSize number optional 1,2,3,4,5 or 6 When higher is enable it makes the default tile height 2 tiles high, with higherSize you

Core symbols most depended-on inside this repo

Shape

Method 34
Class 2

Languages

TypeScript100%

Modules by API surface

src/homekit-panel-card.ts36 symbols

For agents

$ claude mcp add Homekit-panel-card \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page