noam76

MY Timer ON-OFF

Feb 14th, 2019
682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.93 KB | None | 0 0
  1. 2. add an INPUT_BOOLEAN
  2. # my timer test
  3.  timer_on_off:
  4.   initial: off
  5.  
  6. 3. add 2 variables to the INPUT_DATETIME
  7. # variable for my timer test
  8.  light_start:
  9.   name: Set ON time & date
  10.   initial: 00:00
  11.   has_date: true
  12.   has_time: true
  13.  light_end:
  14.   name: Set OFF time & date
  15.   initial: 00:00
  16.   has_date: true
  17.   has_time: true
  18. sensor.time_date
  19. 4. Configure 2 automations to check between the set point to the current hours & date
  20.    automations.yaml
  21. #####################
  22. # my timer test on #                                                  
  23. #####################
  24. - id: Test_Timer_on_off_Start
  25.   alias: "Timer Start"
  26.   initial_state: 'on'
  27.   trigger:
  28.     platform: template
  29.     value_template: "{{ states('sensor.time_date') == (states.input_datetime.light_start.attributes.timestamp | int | timestamp_custom('%H:%M, %y-%m-%d', False)) }}"
  30.   condition:
  31.     condition: state
  32.     entity_id: input_boolean.timer_on_off
  33.     state: 'on'
  34.   action:
  35.     - service: switch.turn_on
  36.       entity_id: switch.neo_coolcam_wall_switch_1_channel_switch
  37. #####################
  38. # my timer test off #
  39. #####################
  40. - id: Test_Timer_on_off_Stop
  41.   alias: "Timer Stop"
  42.   initial_state: 'on'
  43.   trigger:
  44.     platform: template
  45.     value_template: "{{ states('sensor.time_date') == (states.input_datetime.light_end.attributes.timestamp | int | timestamp_custom('%H:%M, %y-%m-%d', False)) }}"
  46.   condition:
  47.     condition: state
  48.     entity_id: input_boolean.timer_on_off
  49.     state: 'on'
  50.   action:
  51.     - service: switch.turn_off
  52.       entity_id: switch.neo_coolcam_wall_switch_1_channel_switch
  53.     - delay: 0:00:03
  54.     - service: input_boolean.turn_off
  55.       entity_id: input_boolean.timer_on_off
  56.  
  57. 5. restart HA
  58.  
  59. 6. configure the ui-lovelace.yaml
  60.      type: entities
  61.      title: Timer Test
  62.      show_header_toggle: false
  63.      entities:
  64.      - input_boolean.timer_on_off
  65.       - input_datetime.light_start
  66.       - input_datetime.light_end
Advertisement
Add Comment
Please, Sign In to add comment