Switching on an AC when reaching a certain temperature

Hi dear HA Community,

thing is, the automation actually is working. Means if the temperature is reaching above 24 degree between 8pm and 11pm (one of may conditions, it represents a time table in HA) - the AC is switching on.

The issue is that most of the time the temperature IS already above 24 degree at 8pm:). Means the automation is only working exactly at the moment when the thermostat jumps above 24 degrees. But since the temperature is already above 24 degree after 8pm - the ac is not switching on to cool the room until it reaches below 20 degree again.

any Idea what I might do?

Code:

alias: Klima Temp Abhängigkeit
description: ""
trigger:
  - alias: Temperatur < 20
    platform: device
    device_id: dd3142a685157ee9f136f5d9e7608738
    domain: climate
    entity_id: 4473bc11a152385bf9da2b859361bc4c
    type: current_temperature_changed
    id: temp_below_20_leon
    above: 24
  - alias: Temperatur > 24
    platform: device
    device_id: dd3142a685157ee9f136f5d9e7608738
    domain: climate
    entity_id: 4473bc11a152385bf9da2b859361bc4c
    type: current_temperature_changed
    id: temp_above_24_leon
    below: 20
condition:
  - condition: state
    entity_id: schedule.zeitplan_19_23_uhr
    state: "on"
    enabled: true
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - temp_above_24_leon
        sequence:
          - device_id: dd3142a685157ee9f136f5d9e7608738
            domain: climate
            entity_id: 4473bc11a152385bf9da2b859361bc4c
            type: set_hvac_mode
            hvac_mode: cool
      - conditions:
          - condition: trigger
            id:
              - temp_below_20_leon
        sequence:
          - device_id: dd3142a685157ee9f136f5d9e7608738
            domain: climate
            entity_id: 4473bc11a152385bf9da2b859361bc4c
            type: set_hvac_mode
            hvac_mode: "off"
mode: single

Add a time trigger at 8pm. Add a temperature > 24 condition. Nether of these will affect your existing triggers or conditions.

1 Like

Hi @tom_l

just wondering if that really can be the solution for my issue.
As said, between 8pm and 11pm the climate device should be powered on if at least 24 degree and powered off if reaching below 20 degree.

And the 24 degree condition - I cannot set a certain to assign it to a specific action. I do have several AC’s which I want to put in on automation file. When I set a general condition (e.g. thermostat leon) all ac’s would be powered off when reaching the 20 degree limit in one room.
my best
tux1980

Yes. I have seen this same question 100s of times in one form or another. It is the answer. Try it.

With this extra trigger and condition (i.e. in addition to what you already have) your automation will continue to operate as before except at 8pm it will check to see if it is already above 24.

And if you need a second opinion: Tom is right. This is a pretty standard pattern. Give it some thought and shout if you need more help.

See this too: Automations #1: trigger only fires when it changes from not true to true.

Hi,

is still not running since the temperature in my office is already above 24 - or 23, I changed it.

To keep it simple, I just want to run the automation without any condition, only trigger & action.

this is my code:

alias: AC Automation
description: ""
trigger:
  - alias: Temperatur < 20
    platform: device
    device_id: a64891eb9736aefd57739baba01729f0
    domain: climate
    entity_id: 2fc421a03365bc0e2fd9cf9165c20860
    type: current_temperature_changed
    id: temp_below_20_office
    below: 20
  - alias: Temperatur > 24
    platform: device
    device_id: a64891eb9736aefd57739baba01729f0
    domain: climate
    entity_id: 2fc421a03365bc0e2fd9cf9165c20860
    type: current_temperature_changed
    id: temp_above_24_office
    above: 23
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - temp_above_24_office
        sequence:
          - device_id: a64891eb9736aefd57739baba01729f0
            domain: climate
            entity_id: 2fc421a03365bc0e2fd9cf9165c20860
            type: set_hvac_mode
            hvac_mode: cool
      - conditions:
          - condition: trigger
            id:
              - temp_below_20_office
        sequence:
          - device_id: a64891eb9736aefd57739baba01729f0
            domain: climate
            entity_id: 2fc421a03365bc0e2fd9cf9165c20860
            type: set_hvac_mode
            hvac_mode: "off"
mode: single


What have I done wrong in this example? :frowning:

You have completely ignored what I said to do.

You asked for help and chose to ignore it. Good luck I’m done.

As stated before.
Add a time trigger.

alias: AC Automation
description: ""
trigger:
  - platform: time
    at: "20:00:00"
    id: time
  - alias: Temperatur < 20
    platform: device
    device_id: a64891eb9736aefd57739baba01729f0
    domain: climate
    entity_id: 2fc421a03365bc0e2fd9cf9165c20860
    type: current_temperature_changed
    id: temp_below_20_office
    below: 20
  - alias: Temperatur > 24
    platform: device
    device_id: a64891eb9736aefd57739baba01729f0
    domain: climate
    entity_id: 2fc421a03365bc0e2fd9cf9165c20860
    type: current_temperature_changed
    id: temp_above_24_office
    above: 23
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - temp_above_24_office
              - time
          - condition: time
            after: "20:00:00"
            before: "23:00:00"
        sequence:
          - device_id: a64891eb9736aefd57739baba01729f0
            domain: climate
            entity_id: 2fc421a03365bc0e2fd9cf9165c20860
            type: set_hvac_mode
            hvac_mode: cool
      - conditions:
          - condition: trigger
            id:
              - temp_below_20_office
        sequence:
          - device_id: a64891eb9736aefd57739baba01729f0
            domain: climate
            entity_id: 2fc421a03365bc0e2fd9cf9165c20860
            type: set_hvac_mode
            hvac_mode: "off"
mode: single

I highly suggest you change your device triggers and actions to entity triggers and actions (call serivce).

Hi @tom_l
I actually did what you said and forget to paste this in this example, so I ignored nothing you said. That kind of behavior, at least in my humble opinion, is not the Open Source way that belongs in this kind of community, better ask before judging someone

Hi,
yes it obviously works this way (added the trigger already earlier as Tom also recommended to set the trigger) and I I’m now adding different other conditions before.
thanks for helping me out on this construction side.

Thanks @parautenbach - it works as it should be now:)

1 Like