Help with automation to turn on AC

I’m trying to create an automation that turns on my AC and sets the setpoint to 83 deg. when the room temp rises past 82 deg, its between 6AM and 5PM and the day/time is not part of either of 2 schedule helpers (wfh, sleep).

The automation is working erratically and i would like some help troubleshooting what i have done wrong.

Thanks,

id: '1774136351503'
alias: AC UNOCCUPIED TURN ON
description: ''
triggers:
  - type: temperature
    device_id: 31f458e519b51e96439c81f208b37535
    entity_id: 32c419ff49d316b53ccc5972ee8c4cf2
    domain: sensor
    trigger: device
    above: 82
    for:
      hours: 0
      minutes: 0
      seconds: 0
conditions:
  - condition: state
    entity_id: schedule.ac_wfh
    state:
      - 'off'
  - condition: state
    entity_id: schedule.ac_sleep
    state:
      - 'off'
  - condition: time
    after: '06:00:00'
    before: '17:00:00'
    weekday:
      - sun
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
actions:
  - action: climate.turn_on
    metadata: {}
    target:
      entity_id: climate.room_air_conditioner
    data: {}
  - action: climate.set_temperature
    metadata: {}
    target:
      entity_id: climate.room_air_conditioner
    data:
      temperature: 83
      hvac_mode: cool
  - action: climate.set_fan_mode
    metadata: {}
    target:
      entity_id: climate.room_air_conditioner
    data:
      fan_mode: auto
mode: single

Can you describe better what you mean by erratic?

Remember that for that trigger to work, the temperature must change from below (or on) to above your threshold. If it’s already above when the other conditions are met, nothing will happen. The usual pattern is to add the conditions as triggers too and vice versa. In other words, add a 06h00 time trigger.

If this is not the answer to your issue, show us the histories around the time you expected this to work. Also provide an automation trace.

Lastly, steer away from device triggers. Use a plain numeric state trigger.

It’s better to trigger on temperature changes, then add a condition to check if the value is above 82 degrees before executing the action.

You should just turn it on at 06:00am and off at 05:00pm and set the setpoint to 83/auto

If the temperature is above 83 already, the AC will be on, but not cooling. If that is not wanted, add a temperature condition. In that case you might also need to add another trigger on temperature (and a time condition)

There is no need to check if it is on or off.

Or use the generic thermostat and switch to a preset mode at the time you want using an automation. This will allow you to adjust settings easily and manually turn off or on if needed.

Sometimes the automation runs as expected. Sometimes it does not turn on at all. Sometimes it turns on at the wrong starting setpoint.

I’m more interested in understanding why my automation isn’t working than changing the framework of the automation itself.

You need to dramatically increase and improve the information you give us. What happened exactly and what were the conditions (values of sensors, etc.)? Where are your traces and logs? Which integration is controlling your AC?

It’s because it will only trigger when the temp goes from below to above 82. So if the temp is above 82 at 6am it will not trigger.

@parautenbach explained that already (as well as @Arh again just now) ,but apparently that wasn’t very clear :face_with_raised_eyebrow: ?

This helped me solve it. Thanks.