Skip to content

PiotrMachowski/lovelace-html-card

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
August 15, 2022 04:27
August 20, 2019 01:21
October 9, 2019 17:02
January 29, 2021 12:44
July 5, 2019 21:35
August 30, 2019 01:51

Lovelace HTML card

hacs_badge buymeacoffee_badge paypalme_badge

This card displays provided data as an HTML content of a card.

Configuration options

Key Type Required Default Description
title string False - Title of a card
content string True - Content of a card

Templates

  • Entity state, example: [[ sun.sun ]], [[ sun.sun.state ]]
  • Entity attribute, example: [[ sun.sun.attrubutes.elevation ]]

Example usage

Example

views:
- name: Example
  cards:
    - type: custom:html-card
      title: 'HTML card'
      content: |
        Sun state: <b>[[sun.sun]]</b>, elevation: [[sun.sun.attributes.elevation]]</br>
        <b>Hello</b> there!<p>General <u>Kenobi!</u></p>
        <img src="https://i.redd.it/ltxppihy4cyy.jpg" width="70%"/></br>
        <ha-icon icon="mdi:speaker"></ha-icon> Volume: [[input_number.system_volume]]%</br>
        <center><img src="https://vignette.wikia.nocookie.net/starwars/images/f/fa/Modal_Nodes_02.jpg" width="[[input_number.system_volume]]%"/></center>

Installation

  1. Download html-card.js to /www/custom_lovelace/html_card directory:
    mkdir -p www/custom_lovelace/html_card
    cd www/custom_lovelace/html_card/
    wget https://github.com/PiotrMachowski/lovelace-html-card/raw/master/dist/html-card.js
  2. Add card to resources in ui-lovelace.yaml or in raw editor if you are using frontend UI editor:
    resources:
      - url: /local/custom_lovelace/html_card/html-card.js
        type: js

Hints

  • To use mdi icon follow example: <ha-icon icon="mdi:weather-sunny"></ha-icon>
  • If you need more powerful templates check out HTML Template card
  • The only improvement over markdown-mod that html-card provides is ability to use css styles.
  • This card is available in HACS

Buy Me A Coffee

About

This card displays provided data as an HTML content of a card.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published