Automation not for airco triggering

Hello, I made the following automation but it does not start and I don’t understand why.
Can anyone maybe point me in the right direction ?

alias: Airco aan
description: Airco aan boven de 24 graden en tussen 18:00 en 9:00
trigger:
  - platform: numeric_state
    entity_id:
      - climate.masterbedroom
    for:
      hours: 0
      minutes: 5
      seconds: 0
    above: 22
    attribute: current_temperature
condition:
  - condition: time
    after: "18:00:00"
    before: "9:00"
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
action:
  - device_id: b32d5ee740aae4040697e38d7befe9f0
    domain: climate
    entity_id: dc9283e2996aeca5bc833f150c224cf2
    type: set_hvac_mode
    hvac_mode: cool
  - action: cover.close_cover
    metadata: {}
    data: {}
    target:
      entity_id: cover.screens_mbr_achter
  - action: notify.mobile_app_joosts_iphone_15_pro
    metadata: {}
    data:
      message: Airco Masterbedroom is aangezet
      title: Airco
mode: single

How have you tested the automation? There is a good description of how triggers work and how to test the parts of an automation in the following thread:

Note that your automation will only trigger once, and that is when the temperature gets above 22 degs.
And that is probably way before 18:00.
(This is also explained in @Didgeridrew 's cookbook link :stuck_out_tongue: )

So you should reverse trigger and condition…
trigger at 18:00
condition above 22

And then maybe a delay for 13 hours, but I think it is better to use an additional trigger at 09:00 to turn it off.

PS, you might also want to trigger on temp, but it is unlikely the temperature will still rise after 18:30 in the Netherlands :wink:

You could combine these in one automation (by using trigger ID’s), but it’s a lot easier to create 2 automations :wink:
But in case you decide to combine them, it might look something like this:

alias: "Turn AC on/off "
description: " But only if temperature is above 22"
trigger:
  - platform: time
    at: "07:00:00"
    id: off_0700
  - platform: time
    at: "18:30:00"
    id: on_1830
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - off_0700
        sequence:
          - action: climate.set_hvac_mode
            target:
              entity_id: climate.hvac2
            data:
              hvac_mode: "off"
       - conditions:
          - condition: trigger
            id: on_1830
          - condition: state
            entity_id: group.people
            state: home
        sequence:
          - alias: Turn on AC when room temp above 22
            choose:
              - conditions:
                  - condition: numeric_state
                    entity_id: climate.hvac2
                    attribute: current_temperature
                    above: 22
                sequence:
                  - action: climate.set_hvac_mode
                    target:
                      entity_id:
                        - climate.hvac2
                    data:
                      hvac_mode: cool
                  - action: climate.set_temperature
                    target:
                      entity_id: climate.hvac2
                    data:
                      temperature: 22
mode: single
initial_state: true

(Note that this one has an additional condition; people need to be home :wink:

1 Like