thisIO
(Michael)
October 1, 2020, 8:50pm
21
tom_l:
Create an input boolean called display_state. Use it like this in your switch:
Copy to clipboard
ac_display:
friendly_name: "AC Display"
value_template: "{{ is_state('input_boolean.display_state', 'on') }}"
turn_on:
- service: script.ac_display
- service: input_boolean.turn_on
data:
entity_id: input_boolean.display_state
turn_off:
- service: script.ac_display
- service: input_boolean.turn_off
data:
entity_id: input_boolean.display_state
icon_template: >-
{%- if is_state('input_boolean.display_state', 'on') -%}
mdi:television-classic
{%- else -%}
mdi:television-classic-off
{%- endif -%}
I know this way! Thanks a lot!
I thought i can do without creating input_boolean.
If there is no other way to do it with yaml, i can make it eaiser with lovelace and “custom:button-card”
just like
state:
- value: 'off'
icon: mdi:television-classic-off
- value: 'on'
icon: mdi:television-classic
tom_l
October 1, 2020, 8:58pm
22
Yes a Lovelace button should work with the the optimistic state (no value template).
thisIO
(Michael)
October 1, 2020, 9:10pm
23
I have chacked, it work!
But in all cases thanks for help!
1 Like