Two automation in one need little help

Two automation for on and off. When PIR from node1 detect motion and microwave already detecting movement turn on RED LED and buzzer (and must stop one buzzing bip patern from before) on node1 and on node2 turn on GREEN LED and buzzer. This two scrip work good.

Automation On

- id: 'AutoOn'
  alias: Alarm On 
  description: ''
  trigger:
  - type: motion
    platform: device
    device_id: node1
    entity_id: binary_sensor.sensornode_pir
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 1
  condition:
  - type: is_motion
    condition: device
    device_id: node1
    entity_id: binary_sensor.sensornode_microwave
    domain: binary_sensor
  action:
  - type: turn_on
    device_id: node2
    entity_id: switch.micro_buzz
    domain: switch
  - type: turn_on
    device_id: node2
    entity_id: switch.green_led
    domain: switch
  - type: turn_off
    device_id: node1
    entity_id: switch.bip_patern
    domain: switch
  - type: turn_on
    device_id: node1
    entity_id: switch.biping
    domain: switch
- type: turn_on
    device_id: node1
    entity_id: switch.red_led
    domain: switch
  mode: single

Automation Off

- id: 'AutoOff'
  alias: Alarm Off 
  description: ''
  trigger:
  - type: no_motion
    platform: device
    device_id: nod1
    entity_id: binary_sensor.sensornode_pir
    domain: binary_sensor
  - type: no_motion
    platform: device
    device_id: nod1
    entity_id: binary_sensor.sensornode_microwave
    domain: binary_sensor
  condition: []
  action:
  - type: turn_off
    device_id: node2
    entity_id: switch.micro_buzz
    domain: switch
  - type: turn_off
    device_id: node2
    entity_id: switch.green_led
    domain: switch
  - type: turn_off
    device_id: node1
    entity_id: switch.biping
    domain: switch
- type: turn_off
    device_id: node1
    entity_id: switch.red_led
    domain: switch
  mode: single

Then I try On and Off in one automation

- id: 'autonation OnOff'
  alias: Alarm OnOff
  trigger:
  - platform: state
    entity_id: binary_sensor.sensornode_pir
    to: 'on'
    for: '00:00:01'
  - platform: state
    entity_id: binary_sensor.sensornode_pir
    to: 'off'
    for: '00:00:05'
  condition:
  - type: is_motion
    condition: device
    device_id: node1
    entity_id: binary_sensor.sensornode_microwave
    domain: binary_sensor
  action:
  - service: "switch.turn_{{ trigger.to_state.state }}"
    entity_id: switch.micro_buzz
  - service: "switch.turn_{{ trigger.to_state.state }}"
    entity_id: switch.green_led
  - service: "switch.turn_{{ trigger.to_state.state }}"
    entity_id: switch.red_led
  - type: turn_off
    device_id: node1
    entity_id: switch.bip_patern
    domain: switch
  - service: "switch.turn_{{ trigger.to_state.state }}"
    entity_id: switch.biping
  mode: single 

Buzzer on node1 is much shorter then on node2 and led on nodi 1 and 2 sometime dont go off.
Can you help? plz…

Use the debugging trace in Configuration / Automations to see why it does not do what you expect.

Probably the condition. PIR no movement and Microwave no movement won’t do any actions.

Yes I see but how to add two conditions. When PIR and Microwave dont have movment for let say 5 sec to put all Led and Buzzer off…

I try this with CONDITIONS but now LED and buzzer dont start at all where Im wrong?

- id: 'autonation OnOff'
  alias: Alarm OnOff
  trigger:
  - platform: state
    entity_id: binary_sensor.sensornode_pir
    to: 'on'
    for: '00:00:01'
  - platform: state
    entity_id: binary_sensor.sensornode_pir
    to: 'off'
    for: '00:00:05'
condition:
    condition: and
    conditions:
        - condition: state
          entity_id: binary_sensor.sensornode_microwave
          state: 'on'
        - condition: or
          conditions:
            - condition: state
              entity_id: binary_sensor.sensornode_microwave
              state: 'off'
            - condition: state
              entity_id: binary_sensor.sensornode_pir
              state: 'off'
  action:
  - service: "switch.turn_{{ trigger.to_state.state }}"
    entity_id: switch.micro_buzz
  - service: "switch.turn_{{ trigger.to_state.state }}"
    entity_id: switch.green_led
  - service: "switch.turn_{{ trigger.to_state.state }}"
    entity_id: switch.red_led
  - type: turn_off
    device_id: node1
    entity_id: switch.bip_patern
    domain: switch
  - service: "switch.turn_{{ trigger.to_state.state }}"
    entity_id: switch.biping
  mode: single 

Indentation of condition.

Also your conditions are odd: microwave must be on AND (microwave must be off OR PIR must be off) is the same as microwave must be on AND PIR must be off. Reduces to:

  condition:
    - condition: state
      entity_id: binary_sensor.sensornode_microwave
      state: 'on'
    - condition: state
      entity_id: binary_sensor.sensornode_pir
      state: 'off'