JLindvig

Timer

Nov 23rd, 2020
935
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. timer_christian:
  2.   timer:
  3.     sluk_blaesevejr:
  4.       name: Sluk Blæsevejr
  5.  
  6.   input_boolean:
  7.     start_blaesevejr:
  8.       name: Start blæsevejr
  9.  
  10.   input_number:
  11.     blaesevejr_i:
  12.       name: Blæsevejr i X antal sekunder
  13.       initial: 300
  14.       min: 1
  15.       max: 900
  16.       step: 1
  17.  
  18.   automation:
  19.     - alias: "Ventilator - timer"
  20.       initial_state: true
  21.       mode: single
  22.       trigger:
  23.         - platform: state
  24.           entity_id:
  25.            - input_boolean.start_blaesevejr
  26.           to: "on"
  27.       action:
  28.         - service: switch.turn_on
  29.           data:
  30.             entity_id: switch.sonoff_laura_switch
  31.  
  32.         - service: timer.start
  33.           data:
  34.             entity_id: timer.sluk_blaesevejr
  35.             duration: "{{ states('input_number.blaesevejr_i') | multiply(60) | int }}"
  36.  
  37.     - alias: "Sluk ventilator"
  38.       initial_state: true
  39.       mode: single
  40.       trigger:
  41.         platform: event
  42.         event_type: timer.finished
  43.         event_data:
  44.           entity_id: timer.sluk_blaesevejr
  45.       action:
  46.         - service: switch.turn_off
  47.           data:
  48.             entity_id: switch.sonoff_laura_switch
  49.  
  50.         - service: input_boolean.turn_off
  51.           data:
  52.             entity_id: input_boolean.start_blaesevejr
RAW Paste Data