Room Presence Temperature Automation

Here is the YAML code and template sensors I used for the automations.

I have three HVAC zones in my house and each zone has two automations. One to make it colder if someone is in the area. The second is to make it warm.

This is the first automation to cool down the kitchen area.

alias: Kitchen Climate Control On
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.presence_sensor_fp2_8576_presence_sensor_1
    to: "on"
    for:
      hours: 0
      minutes: 3
      seconds: 0
  - platform: state
    entity_id:
      - sensor.hvac_reed_area
    to: hvac_kitchen
    for:
      hours: 0
      minutes: 3
      seconds: 0
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: climate.kitchen
        attribute: preset_mode
        state: Home
      - condition: state
        entity_id: climate.kitchen
        attribute: preset_mode
        state: Normal Cool
  - condition: time
    after: "07:00:00"
    before: "23:55:00"
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: sensor.hvac_reed_area
            state: hvac_kitchen
        sequence:
          - device_id: abcdefg1234567
            domain: climate
            entity_id: climate.kitchen
            type: set_preset_mode
            preset_mode: Really Cool
      - conditions:
          - condition: state
            entity_id: climate.kitchen
            attribute: preset_mode
            state: Home
        sequence:
          - device_id: abcdefg1234567
            domain: climate
            entity_id: climate.kitchen
            type: set_preset_mode
            preset_mode: Normal Cool
    default: []
mode: single

I’m using ecobee thermostats and it’s just changing the temperature using the presets in the ecobee app. As I mentioned in the video this automation does not run when the thermostat is changed manually. That is because there is a condition to make sure it’s in the “Home” preset or the “Normal Cool” preset.

When the temperature is changed manually it overrides the preset and sets it to something else so that would make this automation not run. But, if the manual temperature is “cleared” on the thermostat, the preset goes back to “Home”.

This automation turns the temperature back up if no one is in the area.

alias: Kitchen Climate Low Power
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.presence_sensor_fp2_8576_presence_sensor_1
    to: "off"
    for:
      hours: 0
      minutes: 10
      seconds: 0
  - platform: state
    entity_id:
      - sensor.hvac_reed_area
    for:
      hours: 0
      minutes: 10
      seconds: 0
    from: hvac_kitchen
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: climate.kitchen
        attribute: preset_mode
        state: Really Cool
      - condition: state
        entity_id: climate.kitchen
        attribute: preset_mode
        state: Normal Cool
  - condition: time
    after: "07:00:00"
    before: "23:55:00"
  - condition: device
    device_id: abcdefg1234567
    domain: media_player
    entity_id: media_player.denon_avr_x4700h
    type: is_off
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: sensor.hvac_reed_area
            state: hvac_kitchen
        sequence: []
      - conditions:
          - condition: state
            entity_id: binary_sensor.presence_sensor_fp2_8576_presence_sensor_1
            state: "on"
            for:
              hours: 0
              minutes: 3
              seconds: 0
        sequence:
          - device_id: abcdefg1234567
            domain: climate
            entity_id: climate.kitchen
            type: set_preset_mode
            preset_mode: Normal Cool
    default:
      - service: ecobee.resume_program
        data:
          resume_all: false
          entity_id: climate.kitchen
mode: single

This can be done in many different ways but to keep it simple I just have the default “Home” preset on the ecobee be slightly warm. Then if no one is in the room it calls “ecobee.resume_program” which makes it go back to the “Home” mode.

I also have a few template sensors to make these automations easy. If you want a more detailed explanation on how these work check out the video I just made on them. https://youtu.be/g53jpdWoXVk

- platform: template
  sensors:
    reed_room:
      friendly_name: "Reed current room"
      value_template: >
        {% if is_state("input_boolean.reed_phone_charging", "on") and (states.sensor.iphone_reed_esp.state != "not_home") -%}
          {{(states.sensor.apple_watch_reed.state)}}
        {%- else -%}
          {{(states.sensor.iphone_reed_esp.state)}}
        {%- endif %}
- platform: template
  sensors:
    hvac_reed_area:
      friendly_name: "HVAC Reed Area"
      value_template: >
        {% if (states.sensor.reed_room.state == "bedroom_esp") or (states.sensor.reed_room.state == "closet_esp") -%}
          hvac_master_bedroom 
        {% elif (states.sensor.reed_room.state == "kitchen_esp") or (states.sensor.reed_room.state == "living_room_esp") -%}
          hvac_kitchen
        {% elif (states.sensor.reed_room.state == "studio_esp") or (states.sensor.reed_room.state == "office_esp") or (states.sensor.reed_room.state == "kids_esp") -%}
          hvac_bedrooms
        {%- else -%}
          hvac_none
        {%- endif %}