Automation to automatically cool the house when someone is home

Hi,

The thought I have right now is that:
House zone = higher than 0
The Airco temperature senses it’s greater than 29 celsius

The Airco’s will turn on;
HVEC will go into: Cool
The Airco’s will cool the house to 25 celsius

The Airco’s will keep doing this till the house get’s below 23 celcius
They’ll do it for a minimum of 1 hour (even if the temperature drops below 23 celcius prior)
They’ll stop if the house zone = 0 for more than 15 minutes

this is a nice to have, but I have not implemented it yet in the automation.

See below my YAML Code;

alias: temp_too-hot
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.airco_slaapkamer_room_temperature
      - sensor.airco_werkkamer_room_temperature
    above: 29
conditions:
  - condition: numeric_state
    entity_id: zone.home
    above: 0
actions:
  - action: climate.turn_on
    metadata: {}
    data: {}
    target:
      device_id:
        - f8f..
        - a9..
  - action: climate.set_temperature
    metadata: {}
    data:
      hvac_mode: cool
      temperature: 25
    target:
      device_id:
        - f8f..
        - a98..
  - wait_for_trigger:
      - trigger: numeric_state
        entity_id:
          - sensor.airco_slaapkamer_room_temperature
          - sensor.airco_werkkamer_room_temperature
        below: 22
    timeout:
      hours: 1
      minutes: 0
      seconds: 0
      milliseconds: 0
    continue_on_timeout: true
  - action: climate.turn_off
    metadata: {}
    data: {}
    target:
      device_id: f8f..
  - action: automation.trigger
    metadata: {}
    data:
      skip_condition: true
    target:
      entity_id: automation.temp_reset
mode: single

if people could maybe give some feedback, that would be highly appreciated!

  - trigger: numeric_state
    entity_id:
      - sensor.airco_slaapkamer_room_temperature
      - sensor.airco_werkkamer_room_temperature
    above: 29


  - condition: numeric_state
    entity_id: zone.home
    above: 0

you need both of these as triggers and as condition.
Otherwise it will not trigger when you get home, only when the temperature goes above 29.

The wait for trigger thing would I remove.
Make that a separate automation or a separate path in the automation.
Waiting is never good for automations.

So something like this is what I would have done:

alias: temp_too-hot
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.airco_slaapkamer_room_temperature
      - sensor.airco_werkkamer_room_temperature
    above: 29
    id: cool
  - trigger: numeric_state
    entity_id: zone.home
    above: 0
    id: cool
  - trigger: numeric_state
    entity_id:
      - sensor.airco_slaapkamer_room_temperature
      - sensor.airco_werkkamer_room_temperature
    below: 22
    id: "off"
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - cool
          - condition: numeric_state
            entity_id: zone.home
            above: 0
          - condition: numeric_state
            entity_id:
              - sensor.airco_slaapkamer_room_temperature
              - sensor.airco_werkkamer_room_temperature
            above: 29
        sequence:
          - action: climate.turn_on
            metadata: {}
            data: {}
            target:
              device_id:
                - f8f..
                - a9..
          - action: climate.set_temperature
            metadata: {}
            data:
              hvac_mode: cool
              temperature: 25
            target:
              device_id:
                - f8f..
                - a98..
      - conditions:
          - condition: trigger
            id:
              - "off"
        sequence:
          - action: climate.turn_off
            metadata: {}
            data: {}
            target:
              device_id: f8f..
          - action: automation.trigger
            metadata: {}
            data:
              skip_condition: true
            target:
              entity_id: automation.temp_reset
mode: single

Not sure about the triggering of an automation though.
You should make that automation a script and trigger the script instead.

And I would not use device actions.
I would use the entity_id of the climate entities. It’s a lot more readable than your f8f… which you did not have to mask either.

Thanks for your reply. I’m going to test it out and see how it will work.

I’m a little confused about what you said regarding: " You should make that automation a script and trigger the script instead". Do you have a bit more background info I can look into?

Triggering another automation is generally not recommended.
Trigger other automations like this can be an issue a few years later when you don’t know there is an automaton that trigger it. So you delete it or modify it to something else.
Having it as a script is more apparent that something else runs it.

You can obviously do what you want, but I promise a few years from now you will have a hard time to figure out what automation does what and where it is or how it’s done.
I still have problems trying to find something that is done automatically but I don’t know where it is. I have searched for it on and off for weeks.

1 Like