Automation exits on HVAC mode condition. Not sure what I'm doing wrong

I’m trying to create automations that will turn my HVAC off/on when certain sensors are opened or closed. I want them only to run if my thermostat (ecobee) is not in the correct mode (off or heat_cool).

When I check the trace, the automation always exits on the HVAC condition, even when I know it should return true, so I’m not sure what’s going on. My YAML is below. Can anyone help me troubleshoot or point me in the right direction?

alias: Windows Closed HVAC on
description: ''
trigger:
  - platform: time_pattern
    minutes: /1
condition:
  - type: is_not_open
    condition: device
    device_id: 529dd4d59a9c66ee2ca96c07d3a41021
    entity_id: binary_sensor.charlie_s_window_contact
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 0
  - type: is_not_open
    condition: device
    device_id: ec16daa67346ac0664594ab298013a9b
    entity_id: binary_sensor.deck_door_contact
    domain: binary_sensor
  - condition: device
    device_id: 0213df140a83068f8247b3f9996c1816
    domain: climate
    entity_id: climate.main_floor
    type: is_hvac_mode
    hvac_mode: 'off'
action:
  - device_id: 0213df140a83068f8247b3f9996c1816
    domain: climate
    entity_id: climate.main_floor
    type: set_hvac_mode
    hvac_mode: heat_cool
  - device_id: 3b854cad9aa475bafde5027e69ef2d87
    domain: mobile_app
    type: notify
    title: HVAC is on
    message: Windows Closed
mode: single

Can anyone help me with this? Should I be asking somewhere else?

I could be incorrect, but this seems like an automation not a blueprint. So that might be why your post hasn’t got much traction since it could be in the wrong section.

As far as the automation is concerned, it looks correct since it was made via UI. I don’t have much experience with the ‘device’ conditions. I would try a state condition to see if it gives the same error.

  - condition: state
    entity_id: climate.main_floor
    state: 'off'
1 Like

I can confirm that I never bothered to read this topic because it claims to be about a blueprint (and I have little interest in them). However, it’s actually about an automation, not a blueprint. I recommend you correct the topic’s title and remove the Blueprints category.

The condition requires that the window and door must be closed and the thermostat must be off. Is that the combination you want?

Apologies for not categorizing this properly and thanks to those who have responded.

@123 You are correct that the condition is that the window and door must be closed and the thermostat off for the automation to execute. Even with HVAC off, traces show that the condition is evaluated as false and the automation exits without executing.

Yeah, puzzled by that one as well.
Device Conditions | Home Assistant Developer Docs (home-assistant.io) says it’s integration-specific, but the ecobee doc doesn’t mention it.

@knalbone Are you sure that part is working any way? How did you find out that condition?

Try this version:

alias: Windows Closed HVAC on
description: ''
trigger:
  - platform: state
    entity_id: 
      - binary_sensor.charlie_s_window_contact
      - binary_sensor.deck_door_contact
      - climate.main_floor
    to: 'off'
condition:
  - "{{ is_state('binary_sensor.charlie_s_window_contact', 'off' }}"
  - "{{ is_state('binary_sensor.deck_door_contact', 'off' }}"
  - "{{ is_state('climate.main_floor', 'off' }}"
action:
  - service: climate.set_hvac_mode
    target:
      entity_id: climate.main_floor
    data:
      hvac_mode: heat_cool
  - device_id: 3b854cad9aa475bafde5027e69ef2d87
    domain: mobile_app
    type: notify
    title: HVAC is on
    message: Windows Closed
mode: single