Hi all, I’m looking for a way to set a variable for my air conditioner fan_mode, based on what time it runs.
What I would like to achieve in my blueprint is that (metalanguage below):
action:
- choose:
- conditions:
- condition:
if time in range(09:00:00AM ~ 21:00:00PM): then
set fan_mode: low
elif time in range(21:00:00PM ~ 09:00:00AM): then
set fan_mode: auto
Here below the full current blueprint snippet:
blueprint:
name: Automatic A/C Control based on Temperature
description: "## Fan ON/OFF Automation based on temperature, outside temperature.\n\nFan
turns on if the following conditions are met:\n temperature inside greater than
your set threshold value\n temperature outside is lower than your set maximum
value (to prevent turning the fan on in winter)\n\nFan turns off if the following
conditions are met:\n temperature inside is lower than your threshold value minus
the hystersis value\n What the automation **NOT** observes:\n manual fan control.
Adapt the given values too your needs.\n If you manually turn the fan on and
the inside temperature is below the threshold your fan will turn off soon.\n\nWhat
you need:\n a fan entity. if you control your fan via a switch entity (via smart
plug for example) you can create a template fan entity.\n sensor entities for
inside and outside temperature. (if you want to use the weather domain than create
a template sensor from the temp attribute)\n Inspired by Sam04"
domain: automation
input:
air_conditioner:
name: Air Conditioner
description: Air Conditioner to control
selector:
entity:
domain: climate
presence_sensor:
name: Presence Sensor
description: Only turn on air conditioner if someone is home
selector:
entity:
domain: person
windows_sensor:
name: Windows sensors
description: Only turn on air conditioner if windows are closed
selector:
entity:
domain: binary_sensor
device_class: window
multiple: false
temp_inside:
name: Temperature Inside
description: Temperature to track inside your house
selector:
entity:
domain: sensor
device_class: temperature
multiple: false
temp_outside:
name: Temperature Outside
description: Temperature outside to prevent to turn on the fan in winter for
example. Set to same Temperature Inside entity if you don't want to use it
selector:
entity:
domain: sensor
device_class: temperature
multiple: false
temp_outside_min:
name: Outside temperature
description: outside temperature that must be reached to turn on the fan (to
prevent the fan to be turned on in winter). Set to 0 to disable
selector:
number:
min: 0.0
max: 300.0
step: 0.5
unit_of_measurement: °C | °F
mode: slider
temp_threshold_inside:
name: Inside temperature threshold
description: inside threshold temperature that must be reached to turn on the
fan
selector:
number:
min: 0.0
max: 300.0
step: 0.5
unit_of_measurement: °C | °F
mode: slider
hysteresis:
name: Hysteresis
description: The difference the observed value must be lower than the threshold
value before the fan is turned off
selector:
number:
min: 0.5
max: 100.0
step: 0.5
unit_of_measurement: °C | °F
mode: slider
source_url: https://community.home-assistant.io/t/automatic-temperature-fan-control/350172
variables:
air_conditioner: !input 'air_conditioner'
presence_sensor: !input 'presence_sensor'
windows_sensor: !input 'windows_sensor'
temp_inside_entity: !input 'temp_inside'
temp_inside: '{{ states[temp_inside_entity].state }}'
temp_outside_entity: !input 'temp_outside'
temp_outside: '{{ states[temp_outside_entity].state }}'
temp_threshold_inside: !input 'temp_threshold_inside'
temp_outside_min: !input 'temp_outside_min'
hysteresis: !input 'hysteresis'
max_exceeded: silent
trigger:
- platform: state
entity_id: !input 'temp_inside'
- platform: time_pattern
minutes: /1
condition: []
action:
- choose:
- conditions:
- alias: temp inside greater than temp threshold value
condition: template
value_template: '{{ temp_inside|float > temp_threshold_inside|float }}'
- alias: temp outside greater than outside min temp
condition: template
value_template: '{{ temp_outside|float > temp_outside_min|float }}'
- condition: state
entity_id: !input 'presence_sensor'
state: 'home'
- condition: state
entity_id: !input 'windows_sensor'
state: 'off'
- condition: state
entity_id: !input 'air_conditioner'
state: 'off'
sequence:
- service: climate.turn_on
target:
entity_id: !input 'air_conditioner'
- service: climate.set_hvac_mode
target:
entity_id: !input 'air_conditioner'
data:
hvac_mode: cool
- service: climate.set_temperature
target:
entity_id: !input 'air_conditioner'
data:
hvac_mode: cool
temperature: 24
- service: climate.set_swing_mode
target:
entity_id: !input 'air_conditioner'
data:
swing_mode: fixedTop
- service: climate.set_fan_mode
target:
entity_id: !input 'air_conditioner'
data:
fan_mode: low
- conditions:
- condition: or
conditions:
- condition: state
entity_id: !input 'windows_sensor'
state: 'on'
for:
hours: 0
minutes: 2
seconds: 0
- condition: state
entity_id: !input 'presence_sensor'
state: 'not_home'
- condition: state
entity_id: !input 'air_conditioner'
state: 'on'
- condition: template
value_template: '{{ (temp_threshold_inside - hysteresis)|float > temp_inside|float }}'
sequence:
- service: climate.turn_off
target:
entity_id: !input 'air_conditioner'
default: []
mode: single
Is this somehow achievable? any suggestion?
Thanks in advance,
Antonio