Issue with Automation not triggering when conditions are met after trigger condition is met

Hi All, I’m a bit perplexed as to how I can fix this Automation issue - I have the below automation which works great when the conditions are all met and then the trigger condition is met.

However If im not home and the trigger condition is exceeded and then rerturn home making the conditions met, it doesnt fire. it’s very simple logic:

Trigger:
Downstairs thermostat temp exceeds 22c
Conditions:
Kilsyth villa away = off (in other words we are home)
Outside temp exceeds 25c
Rumpus room AC is not already on

Can anyone assist please?

- id: '1536901501240'
  alias: Downstairs AC & Fan - 25+ On
  trigger:
  - above: '22'
    entity_id: sensor.downstairs_thermostat_temperature
    platform: numeric_state
  condition:
  - condition: state
    entity_id: binary_sensor.kilsyth_villa_away
    state: 'off'
  - above: '25'
    condition: numeric_state
    entity_id: sensor.pws_temp_c
  - condition: state
    entity_id: climate.rumpus_room_air_con
    state: 'off'
  action:
  - data:
      entity_id: switch.lounge_fan_190
    service: switch.turn_on
  - data:
      entity_id: climate.rumpus_room_air_con
    service: climate.turn_on
  - data:
      entity_id: climate.rumpus_room_air_con
      operation_mode: cool
    service: climate.set_operation_mode
  - data:
      entity_id: climate.rumpus_room_air_con
      temperature: '23'
    service: climate.set_temperature

If you want the automation to trigger when you return home as well as on temperature, simply add both to the trigger block:

- id: '1536901501240'
  alias: Downstairs AC & Fan - 25+ On
  trigger:
  - platform: numeric_state
    entity_id: sensor.downstairs_thermostat_temperature
    above: '22'
  - platform: state
    entity_id: binary_sensor.kilsyth_villa_away
    to: 'off'

Your existing conditions and actions stay the same.

1 Like

Thank you, I’ll give that a try. :sunglasses:

So I tried your suggestion and it didnt trip at all yesterday despite my wife being home - is having 2 triggers an AND or OR scenario?

PS, I did reload automations after making the changes.

Triggers are OR logic.

ok thanks, I’ll see if it behaves today as it’s going to be hot again.

As written it should turn on when you actually arrive and it is above 22, or if you are already home and it goes above 22 due to the combination of triggers and conditions.

1 Like

Considering the Triggers are OR logic and the Conditions are AND logic, I’ve updated my Automation to use any one of 3 triggers and enhanced the conditions so any of the triggers can fire the Actions assuming all Conditions are met:

- id: '1536901501240'
  alias: Downstairs AC & Fan - 25+ On
  trigger:
  - above: '22'
    entity_id: sensor.downstairs_thermostat_temperature
    platform: numeric_state
  - entity_id: binary_sensor.kilsyth_villa_away
    platform: state
    to: 'off'
  - above: '25'
    entity_id: sensor.pws_temp_c
    platform: numeric_state
  condition:
  - condition: state
    entity_id: binary_sensor.kilsyth_villa_away
    state: 'off'
  - above: '25'
    condition: numeric_state
    entity_id: sensor.pws_temp_c
  - condition: state
    entity_id: climate.rumpus_room_air_con
    state: 'off'
  - above: '22'
    condition: numeric_state
    entity_id: sensor.downstairs_thermostat_temperature
  action:
  - data:
      entity_id: switch.lounge_fan_190
    service: switch.turn_on
  - data:
      entity_id: climate.rumpus_room_air_con
    service: climate.turn_on
  - data:
      entity_id: climate.rumpus_room_air_con
      operation_mode: cool
    service: climate.set_operation_mode
  - data:
      entity_id: climate.rumpus_room_air_con
      temperature: '23'
    service: climate.set_temperature

The above 22 trigger will never fire the automation because of the above 25 condition.

your '-'s should be on the platform, not the value… not sure if HA will work either way, but the docs suggest that this:

  trigger:
  - above: '22'
    entity_id: sensor.downstairs_thermostat_temperature
    platform: numeric_state

should be this:

  trigger:
  - platform: numeric_state
    entity_id: sensor.downstairs_thermostat_temperature
    above: '22'

…and so forth. Just another thing to tidy up :smile:

No it will work… the automation editor mangles everything but it works as he has it.

1 Like

It’s all working well now so Im happy - thanks for the help all, much appreciated. :sunglasses: