AND / OR logic help needed

I need help please with the following automation logic. I am a programmer so in code logic this is what I need to resolve with an automation script :

if (a=1 and b=1 and c=1) or (x=1) then
switch on the light
in other words I need THREE conditions ALL to be true OR ONE other condition to be true.
For the life of me I cannot resolve it use the visual or the YAML editor

can anyone assist?

thanks,
Nicholas

The first step is to create a OR block where you add the one condition and add to that same OR block an AND block with the three other conditions:

description: ""
mode: single
trigger: []
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: ""
        state: ""
      - condition: and
        conditions:
          - condition: state
            entity_id: ""
            state: ""
          - condition: state
            entity_id: ""
            state: ""
          - condition: state
            entity_id: ""
            state: ""
action: []
1 Like
trigger:
  - platform: state
    entity_id:
      - switch.a
      - switch.b
      - switch.c
      - switch.x
    to: 'on'
condition:
  - or:
    - condition: state
      entity_id:
        - switch.a
        - switch.b
        - switch.c
      state: 'on'
    - condition: state
      entity_id:
        - switch.x
      state: 'on'
action:
  - service: light.turn_on
    target:
      entity_id: light.your_light
2 Likes

Thanks SOO much!! Immediately this resolved the problem!