Need help mixing AND and OR in automation

I have this automation :

 - id: 'LuceTerrazzoONPortaSala'
  alias: Luce Terrazzo ON PortaSala 
  initial_state: true
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d0001bf93b7
    to: 'on'
  condition:
      condition: or
      conditions:
        - condition: sun
          after: sunset
          after_offset : "-00:30:00"
        - condition: sun
          before: sunrise
          before_offset : "00:30:00"
  action:
    - service: light.turn_on
      data:
        entity_id: light.luce_terrazzo
        brightness: 254
        color_temp: 300

Basically is “turn on the terrace light, full white on, during the night hours if I open the door”

I need to add this condition : “but don’t do it if the other door sensor is ON”.

So, I need (NIGHT_HOUR_1 OR NIGHT_HOUR_2) AND (DOOR SENSOR IS OFF)

Can someone help me with the syntax, please?

There may very well be a “cleaner” way to do this, but here is what I’ve done for similar situations:

- id: 'LuceTerrazzoONPortaSala'
  alias: Luce Terrazzo ON PortaSala 
  initial_state: true
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d0001bf93b7
    to: 'on'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: binary_sensor.door
        state: 'off'
      - condition: or
        conditions:
          - condition: sun
            after: sunset
            after_offset : "-00:30:00"
          - condition: sun
            before: sunrise
            before_offset : "00:30:00"
  action:
    - service: light.turn_on
      data:
        entity_id: light.luce_terrazzo
        brightness: 254
        color_temp: 300

Just did a quick check and this is actually how the docs say to do it, so I’m actually doing things the recommended way for once LOL!

Thanks @Brett_C, I was too tired to dig into the docs!
(How lazy I am!!!) :innocent: