Add fan.switch like light platform: switch

Add the ability for on/off switches to be setup on the fan domain like light switch. Guessing there aren’t many single speed fans, I’m using this for bathroom exhaust fans.

When trying to add
fan:

  • platform: switch
    name: “Hall Bathroom Fan”
    entity_id: switch.hall_bathroom_fan

I get the following error

Platform error fan.switch - No module named ‘homeassistant.components.switch.fan’

Does this not do what you want?

(Not a snarky question if it sounds that way… just wondering if there is a feature or capability that doesn’t work with this that I’m not thinking of)

That would definitely work

1 Like

Try:

fan:
  - platform: template
    fans:
      hall_bathroom_fan:
        friendly_name: "Hall Bathroom fan"
        value_template: "{{ states('switch.hall_bathroom_fan') }}"
        turn_on:
          service: switch.turn_on
          entity_id: switch.hall_bathroom_fan
        turn_off:
          service: switch.turn_off
          entity_id: switch.hall_bathroom_fan

Works perfect, thanks

No worries :+1: