Skip to content

arsaboo/config-template-card

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Config Template Card Card

๐Ÿ“ Templatable Configuration Card

GitHub Release License

Project Maintenance GitHub Activity

Discord Community Forum

Support

Hey dude! Help me out for a couple of ๐Ÿป or a โ˜•!

coffee

This card is for Lovelace on Home Assistant that allows you to use pretty much any valid Javascript on the hass object in your configuration

Options

Name Type Requirement Description
type string Required custom:config-template-card
config object Required Card object

Installation

Step 1

Save config-template-card to <config directory>/www/config-template-card.js on your Home Assistant instanse.

Example:

wget https://raw.githubusercontent.com/custom-cards/config-template-card/master/dist/config-template-card.js
mv config-template-card.js /config/www/

Step 2

Link config-template-card inside your ui-lovelace.yaml or Raw Editor in the UI Editor

resources:
  - url: /local/config-template-card.js
    type: module

Step 3

Add a custom element in your ui-lovelace.yaml or in the UI Editor as a Manual Card

Available variables for tempalting

this.hass - The hass object

states - The states object

user - The user object

type: 'custom:config-template-card'
config:
  type: >-
    ${states['light.bed_light'].state === 'on' ? 'custom:hui-glance-card' :
    'custom:hui-entities-card' }
  entities:
    - entity: alarm_control_panel.ha_alarm
      name: >-
        ${states['cover.garage_door'].state === 'open' &&
        states['alarm_control_panel.ha_alarm'].state === 'armed_home' ? 'Close
        the garage!' : '' }
    - entity: binary_sensor.basement_floor_wet
    - entity: climate.ecobee
      name: >-
        ${states['climate.ecobee'].attributes.current_temperature > 22 ? 'Cozy'
        : 'Too Hot/Cold'}
    - entity: cover.garage_door
    - entity: >-
        ${ states['light.bed_light'].state === 'on' ? 'light.bed_light' :
        'climate.ecobee' }
      icon: '${states[''cover.garage_door''].state === ''open'' ? ''mdi:hotel'' : '''' }'

Note: All templates must be enclosed by ${} and card type must custom even for core. e.g. custom:hui-shopping-list-card

Troubleshooting

About

๐Ÿ“ Templatable Configuration Card

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 96.5%
  • JavaScript 3.5%