And Or Logic Verification

I want an automation that

  • Fires when one of several temperature sensors is below a value
  • Time is between 08:00 and 16:00
  • Someone is at home
    As far as I can tell there is no way to check if anyone is home other than to say Bill is home or Ted is home… If there is that would make things a little easier I guess

I just wanted to check the AND / OR logic I have is correct.
Triggers are OR? so if I specify multiple trigger the automation will fire on any of them?
Conditions are AND? If I add two conditions the automation will only fire if both conditions are met?

The OR condition type only applies to that condition so that is still AND with other conditions

I have this setup, does this achieve the above logic?

alias: House Temp - Day - Heat
description: ''
  - platform: numeric_state
    entity_id: sensor.temp6_temperature
    below: '19'
  - platform: numeric_state
    entity_id: sensor.kitchen_temperature
    below: '19'
  - condition: time
    after: '08:00'
    before: '16:00'
      - mon
      - tue
      - wed
      - thu
      - fri
  - condition: or
      - condition: zone
        entity_id: person.bill
        zone: zone.home
      - condition: zone
        entity_id: person.ted
        zone: zone.home
  - service: climate.set_temperature
      device_id: xxx
      temperature: 22
mode: single

Yes you have the logic correct.

You can create a group of your persons to create an “anyone home” entity. Worthwhile if you are going to do that OR condition a lot.

1 Like

This wasn’t quite true

The temperature triggers are only fired when the sensor first goes below the specified value. So in this case the temperature would drop overnight and trigger the automation but it would get stopped because of the time condition. It wouldn’t get triggered again at 8am even thought the temperature was less than 19C.

Adding a time based trigger to ensure it always triggers at 8am (and conditions on the temperatures to only fire if any are < 19) sorted that

That is all you asked me to check. So that is all I checked.

1 Like

agreed :grin: just adding this in case someone comes across this while searching

1 Like