Hello everyone!
I’ve approached the topic several times, but I still can’t figure it out. I have two relays connected to the HA to control the fan:
- switch.4ch_switch_szafka_tv_l1
- switch.4ch_switch_szafka_tv_l2
The control works as it should, but I would like to create a fan using template fan. Below is what I have achieved so far, but it is not what I would like.
fan:
- platform: template
fans:
tv_fan:
friendly_name: TV Fan
entity_id: fan.tv
preset_mode_template: >
{% if is_state('switch.4ch_switch_szafka_tv_l1', 'off') and is_state('switch.4ch_switch_szafka_tv_l2', 'off') %}
off
{% elif is_state('switch.4ch_switch_szafka_tv_l1', 'on') and is_state('switch.4ch_switch_szafka_tv_l2', 'off') %}
low
{% elif is_state('switch.4ch_switch_szafka_tv_l1', 'off') and is_state('switch.4ch_switch_szafka_tv_l2', 'on') %}
high
{%else %}
off
{% endif %}
turn_on:
- service: switch.turn_on
entity_id: switch.4ch_switch_szafka_tv_l1
turn_off:
- service: switch.turn_off
entity_id: switch.4ch_switch_szafka_tv_l1
- service: switch.turn_off
entity_id: switch.4ch_switch_szafka_tv_l2
The fan created in this way shows only two states in HA: off and on (which is low gear). I am kindly asking for help.