I can’t get my time triggered automations to run with conditions. While experimenting, I came across device and state conditions. I’m not sure which I should use, and I’m not sure what I’m doing wrong.
The docs at [1] don’t seem to describe device conditions. Is that somewhere else?
My goal is: if the thermostat has the heat turned on turn the heat down at night.
Controlling the thermostat without a condition works. Running time triggered automation without a condition works. So it’s only the combination that’s a problem.
Here’s the two approaches that I’ve tried.
Device based:
alias: time test device
description: testing time trigger with condition
trigger:
- platform: time
at: '12:30'
condition:
- condition: device
device_id: 634e0a3a87b5973085df54cd90feaf39
domain: climate
entity_id: climate.centralite_pearl_fan_thermostat
type: is_hvac_mode
hvac_mode: heat
action:
- service: notify.email
data:
title: test time trigger w/device condition
message: it worked
mode: single
State based:
alias: time test state
description: testing time trigger with condition
trigger:
- platform: time
at: '12:30'
condition:
- condition: state
entity_id: climate.centralite_pearl_fan_thermostat
attribute: hvac_modes
state: Heat
action:
- service: notify.email
data:
title: test time trigger w/state condition
message: it worked
mode: single
Hi there I would recommend the state condition but the issue that I am seeing is the attribute. You are using.
hvac_modes should be an attribute that list the available hvac modes with the machine. While hvac_mode should be the one which shows what is the current hvac mode. Also these tend to be case sensitive. Mostly the hvac mode would be shown in small caps. You can check these within the states tab of the developer console. If you need any more help please share the screenshot of the entity from the states tab of the developer console.
alias: time test state
description: testing time trigger with condition
trigger:
- platform: time
at: "12:30"
condition:
- condition: template
value_template: >
{{ is_state('climate.centralite_pearl_fan_thermostat', 'heat') }}
action:
- service: notify.email
data:
title: test time trigger w/state condition
message: it worked
mode: single
Also note the double quotes (") around the time-trigger
The state indicates which HVAC mode is currently in effect (such as auto, heat, cool, off).
The hvac_modes attribute is a list of all the modes supported by your HVAC system (such as auto, heat, cool, off).
The hvac_action attribute indicates which HVAC action your system is currently performing (such as idle, heating, cooling).
Thanks, this is exactly what I needed - the state-based condition needs to have the attribute removed, and the capitalization corrected (I had been trying both, but lower works).