Icon State Chip
Description¶
This chip
displays an icon and a label, where the label can be any state
of a sensor
you configure.
Variables¶
Variable | Default | Required | Notes |
---|---|---|---|
ulm_chip_icon_state_icon | This is the icon to show. See See icons to read more about the used unicode emojis . |
||
ulm_chip_icon_state_entity | Enable background |
Usage¶
- type: 'custom:button-card'
template: chip_icon_state
variables:
ulm_chip_icon_state_icon: '🛏️'
ulm_chip_icon_state_entity: sensor.bed_occupancy
Template Code
chip_icon_state.yaml
---
### Chip Icon State ###
chip_icon_state:
template: "chips"
triggers_update:
- "[[[ return variables.ulm_chip_icon_state_entity ]]]"
label: |
[[[
var icon = "❔";
if (variables.ulm_chip_icon_state_icon){
var icon = variables.ulm_chip_icon_state_icon;
}
var state = "";
if (states[variables.ulm_chip_icon_state_entity].state){
var state = helpers.localize(states[variables.ulm_chip_icon_state_entity]);
}
return icon + " " + state;
]]]