Where is my mistake?

Hello
I have three automations that work perfectly in my office, is it possible to mix them so that only one of them performs the same tasks?
thanks in advance for any help

First :

Second :

second

Third

The one that doesn’t work

Always provide your yaml instead of photos of it. It makes things easier for us to troubleshoot. :slight_smile:

Try this for your part that doesn’t work:

alias: Automatisation Consolidée Bureau & Chambre
description: Combinaison des trois automatisations. 
triggers:
  - id: occupation_detectee
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    domain: binary_sensor
    entity_id: 7fcf9dc9e6007d28243d6776df0b5052
    type: occupied
    for:
      hours: 0
      minutes: 0
      seconds: 10
  - id: non_occupation
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    domain: binary_sensor
    entity_id: 110ffecb9b8c6459c7e8a1d86e6d8865
    type: not occupied
    for:
      hours: 0
      minutes: 10
      seconds: 0
  - id: niveau_lumiere_eleve
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    domain: sensor
    entity_id: a937537010d3649534b07b6e080a1517
    type: illuminance
    above: 60
conditions:
  - condition: device
    type: is_illuminance
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    entity_id: a937537010d3649534b07b6e080a1517
    domain: sensor
    below: 50
    enabled: false
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: occupation_detectee
          - condition: device
            type: is_illuminance
            device_id: d36a984cb6f3948b45901fb5ac575e4b
            entity_id: a937537010d3649534b07b6e080a1517
            domain: sensor
            below: 50
        sequence:
          - service: light.turn_on
            target:
              device_id: 87955de78f5daaaeeeb309bebc622c66
            data: {}
      - conditions:
          - condition: trigger
            id: non_occupation
        sequence:
          - service: light.turn_off
            target:
              device_id:
                - 87955de78f5daaaeeeb309bebc622c66
                - d5d78629ea56a6a574263ce57cc98deb
                - 3e5733fcaead5480c0933c283be56880
            data: {}
      - conditions:
          - condition: trigger
            id: niveau_lumiere_eleve
        sequence:
          - service: light.turn_off
            target:
              device_id: 87955de78f5daaaeeeb309bebc622c66
            data: {}
mode: single

Since the code is hard to read like that I can not comment on your exact usage, But I would think having the automations save a state to a helper or something and have the automations check the helper to see where the state is or which automation is running\run

For anyone else who wishes to troubleshoot. Here’s the YAML - Part 1:

alias: allumer bureau
description: ""
triggers:
  - type: occupied
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    entity_id: 7fcf9dc9e6007d28243d6776df0b5052
    domain: binary_sensor
    trigger: device
    for:
      hours: 0
      minutes: 0
      seconds: 10
conditions:
  - type: is_illuminance
    condition: device
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    entity_id: a937537010d3649534b07b6e080a1517
    domain: sensor
    below: 50
actions:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
    device_id: 87955de78f5daaaeeeb309bebc622c66
mode: single

Part 2:

alias: éteindre bureau par forte luminosité
description: ""
triggers:
type: illuminance
device_id:
entity_id:
  - d36a984cb6f3948b45901fb5ac575e4b
  - a937537010d3649534b07b6e080a1517
domain: sensor
trigger: device
above: 60
conditions: []
actions:
- action: light.turn_off
metadata: {}
data: {}
target:
  device_id: 87955de78f5daaaeeeb309bebc622c66
mode: single

Part 3:

alias: Extinction Chambre Pierre
description:
triggers:
  - type: not occupied
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    entity_id: 110ffecb9b8c6459c7e8a1d86e6d8865
    domain: binary_sensor
    trigger: device
    for:
      hours: 0
      minutes: 10
      seconds: 0
conditions: []
actions:
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      device_id:
        - 87955de78f5daaaeeeb309bebc622c66
        - d5d78629ea56a6a574263ce57cc98deb
        - 3e5733fcaead5480c0933c283be56880
mode: single

Part 4:

alias: Automatisation Consolidée Bureau & Chambre
description: Combinaison des trois automatisations. 
triggers:
  - device_id: d36a984cb6f3948b45901fb5ac575e4b
    domain: binary_sensor
    entity_id: 7fcf9dc9e6007d28243d6776df0b5052
    type: occupied
    for:
      hours: 0
      minutes: 0
      seconds: 10
    trigger: device
  - device_id: d36a984cb6f3948b45901fb5ac575e4b
    domain: binary_sensor
    entity_id: 110ffecb9b8c6459c7e8a1d86e6d8865
    type: not occupied
    for:
      hours: 0
      minutes: 10
      seconds: 0
    trigger: device
  - device_id: d36a984cb6f3948b45901fb5ac575e4b
    domain: sensor
    entity_id: a937537010d3649534b07b6e080a1517
    type: illuminance
    above: 60
    trigger: device
conditions:
  - condition: device
    type: is_illuminance
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    entity_id: a937537010d3649534b07b6e080a1517
    domain: sensor
    below: 50
    enabled: false
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: occupation_detectee
          - condition: device
            type: is_illuminance
            device_id: d36a984cb6f3948b45901fb5ac575e4b
            entity_id: a937537010d3649534b07b6e080a1517
            domain: sensor
            below: 50
        sequence:
          - target:
              - device_id: 87955de78f5daaaeeeb309bebc622c66
            action: light.turn_on
            data: {}
      - conditions:
          - condition: trigger
            id: non_occupation
        sequence:
          - target:
              device_id:
                - 87955de78f5daaaeeeb309bebc622c66
                - d5d78629ea56a6a574263ce57cc98deb
                - 3e5733fcaead5480c0933c283be56880
            action: light.turn_off
            data: {}
          - conditions:
              - condition: trigger
                id: niveau_lumiere_eleve
            sequence:
              - target:
                  device_id: 87955de78f5daaaeeeb309bebc622c66
                action: light.turn_off
                data: {}
mode: single

Hi Pierre,

Well that trigger cannot happen for sure if you enable that confition. Can’t be above 60 and below 50…

THEN…

The triggers have no ID;s designated.

I merely copied what the OP had in his… I don’t know what the devices are or what they are doing/what they are trying to accomplish.

Sorry ColtonTTZ, replied wrong…
Thanks for pulling that stuff over for them.
@Bienvu

a big thank you for your help, the different tracks allowed me to solve my problem.
I attach the corrected YAML file

- id: '1732223668791'
  alias: allumer bureau
  description: ''
  triggers:
  - type: occupied
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    entity_id: 7fcf9dc9e6007d28243d6776df0b5052
    domain: binary_sensor
    trigger: device
    for:
      hours: 0
      minutes: 0
      seconds: 10
  conditions:
  - type: is_illuminance
    condition: device
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    entity_id: a937537010d3649534b07b6e080a1517
    domain: sensor
    below: 50
  actions:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      device_id: 87955de78f5daaaeeeb309bebc622c66
  mode: single
- id: '1732223891629'
  alias: éteindre bureau par forte luminosité
  description: ''
  triggers:
  - type: illuminance
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    entity_id: a937537010d3649534b07b6e080a1517
    domain: sensor
    trigger: device
    above: 60
  conditions: []
  actions:
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      device_id: 87955de78f5daaaeeeb309bebc622c66
  mode: single
- id: '1732224240658'
  alias: Extinction Chambre Pierre
  description: ''
  triggers:
  - type: not_occupied
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    entity_id: 110ffecb9b8c6459c7e8a1d86e6d8865
    domain: binary_sensor
    trigger: device
    for:
      hours: 0
      minutes: 10
      seconds: 0
  conditions: []
  actions:
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      device_id:
      - 87955de78f5daaaeeeb309bebc622c66
      - d5d78629ea56a6a574263ce57cc98deb
      - 3e5733fcaead5480c0933c283be56880
  mode: single
- id: '1732289781921'
  alias: Automatisation Consolidée Bureau & Chambre
  description: Combinaison des trois automatisations.
  triggers:
  - id: occupation_detectee
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    domain: binary_sensor
    entity_id: 7fcf9dc9e6007d28243d6776df0b5052
    type: occupied
    for:
      hours: 0
      minutes: 0
      seconds: 10
    trigger: device
  - id: non_occupation
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    domain: binary_sensor
    entity_id: 110ffecb9b8c6459c7e8a1d86e6d8865
    type: not_occupied
    for:
      hours: 0
      minutes: 10
      seconds: 0
    trigger: device
  - id: niveau_lumiere_eleve
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    domain: sensor
    entity_id: a937537010d3649534b07b6e080a1517
    type: illuminance
    above: 60
    trigger: device
  conditions:
  - condition: device
    type: is_illuminance
    device_id: d36a984cb6f3948b45901fb5ac575e4b
    entity_id: a937537010d3649534b07b6e080a1517
    domain: sensor
    below: 50
    enabled: false
  actions:
  - choose:
    - conditions:
      - condition: trigger
        id: occupation_detectee
      - condition: device
        type: is_illuminance
        device_id: d36a984cb6f3948b45901fb5ac575e4b
        entity_id: a937537010d3649534b07b6e080a1517
        domain: sensor
        below: 50
      sequence:
      - target:
          device_id: 87955de78f5daaaeeeb309bebc622c66
        action: light.turn_on
        data: {}
    - conditions:
      - condition: trigger
        id: non_occupation
      sequence:
      - target:
          device_id:
          - 87955de78f5daaaeeeb309bebc622c66
          - d5d78629ea56a6a574263ce57cc98deb
          - 3e5733fcaead5480c0933c283be56880
        action: light.turn_off
        data: {}
    - conditions:
      - condition: trigger
        id: niveau_lumiere_eleve
      sequence:
      - target:
          device_id: 87955de78f5daaaeeeb309bebc622c66
        action: light.turn_off
        data: {}
  mode: restart