Simple automation to swtich HVAC of a fan from heat to cool - not working

Hi all,

I have a simple automation that switches the HVAC mode of a fan to cool (if its in heat) when motion is not detected for more than 45 in that room. It doesn’t seem to work though as the automation never gets triggered (says never for last run). Here’s the code:

alias: Change Basement Dyson Fan to Cool From Heat when no one is Present
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.basement_motion_detector
    from: 'on'
    to: 'off'
    for:
      hours: 0
      minutes: 45
      seconds: 0
condition:
  - condition: device
    device_id: 7b6ed082b252bd9cd1737754248
    domain: climate
    entity_id: climate.pure_hot_cool
    type: is_hvac_mode
    hvac_mode: heat
action:
  - device_id: 7b6ed082b252bd9cd1737754248
    domain: climate
    entity_id: climate.pure_hot_cool
    type: set_hvac_mode
    hvac_mode: cool
mode: single

and heres a typical history of the the motion detector.

I don’t seen any errors in the logs.

I think the ‘on’, ‘off’ states should be true, false

    entity_id: binary_sensor.basement_motion_detector
    from: true 
    to: false
1 Like

oh, interesting! never tought of that one.

I’ll give this a try thanks!

ok, turns out it is indeed ‘on’ to ‘off’ BUT even then, it didnt work as planned.

However, thanks to @Didgeridrew for help with this one, with an an external timer helper, this automations works exactly as intended!

See below

alias: Change Basement Dyson Fan to Cool From Heat when no one is Present
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.basement_motion_detector
    from: 'on'
    to: 'off'
    id: no motion
  - platform: state
    entity_id: timer.basement_motion
    id: timer
    from: active
    to: idle
condition:
  - condition: device
    device_id: 7b6ed082b25d9cd1737754248
    domain: climate
    entity_id: climate.pure_hot_cool
    type: is_hvac_mode
    hvac_mode: heat
action:
  - choose:
      - conditions:
          - condition: trigger
            id: timer
        sequence:
          - device_id: 7b6ed082b25d9cd1737754248
            domain: climate
            entity_id: climate.pure_hot_cool
            type: set_hvac_mode
            hvac_mode: cool
      - conditions:
          - condition: trigger
            id: no motion
        sequence:
          - service: timer.start
            target:
              entity_id: timer.basement_motion
            data: {}
mode: single