I am testing a simple automation that should detect if one AC unit has been in cooling mode for more that 2 minutes before 9:45 PM. If so, I want the automation to turn off the AC unit. Here is the automation:
alias: Turn AC Off If Running Before 9:45 PM
description: Before 9:45 PM
trigger:
- platform: state
entity_id: climate.family_room
to: cool
attribute: hvac_modes
for: '00:02:00'
id: '1'
condition:
- condition: time
before: '21:45:00'
action:
- service: climate.turn_off
data: {}
target:
entity_id:
- climate.family_room
mode: single
trigger:
- platform: state
entity_id: climate.family_room
to: cool
for: '00:02:00'
Try removing the attribute of hvac_mode. The hvac mode just displays the available mode that your climate entity has - thus it does not change. You want state change trigger.
See your climate entity in Developer Tools like below. Notice that when it is in cool mode, it is reflected in the state of the entity-