TekOnline

How to duty cycle HVAC zones with Home Assistant

Here is a handy script that can help with automating your zone duty cycle, for this you will need to set up a slider card, and have your zone controller working in home assistant. You can find the 4 zone controller here or the 8 zoner here.

alias: Zone Duty HVAC
description: >-
  Unified duty-cycle controller for all rooms, simple version with seconds, all
  zones run
variables:
  cycle_time: 240

  attic_duty_entity: &attic_duty input_number.attic_duty_cycle
  attic_switch_entity: &attic_switch switch.esp_hvac_zone_control_attic

  bedrooms_23_duty_entity: &bedrooms_23_duty input_number.bedrooms_2_and_3_duty_cycle
  bedrooms_23_switch_entity: &bedrooms_23_switch switch.esp_hvac_zone_control_bedroom_23

  master_bedroom_duty_entity: &master_bedroom_duty input_number.master_bedroom_duty_cycle
  master_bedroom_switch_entity: &master_bedroom_switch switch.esp_hvac_zone_control_bedroom

  lounge_duty_entity: &lounge_duty input_number.lounge_duty_cycle
  lounge_switch_entity: &lounge_switch switch.esp_hvac_zone_control_lounge
triggers:
  - trigger: state
    entity_id:
      - *attic_duty
      - *bedrooms_23_duty
      - *master_bedroom_duty
      - *lounge_duty
actions:
  - parallel:
      - repeat:
          while:
            - condition: template
              value_template: "{{ states(attic_duty_entity) | float(0) > 0 }}"
          sequence:
            - action: switch.turn_on
              target:
                entity_id: *attic_switch
              data: {}
            - delay:
                seconds: >-
                  {{ [cycle_time * (states(attic_duty_entity) | float(0) /
                  100), 1] | max }}
            - action: switch.turn_off
              target:
                entity_id: *attic_switch
              data: {}
            - delay:
                seconds: >-
                  {{ [cycle_time * (1 - (states(attic_duty_entity) | float(0) /
                  100)), 1] | max }}
      - repeat:
          while:
            - condition: template
              value_template: "{{ states(bedrooms_23_duty_entity) | float(0) > 0 }}"
          sequence:
            - action: switch.turn_on
              target:
                entity_id: *bedrooms_23_switch
              data: {}
            - delay:
                seconds: >-
                  {{ [cycle_time * (states(bedrooms_23_duty_entity) | float(0)
                  / 100), 1] | max }}
            - action: switch.turn_off
              target:
                entity_id: *bedrooms_23_switch
              data: {}
            - delay:
                seconds: >-
                  {{ [cycle_time * (1 - (states(bedrooms_23_duty_entity) |
                  float(0) / 100)), 1] | max }}
      - repeat:
          while:
            - condition: template
              value_template: "{{ states(master_bedroom_duty_entity) | float(0) > 0 }}"
          sequence:
            - action: switch.turn_on
              target:
                entity_id: *master_bedroom_switch
              data: {}
            - delay:
                seconds: >-
                  {{ [cycle_time * (states(master_bedroom_duty_entity) |
                  float(0) / 100), 1] | max }}
            - action: switch.turn_off
              target:
                entity_id: *master_bedroom_switch
              data: {}
            - delay:
                seconds: >-
                  {{ [cycle_time * (1 - (states(master_bedroom_duty_entity) |
                  float(0) / 100)), 1] | max }}
      - repeat:
          while:
            - condition: template
              value_template: "{{ states(lounge_duty_entity) | float(0) > 0 }}"
          sequence:
            - action: switch.turn_on
              target:
                entity_id: *lounge_switch
              data: {}
            - delay:
                seconds: >-
                  {{ [cycle_time * (states(lounge_duty_entity) | float(0) /
                  100), 1] | max }}
            - action: switch.turn_off
              target:
                entity_id: *lounge_switch
              data: {}
            - delay:
                seconds: >-
                  {{ [cycle_time * (1 - (states(lounge_duty_entity) | float(0)
                  / 100)), 1] | max }}
mode: restart

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *