Hi All,
I’m in the middle of setting up a template fan to add the direction functionality to an MQTT fan.
Its mostly going ok
Where i’m currently stuck is on the template for set direction.
I have set up a sensor from my MQTT fan for what the true direction is so I get feed back. I also have scripts for both forwards and backwards direction setting.
The only examples ive found where people have implemented direction is broadlink toggles.
I know if should be simple but I just dont know how to get started if I have both forward and reverse scripts.
Here is my code so far:
fan:
- platform: template
fans:
guest_template_fan:
friendly_name: "Template fan"
value_template: "{{ states('fan.bedroom_fan') }}"
percentage_template: "{{ state_attr('fan.bedroom_fan', 'percentage') }}"
turn_on:
service: fan.turn_on
data_template:
entity_id: fan.bedroom_fan
turn_off:
service: fan.turn_off
data_template:
entity_id: fan.bedroom_fan
set_percentage:
service: fan.set_percentage
data:
percentage: "{{ percentage }}"
target:
entity_id: fan.bedroom_fan
direction_template: "{{ 'forward' if is_state('sensor.guest_room_fan_direction', 'forward') else 'reverse' }}"
set_direction:
service: script.fan_direction
data:
direction: "{{ direction }}"
speed_count: 6
my direction scripts are called script.bedroom_fan_forward & script.bedroom_fan_reverse which are just TuyaSend commands I may just build into the fan itself.
Any help on either of these issues would be very helpful
Thank you
Linton