JonasPed

Untitled

Aug 1st, 2021
1,225
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. blueprint:
  2.   name: Timer
  3.   description: Timer to turn on/off at a given time
  4.   domain: automation
  5.   input:
  6.     device:
  7.       name: Entity to turn on/off.
  8.       description: Entity that timer turns on/off at a given time.
  9.       selector:
  10.         entity:
  11.     turn_on:
  12.         name: Turn on
  13.         description: Time to turn on.
  14.         selector:
  15.               time:
  16.     turn_off:
  17.          name: Turn off
  18.          description: Time to turn off.
  19.          selector:
  20.            time:
  21.     vacation_active:
  22.       name: Active during vacation.
  23.       description: Toggle to indicate if automation is active during vacation mode.
  24.       default: false
  25.       selector:
  26.         boolean:
  27. variables:
  28.   vacation_active: !input vacation_active
  29.  
  30. trigger:
  31.   - platform: time
  32.     at: !input turn_on
  33.     id: turn_on
  34.   - platform: time
  35.     at: !input turn_off
  36.     id: turn_off
  37.  
  38. condition:
  39.   - condition: or
  40.     conditions:
  41.         - condition: state
  42.           entity_id: input_boolean.disable_automations
  43.           state: 'off'
  44.         - condition: template
  45.           value_template: '{{ vacation_active == true }}'
  46.  
  47. action:
  48.   - choose:
  49.       - conditions:
  50.           - condition: template
  51.             value_template: '{{ trigger.id == "turn_on" }}'
  52.         sequence:
  53.           - service: homeassistant.turn_on
  54.             target:
  55.                 entity_id: !input device
  56.       - conditions:
  57.           - condition: template
  58.             value_template: '{{ trigger.id == "turn_off" }}'
  59.         sequence:
  60.           - service: homeassistant.turn_off
  61.             target:
  62.                 entity_id: !input device
  63.     default: []
  64. mode: single
  65.  
RAW Paste Data