Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 99113

Automation with if condition

$
0
0

@Leon_van_Geul wrote:

I need help. I want that my fan is controlled with a switch and a slider. When the slider is higher then 0 the fan should turn of after …minutes(the slider goes from 0 to 10). But when the slider is on 0 I want the fan to turn on “forever”.

automation:
  - alias: vent_timer
    trigger:
    - platform: state
      entity_id: switch.ventilator_ventilator
      to: 'on'
      for:
        minutes: "{{ states('input_number.vent_time')|int }}"
    action:
      - entity_id: switch.ventilator_ventilator
        service_template: <
            {%- if input_number.vent_time > 0 -%}
                service: switch.turn_off
            {% endif %} 

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 99113

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>