All Projects → PiotrMachowski → Home-Assistant-Lovelace-HTML-Jinja2-Template-card

PiotrMachowski / Home-Assistant-Lovelace-HTML-Jinja2-Template-card

Licence: MIT License
This card displays provided Jinja2 template as an HTML content of a card. It uses exactly the same engine as Home Assistant in Developer tools.

Projects that are alternatives of or similar to Home-Assistant-Lovelace-HTML-Jinja2-Template-card

button-text-card
Custom, "neumorphism" Lovelace card
Stars: ✭ 95 (+251.85%)
Mutual labels:  home-assistant, lovelace-card
compass-card
A Lovelace card that shows a directional indicator on a compass for Home Assistant
Stars: ✭ 64 (+137.04%)
Mutual labels:  home-assistant, lovelace-card
ioBroker.lovelace
Visualization with Lovelace-UI
Stars: ✭ 41 (+51.85%)
Mutual labels:  home-assistant, lovelace-card
numberbox-card
Replace input_number sliders with plus and minus buttons
Stars: ✭ 61 (+125.93%)
Mutual labels:  home-assistant, lovelace-card
Home-Assistant-Lovelace-Local-Conditional-card
This card can show and hide a specific card on current device while not affecting other windows. It does not require any integration to run.
Stars: ✭ 30 (+11.11%)
Mutual labels:  home-assistant, lovelace-card
homeassistant-kostalplenticore
Home Assistant Component for Kostal Plenticore
Stars: ✭ 15 (-44.44%)
Mutual labels:  home-assistant
ha-watermeter
Data provider for smartmeter watermeter.
Stars: ✭ 20 (-25.93%)
Mutual labels:  home-assistant
home
Monorepo for all home automation related development, including integrated firmware, PCBs, configuration, and bridges
Stars: ✭ 104 (+285.19%)
Mutual labels:  home-assistant
reactant
Generate code for "models, views, and urls" based on Python type annotations. Supports Django REST, SQLAlchemy, Peewee.
Stars: ✭ 14 (-48.15%)
Mutual labels:  jinja2
home-assistant-custom-components-linkplay
LinkPlay based media devices integration for Home Assistant. Fully compatible with Mini Media Player card including speaker group management. Supports snapshot and restore functionality for TTS.
Stars: ✭ 62 (+129.63%)
Mutual labels:  home-assistant
citymind water meter
Home Assistant Integration with cp.city-mind.com, an Israeli water meters reading service
Stars: ✭ 15 (-44.44%)
Mutual labels:  home-assistant
home assistant appdaemon alexa google
An AppDaemon application for Home Assistant, handles calls from Alexa Skill and a Google Action
Stars: ✭ 11 (-59.26%)
Mutual labels:  home-assistant
ioBroker.hass
Connects Home Assistant to ioBroker
Stars: ✭ 14 (-48.15%)
Mutual labels:  home-assistant
logya
Logya is a static site generator written in Python designed to be easy to use and flexible.
Stars: ✭ 16 (-40.74%)
Mutual labels:  jinja2
home-assistant-sun-card
Home assistant sun card based on Google weather design
Stars: ✭ 279 (+933.33%)
Mutual labels:  home-assistant
Home-Assistant-Main
My Home Assistant Configuration Be sure to ⭐ my repo so you can keep up to date on the daily progress!
Stars: ✭ 54 (+100%)
Mutual labels:  home-assistant
hass-shutter-card
Shutter card for Home Assistant Lovelace UI
Stars: ✭ 151 (+459.26%)
Mutual labels:  home-assistant
surepy
🐾 Library & CLI to monitor and control the Pet Door & Cat Flap Connect 🚪 the Pet Feeder Connect 🍽 and the Felaqua 💦 sold by Sure Petcare
Stars: ✭ 45 (+66.67%)
Mutual labels:  home-assistant
hassio-addons
Some home assistant addons I manage
Stars: ✭ 16 (-40.74%)
Mutual labels:  home-assistant
home-assistant-ansible
🎭 Ansible playbooks/role for the setup of Home Assistant.
Stars: ✭ 48 (+77.78%)
Mutual labels:  home-assistant

Lovelace HTML Jinja2 Template card

hacs_badge Community Forum buymeacoffee_badge paypalme_badge

This card displays provided Jinja2 template as an HTML content of a card. It uses exactly the same engine as Home Assistant in Developer tools.

Configuration options

Key Type Required Default Description
title string false - Title of a card
content string true - Content of a card
ignore_line_breaks boolean false false Disables changing line breaks to </br> tags
do_not_parse boolean false false Disables template parsing
always_update boolean false false Enables refreshing the card with every change of entity
picture_elements_mode boolean false false Enables picture-elements mode
entities list false [] List of additional entities whose updates should trigger refresh of the card

Templates

  • Entity state, example: {{ states('sun.sun') }}
  • Entity attribute, example: {{ state_attr('sun.sun', 'elevation') }]
  • Detailed documentation: Templating

Example usage

Example

views:
- name: Example
  cards:
    - type: custom:html-template-card
      title: 'HTML Template card'
      ignore_line_breaks: true
      content: |
        Sun state: <b>{{ states('sun.sun') }}</b>, elevation: {{ state_attr('sun.sun','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: {{ states('input_number.system_volume') }}%</br>
        <center><img src="https://vignette.wikia.nocookie.net/starwars/images/f/fa/Modal_Nodes_02.jpg" width="{{ states('input_number.system_volume') }}%"/></center>

Manual Installation

  1. Download html-template-card.js to /www/custom_lovelace/html_template_card directory:
    mkdir -p www/custom_lovelace/html_template_card
    cd www/custom_lovelace/html_template_card/
    wget https://github.com/PiotrMachowski/Home-Assistant-Lovelace-HTML-Jinja2-Template-card/raw/master/dist/html-template-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_template_card/html-template-card.js
        type: js

Hints

  • To use mdi icon follow example: <ha-icon icon="mdi:weather-sunny"></ha-icon>.
  • If content does not contain any template use flag do_not_parse: true to increase performance.
  • If content does not contain entity id (e.g. because of loop) you have to provide it manually in entities to enable refresh of the card when it will be updated.
  • If you want to enable refreshing for every change in HA use flag always_update: true. WARNING: this may cause heavy load of browser/HA. Best to use with flag do_not_parse: true.
  • To check if your content is correct without changing configuration use Developer tools.
  • To use this card as an element of picture-elements card use picture_elements_mode parameter.

Buy Me A Coffee

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].