Advertisement
Guest User

Hot water

a guest
Jul 23rd, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 4.24 KB | None | 0 0
  1. switch:
  2.   - platform: knx
  3.     name: Hot water
  4.     address: 7/4/21
  5.     state_address: 8/4/21
  6.  
  7. input_datetime:
  8.   weekdays_am_hot_water_on:
  9.     name: Turn on
  10.     has_date: false
  11.     has_time: true
  12.  
  13.   weekdays_am_hot_water_off:
  14.     name: Turn off
  15.     has_date: false
  16.     has_time: true
  17.  
  18.   weekdays_pm_hot_water_on:
  19.     name: Turn on
  20.     has_date: false
  21.     has_time: true
  22.  
  23.   weekdays_pm_hot_water_off:
  24.     name: Turn off
  25.     has_date: false
  26.     has_time: true
  27.  
  28.   weekends_am_hot_water_on:
  29.     name: Turn on
  30.     has_date: false
  31.     has_time: true
  32.  
  33.   weekends_am_hot_water_off:
  34.     name: Turn off
  35.     has_date: false
  36.     has_time: true
  37.  
  38.   weekends_pm_hot_water_on:
  39.     name: Turn on
  40.     has_date: false
  41.     has_time: true
  42.  
  43.   weekends_pm_hot_water_off:
  44.     name: Turn off
  45.     has_date: false
  46.     has_time: true
  47.  
  48. input_boolean:
  49.   hot_water_schedule:
  50.     name: Enable schedule
  51.     icon: mdi:calendar-clock
  52.  
  53. automation:
  54.   - alias: Weekdays hot water on
  55.     initial_state: 'on'
  56.     hide_entity: true
  57.     trigger:
  58.       - platform: template
  59.         value_template: "{{ states('sensor.time') == state_attr('input_datetime.weekdays_am_hot_water_on', 'timestamp') | int | timestamp_custom('%H:%M', false) }}"
  60.       - platform: template
  61.         value_template: "{{ states('sensor.time') == state_attr('input_datetime.weekdays_pm_hot_water_on', 'timestamp') | int | timestamp_custom('%H:%M', false) }}"
  62.     condition:
  63.       condition: and
  64.       conditions:
  65.         - condition: time
  66.           weekday:
  67.          - mon
  68.           - tue
  69.           - wed
  70.           - thu
  71.           - fri
  72.         - condition: state
  73.           entity_id: input_boolean.hot_water_schedule
  74.           state: 'on'      
  75.     action:
  76.       - service: switch.turn_on
  77.         entity_id: switch.hot_water
  78.  
  79.   - alias: Weekdays hot water off
  80.     initial_state: 'on'
  81.     hide_entity: true
  82.     trigger:    
  83.       - platform: template
  84.         value_template: "{{ states('sensor.time') == state_attr('input_datetime.weekdays_am_hot_water_off', 'timestamp') | int | timestamp_custom('%H:%M', false) }}"
  85.       - platform: template
  86.         value_template: "{{ states('sensor.time') == state_attr('input_datetime.weekdays_pm_hot_water_off', 'timestamp') | int | timestamp_custom('%H:%M', false) }}"
  87.     condition:
  88.       condition: and
  89.       conditions:
  90.         - condition: time
  91.           weekday:
  92.          - mon
  93.           - tue
  94.           - wed
  95.           - thu
  96.           - fri
  97.         - condition: state
  98.           entity_id: input_boolean.hot_water_schedule
  99.           state: 'on'
  100.     action:
  101.       - service: switch.turn_off
  102.         entity_id: switch.hot_water
  103.  
  104.   - alias: Weekends hot water on
  105.     initial_state: 'on'
  106.     hide_entity: true
  107.     trigger:
  108.       - platform: template
  109.         value_template: "{{ states('sensor.time') == state_attr('input_datetime.weekends_am_hot_water_on', 'timestamp') | int | timestamp_custom('%H:%M', false) }}"
  110.       - platform: template
  111.         value_template: "{{ states('sensor.time') == state_attr('input_datetime.weekends_pm_hot_water_on', 'timestamp') | int | timestamp_custom('%H:%M', false) }}"
  112.     condition:
  113.       condition: and
  114.       conditions:
  115.         - condition: time
  116.           weekday:
  117.          - sat
  118.           - sun
  119.         - condition: state
  120.           entity_id: input_boolean.hot_water_schedule
  121.           state: 'on'      
  122.     action:
  123.       - service: switch.turn_on
  124.         entity_id: switch.hot_water  
  125.  
  126.   - alias: Weekends hot water off
  127.     initial_state: 'on'
  128.     hide_entity: true
  129.     trigger:    
  130.       - platform: template
  131.         value_template: "{{ states('sensor.time') == state_attr('input_datetime.weekends_am_hot_water_off', 'timestamp') | int | timestamp_custom('%H:%M', false) }}"
  132.       - platform: template
  133.         value_template: "{{ states('sensor.time') == state_attr('input_datetime.weekends_pm_hot_water_off', 'timestamp') | int | timestamp_custom('%H:%M', false) }}"
  134.     condition:
  135.       condition: and
  136.       conditions:
  137.         - condition: time
  138.           weekday:
  139.          - sat
  140.           - sun
  141.         - condition: state
  142.           entity_id: input_boolean.hot_water_schedule
  143.           state: 'on'
  144.     action:
  145.       - service: switch.turn_off
  146.         entity_id: switch.hot_water
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement