Smart HVAC Automation Based on Presence and Temperature

Hey everyone, I’m really excited to share my journey with smart HVAC automation! :star2: I’ve been working on a system that starts my HVAC units based on both the presence of people in a room and the room’s temperature. It’s been a fun challenge, and I thought I’d walk through my setup and some of the hurdles I’ve faced.

So, to start, I have a template sensor that identifies which HVAC unit (out of several) is the next one to activate. This is determined by which unit is currently off and which room has the lowest temperature. Here’s a snippet of how that sensor works:

yaml

  • platform: template
    sensors:
    pdc_da_avviare:
    unique_id: pdc_da_avviare
    friendly_name: ‘Prossima PDC da avviare’
    value_template: >
    {%- set d = [ {‘unit’: ‘climate.daikin_soggiorno’, ‘state’: states(‘climate.daikin_soggiorno’), ‘temp’: states(‘sensor.temperatura_pt’) | float(100)},
    {‘unit’:‘climate.daikin_camera_matrimoniale’, ‘state’: states(‘climate.daikin_camera_matrimoniale’), ‘temp’: states(‘sensor.temperatura_camera’) | float(100)},
    {‘unit’:‘climate.daikin_camera_1’, ‘state’: states(‘climate.daikin_camera_1’), ‘temp’: states(‘sensor.temperatura_camera_1’)|float(100)},
    {‘unit’:‘climate.daikin_camera_2’, ‘state’: states(‘climate.daikin_camera_2’), ‘temp’: states(‘sensor.temperatura_camera_2’)|float(100)},
    {‘unit’:‘climate.daikin_camera_3’, ‘state’: states(‘climate.daikin_camera_3’), ‘temp’: states(‘sensor.temperatura_camera_3’)|float(100)} ] %}
    {{ (d | selectattr(‘state’, ‘eq’, ‘off’) | sort(attribute = ‘temp’) | first)[‘unit’] }}

Now, I want to enhance this by adding presence detection. The goal is to activate an HVAC unit if:

  1. The person in that room is detected as being home, or
  2. The room’s temperature drops below 16.5°C.

I’m thinking of using binary sensors for presence detection and integrating them into the automation logic. For example, if the presence sensor for the living room triggers, the corresponding HVAC unit should start if it’s not already running. Similarly, if the temperature in the bedroom drops below the threshold, the HVAC there should kick in.

One challenge I’ve encountered is ensuring that the automation doesn’t conflict with the existing temperature-based logic. I need to make sure that both conditions (presence and temperature) are checked without causing any overlap or unintended behavior. I’m also considering how to handle cases where multiple conditions might be met simultaneously.

If anyone has experience with similar setups or can suggest a more efficient way to structure this automation, I’d be thrilled to hear your thoughts! :hugs: Let’s make our homes smarter together!