Set initial fan speed

Hi asked this over on reddit but didnt get much help so copy pasting here

I’m trying to set a starting speed for a fan so when its turned on it defaults to something like 20%. At the moment it just goes back to whatever was last set in home assistant.

I’ve tried a heap of things but am completely lost.

Heres the relevant part of the config, this isn’t the only thing Ive tried just the latest

Any help is appreciated

output:
  - platform: ledc
    pin: GPIO21
    id: fan_pwm                                                                                                                                                                          
    frequency: 4882Hz
    inverted: true                                                                                                                                                                   

fan:
  - platform: speed
    output: fan_pwm
    name: Fan
    speed_count: 100
    id: fan 
    on_turn_on:
    - output.set_level:
        id: fan_pwm
        level: 20%
    - fan.turn_on: fan
    - logger.log: "Fan Turned On!"

Did you try doing it like this? On mobile, my indentation might be off.

on_turn_on:
  - fan.turn_on:
        id: fan
        speed: 20

Yep have tried that, as well as different floats 0.2 20.0 etc

1 Like

Are you able to set the fan speed outside of the on_turn_on: trigger? And same but when the fan is already on?

For example using a button press with one of the actions above ? or in a script?

I tried your first response again and it worked thanks heaps. I must have messed something up before

1 Like