Trying to adjust the AC a degree at night/morning, but only if it isn't already at that temp

I don’t seem to be getting this right. I am trying to make an automation in HA that drops the AC down a degree at night (to 76), but only if it is 77 at the time the automation runs. Then another automation that runs in the morning to bring it back to 77.

Since I created this late at night, I started with the automation for waking up. I set it to run at 08:00:00 with a condition of “if” it is currently 76. The action, to bring it to 77. I am getting something wrong though as nothing happened at 8AM.

It is pulled as an entity since the thermostat is on Vera and adjustable on HA through the Vera integration.

Hi there did you try hitting run actions button in the automations edit page. If the changes the temperature, it means that the actions part of the automation works and there is some errors in the conditions part or the trigger part. because these are screenshots I cant check what is the exact error. But I am including an automation that combines both these two automations into one. You will have to change the entity ids and times etc in this but it should work.

alias: Temperature Automation
description: ''
mode: single
trigger:
  - platform: time
    at: '08:00:00'
    id: morning
  - platform: time
    at: '22:00:00'
    id: night
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: morning
        sequence:
          - condition: template
            value_template: >-
              {{state_attr('climate.main_thermostat_140', 'current_temperature')
              | int == 76}}
          - service: climate.set_temperature
            data:
              temperature: 77
            target:
              entity_id: climate.main_thermostat
      - conditions:
          - condition: trigger
            id: night
          - condition: template
            value_template: >-
              {{state_attr('climate.main_thermostat_140', 'current_temperature')
              | int == 77}}
        sequence:
          - service: climate.set_temperature
            data:
              temperature: 76
            target:
              entity_id: climate.main_thermostat
    default: []

If you have trouble copying this to automations please try the following method.

Awesome reply, thank you.

I tried inserting this and adjusted both entity IDs and the evening time value. It didn’t work though. Upon saving, it said:

Message malformed: Unexpected value for condition: ‘trigger’. Expected numeric_state, state, sun, template, time, zone, and, or, not, device @ data[‘action’][0][‘choose’][0][‘conditions’][0]

alias: Temperature Automation - Summer
description: ''
mode: single
trigger:
  - platform: time
    at: '08:00:00'
    id: morning
  - platform: time
    at: '23:00:00'
    id: night
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: morning
        sequence:
          - condition: template
            value_template: >-
              {{state_attr('climate.main_thermostat_140', 'current_temperature')
              | int == 76}}
          - service: climate.set_temperature
            data:
              temperature: 77
            target:
              entity_id: climate.main_thermostat_140
      - conditions:
          - condition: trigger
            id: night
          - condition: template
            value_template: >-
              {{state_attr('climate.main_thermostat_140', 'current_temperature')
              | int == 77}}
        sequence:
          - service: climate.set_temperature
            data:
              temperature: 76
            target:
              entity_id: climate.main_thermostat_140
    default: []

The suggested automation employs a Trigger Condition which was introduced in version 2021.7. Is that the version you are using?

If you are not using the latest version (or even if you are) the following example employs a slightly different technique.

alias: 'Example Temperature Schedule'
trigger:
  - platform: time
    at:
      - '08:00:00'
      - '23:00:00'
condition: []
action:
  - variables:
      temp: "{{ state_attr('climate.main_thermostat_140', 'current_temperature') | int }}"
  - choose:
      - conditions: "{{ trigger.now.hour == 8 and temp == 76 }}"
        sequence:
          - service: climate.set_temperature
            data:
              temperature: 77
            target:
              entity_id: climate.main_thermostat_140
      - conditions: "{{ trigger.now.hour == 23 and temp == 77 }}"
        sequence:
          - service: climate.set_temperature
            data:
              temperature: 76
            target:
              entity_id: climate.main_thermostat_140

NOTE
You can’t test this automation by manually executing it because it refers to a trigger variable which only exists when the automation is triggered by its Time Trigger.

I should have thought about it. It slipped my mind because I just updated it like a week or so ago. I was running core-2021.6.6. Updated now and it the save took. :sunglasses:

Now it’s the waiting game to see if things begin to trigger.

You are a fellow saint. You are both fellow saints. Thank you.

Update: I can confirm that it works 100%. Thanks again.