@kobainer wrote:
Have been trying some different solutions from the forum that i couldn’t get to work and have now tried to do my own solution but got a bit stuck.
I want to turn on a fan. The fan must turn off after the time that i set on a slider.
My first post so i hope the code formatting i correct
Edited: Edited the code input, removed spaces between lines and used ``` befor and after code.
input_number: toiletfan_input: name: toiletfan_input min: 0 max: 120 step: 30 step: 1 timer: fan_timer: duration: '00:01:00' script: start_fantimer: sequence: - service: timer.start data_template: entity_id: fan_timer duration: "00:{{ states('input_number.toiletfan_input') }}:00" automation: - alias: 'Toilet fan control' trigger: - platform: state entity_id: fan.toilet_fan from: 'off' to: 'on' condition: condition: template value_template: "{{ timer.fan_timer < 1 }}" action: - service: fan.turn_off entity_id: fan.toilet_fan
Posts: 12
Participants: 5