Files
N22/include/scripts/varme_styring.yaml
T

141 lines
5.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
##################################################
# Varme: Central genberegning af alle Roth-rum
# Kaldes af automations/varme_styring.yaml ved:
# - Morgen (06:30), Nat (22:00)
# - Tilstedeværelse ændret
# - Ferietilstand ændret
# - HA genstart
# Logik pr. rum:
# - Vindue åbent → skip (håndteres af vinduer.yaml)
# - Ferie → varme_ferie_temp (frostbeskyttelse)
# - Nat (2206:30) → komfort - varme_nat_saenkning
# - Ingen hjemme → komfort - varme_vaek_saenkning
# - Ellers → rum-komforttemperatur
##################################################
varme_recalculate:
alias: "Varme: Genberegn alle rum"
mode: restart
sequence:
- variables:
vacation: "{{ is_state('input_boolean.vacation_mode', 'on') }}"
night: "{{ now().hour >= 22 or now().hour < 7 }}"
home: "{{ is_state('binary_sensor.family_presence', 'on') }}"
nat_sænk: "{{ states('input_number.varme_nat_saenkning') | float(3) }}"
vaek_sænk: "{{ states('input_number.varme_vaek_saenkning') | float(3) }}"
ferie_temp: "{{ states('input_number.varme_ferie_temp') | float(15) }}"
# ---- Andreas (vindue: binary_sensor.andreas_vindue) ----
- if:
- condition: template
value_template: "{{ not is_state('binary_sensor.andreas_vindue', 'on') }}"
then:
- service: climate.set_temperature
target:
entity_id: climate.andreas
data:
hvac_mode: heat
temperature: >
{% set k = states('input_number.varme_komfort_andreas') | float(20) %}
{% if vacation %} {{ ferie_temp }}
{% elif night %} {{ [k - nat_sænk, 15] | max }}
{% elif not home %} {{ [k - vaek_sænk, 15] | max }}
{% else %} {{ k }}
{% endif %}
# ---- Daniel (vindue: binary_sensor.daniel_vindue) ----
- if:
- condition: template
value_template: "{{ not is_state('binary_sensor.daniel_vindue', 'on') }}"
then:
- service: climate.set_temperature
target:
entity_id: climate.daniel
data:
hvac_mode: heat
temperature: >
{% set k = states('input_number.varme_komfort_daniel') | float(20) %}
{% if vacation %} {{ ferie_temp }}
{% elif night %} {{ [k - nat_sænk, 15] | max }}
{% elif not home %} {{ [k - vaek_sænk, 15] | max }}
{% else %} {{ k }}
{% endif %}
# ---- Soveværelse (vindue: binary_sensor.sovevaerelse_vindue) ----
- if:
- condition: template
value_template: "{{ not is_state('binary_sensor.sovevaerelse_vindue', 'on') }}"
then:
- service: climate.set_temperature
target:
entity_id: climate.sovev_prelse
data:
hvac_mode: heat
temperature: >
{% set k = states('input_number.varme_komfort_sovevaerelse') | float(18) %}
{% if vacation %} {{ ferie_temp }}
{% elif night %} {{ [k - nat_sænk, 15] | max }}
{% elif not home %} {{ [k - vaek_sænk, 15] | max }}
{% else %} {{ k }}
{% endif %}
# ---- Kontor (ingen vinduesensor) ----
- service: climate.set_temperature
target:
entity_id: climate.kontor
data:
hvac_mode: heat
temperature: >
{% set k = states('input_number.varme_komfort_kontor') | float(21) %}
{% if vacation %} {{ ferie_temp }}
{% elif night %} {{ [k - nat_sænk, 15] | max }}
{% elif not home %} {{ [k - vaek_sænk, 15] | max }}
{% else %} {{ k }}
{% endif %}
# ---- Gang / Fordelingsgang (ingen vinduesensor) ----
- service: climate.set_temperature
target:
entity_id: climate.fordelingsgang
data:
hvac_mode: heat
temperature: >
{% set k = states('input_number.varme_komfort_gang') | float(18) %}
{% if vacation %} {{ ferie_temp }}
{% elif night %} {{ [k - nat_sænk, 15] | max }}
{% elif not home %} {{ [k - vaek_sænk, 15] | max }}
{% else %} {{ k }}
{% endif %}
# ---- Forgang (ingen vinduesensor) ----
- service: climate.set_temperature
target:
entity_id: climate.forgang
data:
hvac_mode: heat
temperature: >
{% set k = states('input_number.varme_komfort_forgang') | float(17) %}
{% if vacation %} {{ ferie_temp }}
{% elif night %} {{ [k - nat_sænk, 15] | max }}
{% elif not home %} {{ [k - vaek_sænk, 15] | max }}
{% else %} {{ k }}
{% endif %}
# ---- Lille bad (vindue: binary_sensor.lille_bad_vindue) ----
- if:
- condition: template
value_template: "{{ not is_state('binary_sensor.lille_bad_vindue', 'on') }}"
then:
- service: climate.set_temperature
target:
entity_id: climate.lille_bad
data:
hvac_mode: heat
temperature: >
{% set k = states('input_number.varme_komfort_lille_bad') | float(22) %}
{% if vacation %} {{ ferie_temp }}
{% elif night %} {{ [k - nat_sænk, 15] | max }}
{% elif not home %} {{ [k - vaek_sænk, 15] | max }}
{% else %} {{ k }}
{% endif %}