Files
home-assistant/blueprints/automation/homeassistant/auto_ac_control.yaml
T

87 lines
2.4 KiB
YAML

blueprint:
name: Auto AC Control
description: Auto Turn on Air Conditioning
domain: automation
author: Tiziano Trabattoni
input:
temp_threshold:
name: Temperature Threshold to switch AC on
description: This threshold is the temperature above which AC must be switched on
default: 29
selector:
number:
min: 25
max: 40
unit_of_measurement: celsius
temp_hist:
name: Temperature Threshold to switch AC on
description: This gap is difference between on and off
default: 2
selector:
number:
min: 1
max: 3
unit_of_measurement: celsius
climate_target:
name: Termostat Control
description: Identifies the AC climate to be controlled
selector:
entity:
filter:
- domain: climate
mode: single
# Definiamo l'input come variabile per usarlo dentro i template dei trigger
trigger_variables:
target_temp: !input temp_threshold
target_hist: !input temp_hist
sensor_entity: !input climate_target
triggers:
# Si attiva quando la temperatura attuale del clima sale SOPRA la soglia impostata
- trigger: template
value_template: "{{ state_attr(sensor_entity, 'current_temperature') | float(0) >= target_temp | float(0) }}"
id: AC_on
# Si attiva quando la temperatura attuale del clima scende SOTTO la soglia meno 2 gradi
- trigger: template
value_template: "{{ state_attr(sensor_entity, 'current_temperature') | float(0) < (target_temp | float(0) - temp_hist ) }}"
id: AC_off
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- AC_on
sequence:
- action: climate.set_hvac_mode
target:
entity_id: !input climate_target
data:
hvac_mode: cool
- action: climate.set_fan_mode
target:
entity_id: !input climate_target
data:
fan_mode: Auto
- conditions:
- condition: trigger
id:
- AC_off
sequence:
- action: climate.set_hvac_mode
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