Time Based Trigger Not Working

This time based automation is not firing at 4am as it should.

I’ve checked that the service calls, if I “run automation” it works but left to time it doesn’t. Running on Ri 4 and the timezone is set correctly. Could someone help?

alias: Set Morning Thermostat to 76f
description: ''
trigger:
  - platform: time
    at: '04:00:00'
condition:
  - condition: device
    device_id: 4fcee45741653467dcb0424c22e0960d
    domain: climate
    entity_id: climate.main_house_ac
    type: is_hvac_mode
    hvac_mode: heat
action:
  - service: climate.set_temperature
    data:
      temperature: 76
    target:
      entity_id: climate.main_house_ac
mode: single

it’s most likely your condition. Try using a state condition instead of a device condition.

Ok, I tired this but still no joy:

Is my state correct?

alias: Set Morning Thermostat to 76f
description: ''
trigger:
  - platform: time
    at: '07:00:00'
condition:
  - condition: state
    entity_id: climate.main_house_ac
    state: heat
    attribute: hvac_modes
action:
  - service: climate.set_temperature
    data:
      temperature: 76
    target:
      entity_id: climate.main_house_ac
mode: single

Not sure, I don’t have a thermostat so I don’t have hvac_modes memorized. Verify that’s the correct attribute and that it has a single state heat. To me, I would assume hvac_modes is a list of available modes and not the actual current mode.

I have a few similar time trigger based (hvac) automations in place and they all work flawlessly:

alias: Set Morning Thermostat to 76f
description: ''
trigger:
  - platform: time
    at: "07:00:00"
  condition:
    - condition: template
      value_template: >
        {{ is_state('climate.main_house_ac', 'heat') }}
  action:
    - service: climate.set_temperature
      data:
        entity_id: climate.main_house_ac
        temperature: 76
        hvac_mode: heat
  mode: single

Service states are:

hvac_modes:
  - 'off'
  - heat
  - dry
  - cool
  - fan_only
  - heat_cool

Am I not able to specify one as a condition?

I basically only want to change the thermostat temperature if the Heating is already on, not if it’s off.

See above.

I went to try this but got “Message malformed: required key not provided @ data[‘action’]”

I fortgot the quotes around the alias. This should work:

  alias: 'Set Morning Thermostat to 76f'
  trigger:
  - platform: time
    at: "07:00:00"
  condition:
    - condition: template
      value_template: >
        {{ is_state('climate.main_house_ac', 'heat') }}
  action:
    - service: climate.set_temperature
      data:
        entity_id: climate.main_house_ac
        temperature: 76
        hvac_mode: heat
  mode: single

It did! Wonderful! thank you. Excellent!

Why must we use a value_template here and not just entity state?

I fought with these hvac automations some time ago and got it only working by using value_template.

Petro can answer you the technicals better I believe.

You can use a state, but you’re looking at the wrong attribute. Just as I assumed, hvac_modes is a list of all the available molds according to your attribute and the main state is heat.

Therefore, this is the condition you should have used:

- condition: state
  entity_id: climate.main_house_ac
  state: heat

@Tamsy is_state has no differences to the state condition checking the main state.

1 Like

Understood - thank you both - much appreciated.