Untitled
wookiee
yaml
a year ago
638 B
10
Indexable
sensors.yaml:
binary_sensor:
- platform: template
sensors:
button_color:
value_template: >-
{% if states['input_boolean.button1_boolean'].state == 'on' %}
on
{% else %}
off
{% endif %}
UI:
type: custom:button-card
name: Lights
icon: mdi:lamp
layout: icon_name
entity: my_button_1
data: {}
tap_action:
action: call-service
service: input_boolean.toggle
target:
entity_id: input_boolean.button1_boolean
card_mod:
style: >-
const state = states['binary_sensor.button_color'].state;
this.style.backgroundColor = state === 'on' ? 'red' : 'auto';
Editor is loading...
Leave a Comment