Choose action default conditions

So, i’m going through and streamlining some old automations, and using the choose option where I can.

But, it isnt clear about the conditions, when you add them are they an AND condition? or an OR condition?

Here is an example (it was build in the UI, but posting the code here):

- id: '1692249020592'
  alias: test automation
  description: ''
  trigger:
  - type: motion
    platform: device
    device_id: 6c2ac656b63251a0b6c853053a827349
    entity_id: 46426aefe658f335a7b857dfd41a45e3
    domain: binary_sensor
    id: east
  - type: motion
    platform: device
    device_id: 5c67352aad16acbd11caec817c5451f9
    entity_id: a3de15d9e1d39d50cf3d5b6ad0e22bff
    domain: binary_sensor
    id: west
  condition: []
  action:
  - choose:
    - conditions:
      - condition: trigger
        id:
        - east
      - condition: numeric_state
        entity_id: sensor.motion_hallway_east_illuminance_lux
        below: 20
      sequence: []
  mode: single

Here it is in the UI:

In the above example, i want if the motion is triggered (trigger id is “east”) AND if the lux is below 20. Some others I have written i have added the AND function, but I want to know if that is necessary or not.

Conditions are AND logic by default. Second paragraph here: Conditions - Home Assistant It applies to everywhere conditions are used.

So not it is not necessary to explicitly use an AND condition if that is all you want. It is needed when you want something like:

(A and B) or (C and D)

- condition: or
  conditions: 
    - condition: and
      conditions:
        - condition: a
        - condition: b
    - condition: and
      conditions:
        - condition: c
        - condition: d
1 Like

Thanks Tom, wasnt clear to me, so thank you.

1 Like