Advertisement
asyscom

Untitled

Jan 29th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 4.66 KB | None | 0 0
  1. ######################
  2. # Climate - central heater
  3. ######################
  4. climate:
  5.   - platform: generic_thermostat
  6.     name: Heater
  7.     heater: switch.heater
  8.     target_sensor: sensor.sn1_temperature
  9.     min_temp: 20
  10.     max_temp: 29
  11.     target_temp: 21
  12.     tolerance: 0.3
  13.  
  14. ######################
  15. # Automation part
  16. ######################
  17. automation:
  18. - alias: 'Time heater on'
  19.   hide_entity: true
  20.   trigger:
  21.     - platform: template
  22.       value_template: '{{ states.sensor.time.state == states.sensor.alarm_time_heater.state }}'
  23.   condition:
  24.     condition: or
  25.     conditions:
  26.       - condition: and
  27.         conditions:
  28.           - condition: state
  29.             entity_id: input_boolean.alarmweekday_heater
  30.             state: 'on'
  31.           - condition: state
  32.             entity_id: binary_sensor.working_day
  33.             state: 'on'
  34.       - condition: state
  35.         entity_id: input_boolean.alarmweekday_heater
  36.         state: 'off'
  37.   action:
  38.     - service: climate.set_operation_mode
  39.       data:
  40.         entity_id: climate.heater
  41.         operation_mode: "auto"
  42.     - service: climate.set_temperature
  43.       data_template:
  44.         entity_id: climate.heater
  45.         temperature: '{{ states.input_number.set_temp_heater.state }}'
  46.  
  47. - alias: 'Turn heater ON boolean switch'
  48.   hide_entity: true
  49.   trigger:
  50.     - platform: state
  51.       entity_id: climate.heater
  52.       to: 'heat'
  53.   action:
  54.     - service: homeassistant.turn_on
  55.       entity_id: input_boolean.automode_heater
  56.  
  57. - alias: 'Turn time heater OFF'
  58.   hide_entity: true
  59.   trigger:
  60.     - platform: state
  61.       entity_id: input_boolean.timeonoff_heater
  62.       to: 'off'
  63.   action:
  64.     - service: automation.turn_off
  65.       entity_id: automation.time_sheduler_heater
  66.  
  67. - alias: 'Timer scheduler ON'
  68.   hide_entity: true
  69.   trigger:
  70.     - platform: state
  71.       entity_id: input_boolean.timeonoff_heater
  72.       to: 'on'
  73.   action:
  74.     - service: automation.turn_on
  75.       entity_id: automation.time_sheduler_heater
  76.  
  77. - alias: 'thermostat_heater Temp'
  78.   hide_entity: true
  79.   trigger:
  80.     - platform: state
  81.       entity_id: input_number.set_temp_heater
  82.   action:
  83.     - service: climate.set_temperature
  84.       data_template:
  85.         entity_id: climate.heater
  86.         temperature: '{{ states.input_number.set_temp_heater.state }}'
  87.  
  88. - alias: "thermostat_heater On"
  89.   hide_entity: true
  90.   trigger:
  91.     platform: state
  92.     entity_id: input_boolean.automode_heater
  93.     from: 'off'
  94.     to: 'on'
  95.   action:
  96.     - service: climate.set_operation_mode
  97.       data:
  98.         entity_id: climate.heater
  99.         operation_mode: "auto"
  100.     - service: climate.set_temperature
  101.       data_template:
  102.         entity_id: climate.heater
  103.         temperature: '{{ states.input_number.set_temp_heater.state }}'
  104.  
  105. - alias: "thermostat_heater Off"
  106.   hide_entity: true
  107.   trigger:
  108.     platform: state
  109.     entity_id: input_boolean.automode_heater
  110.     from: 'on'
  111.     to: 'off'
  112.   action:
  113.     - service: climate.set_operation_mode
  114.       data:
  115.         entity_id: climate.heater
  116.         operation_mode: "off"
  117.  
  118. # thermostat INITIALIZATION
  119. - alias: 'HASS startup'
  120.   initial_state: true
  121.   hide_entity: true
  122.   trigger:
  123.     - platform: homeassistant
  124.       event: start
  125.   action:
  126.     - service: climate.set_operation_mode
  127.       data:
  128.         entity_id: climate.heater
  129.         operation_mode: "off"
  130.     - service: climate.set_operation_mode
  131.       data:
  132.         entity_id: climate.heater
  133.         operation_mode: "off"
  134.     - service: homeassistant.turn_on
  135.       entity_id: input_boolean.timeonoff_heater
  136.     - delay: '00:00:02'
  137.     - service: homeassistant.turn_off
  138.       entity_id: input_boolean.timeonoff_heater
  139.     - service: homeassistant.turn_on
  140.       entity_id: input_boolean.timeonoff_heater
  141.     - delay: '00:00:02'
  142.     - service: homeassistant.turn_off
  143.       entity_id: input_boolean.timeonoff_heater
  144.  
  145. sensor:
  146.  - platform: template
  147.    sensors:
  148.      alarm_time_heater:
  149.        friendly_name: 'Time'
  150.        value_template: '{{ "%0.02d:%0.02d" | format(states("input_number.alarmhour_heater") | int, states("input_number.alarmminutes_heater") | int) }}'
  151.  
  152. input_boolean:
  153.   alarmweekday_heater:
  154.     name: Worday only
  155.     icon: mdi:calendar
  156.   automode_heater:
  157.     name: 'Set AUTO / OFF'
  158.     initial: off
  159.   timeonoff_heater:
  160.     name: 'Scheduled heater'
  161.     initial: off
  162.  
  163. input_number:
  164.   alarmhour_heater:
  165.     name: Hour
  166.     icon: mdi:timer
  167.     min: 0
  168.     max: 23
  169.     step: 1
  170.   alarmminutes_heater:
  171.     name: Minutes
  172.     icon: mdi:timer
  173.     min: 0
  174.     max: 59
  175.     step: 1
  176.   set_temp_heater:
  177.     mode: slider
  178.     name: Set temperature
  179.     initial: 21
  180.     min: 15
  181.     max: 30
  182.     step: 0.5
  183.     unit_of_measurement: "°C"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement