Hi all,
Need to change a light to a fan. All available information I can find is super outdated. Seems alot of people want this answer, searched other posts and some answers assume everyone makes a career coding…I don’t…just a hobby. Here is what I have, on/off works but the speed slider no work.
fan:
- platform: template
fans:
dining_room_fan:
friendly_name: "XXX Fan"
value_template: "{{ states('light.basement_fireplace_fan') }}"
speed_template: >
{% set output = ['Low','Medium','High'] %}
{% set idx = state_attr('light.basement_fireplace_fan', 'brightness') | int // 85 - 1 %}
{{ output[idx] }}
turn_on:
service: homeassistant.turn_on
entity_id: light.basement_fireplace_fan
turn_off:
service: homeassistant.turn_off
entity_id: light.basement_fireplace_fan
set_speed:
service: light.turn_on
entity_id: light.basement_fireplace_fan
data_template:
brightness: >
{% set mapper = {'Low': 29, 'Medium': 60, 'High': 99} %}
{{ mapper[speed] }}
speeds:
- 'Low'
- 'Medium'
- 'High'