I would like to define the threshold limit to be the value of the number helper -1. For example, if the number value is set to 80, i would like the limit to be set at 79. Is this possible? If not, is there a methodology that would allow me to achieve the same functionality?
In Home Assistant, I have an AC unit and a remote temperature sensor in a room (call the sensor value TS). I also want to define a number value using a number helper (call this A).
The desired behavior is:
⢠When TS > A + 1, set the AC setpoint to A â 2
⢠When TS < A â 1, set the AC setpoint to A + 2
Though it's not likely with the hysteresis these triggers give, I would still probably add a for to each of those triggers to avoid bouncing.. just in case.
There are 3 different conditions this automation will run under: work from home, unoccupied and sleep.
The sleep condition is from 9pm to 8am 7 days a week. The WFH condition is from 8am to 5pm Monday and Tuesday. The unoccupied condition is any time that is not sleep or WFH.
How could I have the automation reference 1 of 3 different number helpers (âAâ in my previous example) based on the above schedule?
I want to have 3 separate number helper sliders on my dashboard. I will set them as follows:
Sleep: 76°
WFH: 80°
Unoccupied: 82°
Based on the schedule I previously posted I want the automation to reference the appropriate helper number. For example, from 9pm to 8am 7 days a week I want the âAâ value to be 76 and from 8am to 5pm Monday and Tuesday I want âAâ to be 80°
I canât think of a reason why these conditions would be needed outside the automation.
In order for the previous automation to work, we can't change the value of the entity IDs stored in A, trigger variables are fixed at restart/reload.
What I would do would be to use a Template sensor that derives the desired setpoint value, and use that sensor's ID for A in the automation.
template:
- sensor:
- name: HVAC Active Setpoint
default_entity_id: sensor.hvac_active_setpoint
unique_id: hvac_active_setpoint_0001
state: |
{% if now() >= today_at("21:00") or now() < today_at("8:00") %}
{% set type = 'sleep' %}
{% elif now().isoweekday() in [1,2] and ( today_at("8:00") < now() <= today_at("17:00") ) %}
{% set type = 'wfh' %}
{% else %}
{% set type = 'unoccupied' %}
{% endif %}
{# The next part will need to be changed to work with your number helpers' entity IDs #}
{% set helper_id = 'input_number.' ~ type %}
{{ states(helper_id) }}
Since this is just a state-based template sensor, you can set it up in the UI from the Helpers menu if you don't want to do it in YAML. If you do it that way, only paste the lines belowstate: | into the field titled "State*".
In the last two lines, the template "constructs" the entity ID from the results of the previous if/then statement... then returns the state of the helper.
{% set helper_id = 'input_number.' ~ type %}
{{ states(helper_id) }}
As it is configured in the previous post, the entity IDs would need to be input_number.sleep, input_number.wfh, and input_number.unoccupied. Those can be whatever you want as long as you update the template to match your entities.
If you can't figure it out, post the entity IDs you will be using, and we can update the sensor config to match.
I know HA has some native tools to help with times and schedules. Is there any way to define the schedules for Sleep and WFH in one of those tools so that i can adjust them in a more user friendly way than editing the automation?
Maybe I can define the schedule by creating events on the HA Calendar.
In that case you need to decide how you want to structure the data so that we can pick out calendar events that belong to this process and retrieve the type data from them.
For example, you could have the title of the calendar events all be the same (like "HVAC Setting") and store the setpoint type in the event's description (Sleep). Or, you could have both pieces of data in the event title like "HVAC Setting: Sleep".