Compare commits
2 Commits
b76d01d8c6
...
9a442a5ee9
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a442a5ee9 | |||
| a1173d3a4f |
+513
-499
File diff suppressed because it is too large
Load Diff
@@ -7,21 +7,23 @@ blueprint:
|
|||||||
temp_threshold:
|
temp_threshold:
|
||||||
name: Temperature Threshold to switch AC on
|
name: Temperature Threshold to switch AC on
|
||||||
description: This threshold is the temperature above which AC must be switched on
|
description: This threshold is the temperature above which AC must be switched on
|
||||||
default: 29
|
default: 29.0
|
||||||
selector:
|
selector:
|
||||||
number:
|
number:
|
||||||
min: 25
|
min: 25.0
|
||||||
max: 40
|
max: 40.0
|
||||||
|
step: 0.5
|
||||||
unit_of_measurement: celsius
|
unit_of_measurement: celsius
|
||||||
|
|
||||||
temp_hist:
|
temp_hist:
|
||||||
name: Temperature Threshold to switch AC on
|
name: Temperature Histeresys from off to on
|
||||||
description: This gap is difference between on and off
|
description: This gap is difference between on and off
|
||||||
default: 2
|
default: 2.0
|
||||||
selector:
|
selector:
|
||||||
number:
|
number:
|
||||||
min: 1
|
min: 1.0
|
||||||
max: 3
|
max: 4.0
|
||||||
|
step: 0.5
|
||||||
unit_of_measurement: celsius
|
unit_of_measurement: celsius
|
||||||
|
|
||||||
climate_target:
|
climate_target:
|
||||||
@@ -34,45 +36,38 @@ blueprint:
|
|||||||
|
|
||||||
mode: restart
|
mode: restart
|
||||||
|
|
||||||
# Calcoliamo matematicamente i valori statici qui per i trigger nativi
|
|
||||||
trigger_variables:
|
|
||||||
target_temp: !input temp_threshold
|
|
||||||
target_hist: !input temp_hist
|
|
||||||
# Calcolo automatico della soglia di spegnimento (es. 29 - 2 = 27)
|
|
||||||
soglia_off: "{{ ( ( target_temp | float(0) ) - ( target_hist | float(0) ) ) | default(27.0) }}"
|
|
||||||
|
|
||||||
# Questa variabile serve SOLO per semplificare il codice dentro le azioni (actions)
|
|
||||||
variables:
|
variables:
|
||||||
target_AC: !input climate_target
|
target_AC: !input climate_target
|
||||||
|
target_temp: !input temp_threshold
|
||||||
|
target_hist: !input temp_hist
|
||||||
|
|
||||||
triggers:
|
triggers:
|
||||||
# Si attiva IMMEDIATAMENTE se la temperatura sale sopra la soglia (o se abbassi la soglia sotto la temperatura attuale)
|
- trigger: state
|
||||||
- trigger: numeric_state
|
|
||||||
entity_id: !input climate_target
|
entity_id: !input climate_target
|
||||||
attribute: current_temperature
|
attribute: current_temperature
|
||||||
above: !input temp_threshold
|
|
||||||
id: AC_on
|
|
||||||
|
|
||||||
# Si attiva IMMEDIATAMENTE se la temperatura scende sotto la soglia meno l'isteresi
|
|
||||||
# AC_off: Risolve il problema del "none" calcolando l'isteresi con valori di ripiego sicuri per il reload YAML.
|
|
||||||
- trigger: template
|
|
||||||
value_template: >-
|
|
||||||
{% set entity = '!input climate_target' %}
|
|
||||||
{% set current = state_attr(entity, 'current_temperature') | float(0) %}
|
|
||||||
{% set t_temp = target_temp | float(29.0) %}
|
|
||||||
{% set t_hist = target_hist | float(2.0) %}
|
|
||||||
{% set calcolo_soglia_off = t_temp - t_hist %}
|
|
||||||
{{ current < calcolo_soglia_off and current > 0 }}
|
|
||||||
id: AC_off
|
|
||||||
|
|
||||||
conditions: []
|
conditions: []
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
- choose:
|
- choose:
|
||||||
|
# CONDITION 1: Turn AC ON & Adjust Fan
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: template
|
||||||
id:
|
value_template: "{{ state_attr(target_AC, 'current_temperature') | float(0) >= target_temp }}"
|
||||||
- AC_on
|
- condition: or
|
||||||
|
conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: !input climate_target
|
||||||
|
state: "off"
|
||||||
|
- condition: state
|
||||||
|
entity_id: !input climate_target
|
||||||
|
state: "heat_cool"
|
||||||
|
- condition: state
|
||||||
|
entity_id: !input climate_target
|
||||||
|
state: "dry"
|
||||||
|
- condition: state
|
||||||
|
entity_id: !input climate_target
|
||||||
|
state: "fan_only"
|
||||||
sequence:
|
sequence:
|
||||||
- action: climate.set_hvac_mode
|
- action: climate.set_hvac_mode
|
||||||
target:
|
target:
|
||||||
@@ -87,27 +82,27 @@ actions:
|
|||||||
{% set curr_temp = state_attr(target_AC, 'current_temperature') | float(0) -%}
|
{% set curr_temp = state_attr(target_AC, 'current_temperature') | float(0) -%}
|
||||||
{% set targ_temp = state_attr(target_AC, 'temperature') | float(0) -%}
|
{% set targ_temp = state_attr(target_AC, 'temperature') | float(0) -%}
|
||||||
{% set diff_temp = curr_temp - targ_temp -%}
|
{% set diff_temp = curr_temp - targ_temp -%}
|
||||||
{% if diff_temp >= 4 -%}
|
{% if diff_temp >= 4.0 -%}
|
||||||
5
|
5
|
||||||
{% elif diff_temp >= 3 and diff_temp < 4 -%}
|
{% elif diff_temp >= 3.5 and diff_temp < 4.0 -%}
|
||||||
4
|
4
|
||||||
{% elif diff_temp >= 2 and diff_temp < 3 -%}
|
{% elif diff_temp >= 3.0 and diff_temp < 3.5 -%}
|
||||||
3
|
3
|
||||||
|
{% elif diff_temp >= 1.5 and diff_temp < 3.0 -%}
|
||||||
|
2
|
||||||
{% else -%}
|
{% else -%}
|
||||||
Auto
|
Auto
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
# CONDITION 2: Turn AC OFF (Hysteresis)
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: template
|
||||||
id:
|
value_template: >-
|
||||||
- AC_off
|
{{ state_attr(target_AC, 'current_temperature') | float(0) <= (target_temp | float(0) - target_hist | Float(0)) }}
|
||||||
|
- condition: state
|
||||||
|
entity_id: !input climate_target
|
||||||
|
state: "cool"
|
||||||
sequence:
|
sequence:
|
||||||
- action: climate.set_hvac_mode
|
- action: climate.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: !input climate_target
|
entity_id: !input climate_target
|
||||||
data:
|
|
||||||
hvac_mode: "off"
|
|
||||||
- action: climate.set_fan_mode
|
|
||||||
target:
|
|
||||||
entity_id: !input climate_target
|
|
||||||
data:
|
|
||||||
fan_mode: Auto
|
|
||||||
|
|||||||
Reference in New Issue
Block a user