Home Automation - Double Trigger, how does it work?

Hi there … new to HA and using it to control my Carrier Inifinty Thermostats (thanks @MizterB !).

I think I have it working pretty good… bu want to make sure this automation makes sense.

In short, if either the “2Master Masterbed Thermostat Motion” has not detected motion for 1 hour, and “2Master Hallway” has not detected motion for at least 30 minutes, the thermostat mode will change to away.

Will the below achieve that? Or if “2Hallway Motion” doesn’t see motion for 30 minutes will it ignore the other condition that “2MasterBedroom Motion” must have also not seen motion for 1 hour?

alias: Thermostat - 2Master Motion (Away Mode)
description: ''
trigger:
  - type: no_motion
    platform: device
    device_id: XXXXXX
    entity_id: >-
      binary_sensor.2masterbed_thermostat_motion
    domain: binary_sensor
    for:
      hours: 1
      minutes: 0
      seconds: 0
      milliseconds: 0
  - type: motion
    platform: device
    device_id: XXXXX
    entity_id: binary_sensor.2hallway_motion
    domain: binary_sensor
    for:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
condition:
  - condition: state
    entity_id: climate.master_bedroom
    state: home
    attribute: current_activity
action:
  - service: climate.set_preset_mode
    data:
      preset_mode: Away
    target:
      entity_id: climate.master_bedroom
mode: single
max: 10

No.

Triggers are OR logic. So if either of the devices detect no motion the automation will run and then check the condition.

If you want AND logic (both sensors detecting no motion) you need to add them as conditions as well as triggers. Conditions are AND logic by default.

Got it - I see I can also do it from the visual editor. Apologize for the newbie question.

I guess you wrote this via the UI? It does tend to be a bit verbose. Assuming you meant type: no_motion for the hallway sensor, this does exactly the same job and is a lot easier to read:

trigger:
  - platform: state
    entity_id: binary_sensor.2masterbed_thermostat_motion
    to: 'off'
    for:
      hours: 1
  - platform: state
    entity_id: binary_sensor.2hallway_motion
    to: 'off'
    for:
      minutes: 30