DIfferent automations with same trigger

I want to control 2 hue lights with a switch connected to a shelly 1. I use the binary sensor on/off from the shelly 1 as the trigger (the switch input from the shelly is detached fro the output relay). I want the lights to have a different brightness overday then overnight, herefore I created a day and night scene.
So I made 3 different automations with the same triggers but different conditions:

- id: '1591709584039'
  alias: schakelaar eetkamer dag aan
  description: ''
  trigger:
  - device_id: 7134c5268f7748818bb5667dcf1c61af
    domain: binary_sensor
    entity_id: binary_sensor.shelly_shsw_1_f394bc_switch
    platform: device
    type: turned_on
  - device_id: 7134c5268f7748818bb5667dcf1c61af
    domain: binary_sensor
    entity_id: binary_sensor.shelly_shsw_1_f394bc_switch
    platform: device
    type: turned_off
  condition:
  - condition: device
    device_id: 69a64803b3b048e2a17fc657771386fa
    domain: light
    entity_id: light.eetkamer_lamp_1
    type: is_off
  - condition: and
    conditions:
    - condition: device
      device_id: 5458656273f043d4baced937c2505b4c
      domain: light
      entity_id: light.eetkamer_lamp_2
      type: is_off
  - after: sunrise
    before: sunset
    condition: sun
  action:
  - scene: scene.eetkamer_dag
- id: '1591726413131'
  alias: schakelaar eetkamer uit
  description: ''
  trigger:
  - device_id: 7134c5268f7748818bb5667dcf1c61af
    domain: binary_sensor
    entity_id: binary_sensor.shelly_shsw_1_f394bc_switch
    platform: device
    type: turned_on
  - device_id: 7134c5268f7748818bb5667dcf1c61af
    domain: binary_sensor
    entity_id: binary_sensor.shelly_shsw_1_f394bc_switch
    platform: device
    type: turned_off
  condition:
  - condition: or
    conditions:
    - condition: device
      device_id: 69a64803b3b048e2a17fc657771386fa
      domain: light
      entity_id: light.eetkamer_lamp_1
      type: is_on
  - condition: or
    conditions:
    - condition: device
      device_id: 5458656273f043d4baced937c2505b4c
      domain: light
      entity_id: light.eetkamer_lamp_2
      type: is_on
  action:
  - device_id: 69a64803b3b048e2a17fc657771386fa
    domain: light
    entity_id: light.eetkamer_lamp_1
    type: turn_off
  - device_id: 5458656273f043d4baced937c2505b4c
    domain: light
    entity_id: light.eetkamer_lamp_2
    type: turn_off
- id: '1591726962429'
  alias: schakelaar eetkamer nacht
  description: ''
  trigger:
  - device_id: 7134c5268f7748818bb5667dcf1c61af
    domain: binary_sensor
    entity_id: binary_sensor.shelly_shsw_1_f394bc_switch
    platform: device
    type: turned_on
  - device_id: 7134c5268f7748818bb5667dcf1c61af
    domain: binary_sensor
    entity_id: binary_sensor.shelly_shsw_1_f394bc_switch
    platform: device
    type: turned_off
  condition:
  - condition: device
    device_id: 69a64803b3b048e2a17fc657771386fa
    domain: light
    entity_id: light.eetkamer_lamp_1
    type: is_off
  - condition: and
    conditions:
    - condition: device
      device_id: 5458656273f043d4baced937c2505b4c
      domain: light
      entity_id: light.eetkamer_lamp_2
      type: is_off
  - after: sunset
    before: sunrise
    condition: sun
  action:
  - scene: scene.eetkamer_nacht

Overday the automation works as expected. After sunset it does nothing. And the automation for switching off the lights only works when both lamps are on.
When I trigger the automations from the GUI they all work as expected.
What is going wrong?
Or can I only do this with scripts? (I am a homeassistant noob so I have no experience at all with scripts)

I suggest you consider replacing your Device Automations with the following automations.

- id: '1591709584039'
  alias: schakelaar eetkamer dag aan
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.shelly_shsw_1_f394bc_switch
    to: 'on'
  condition:
  - condition: template
    value_template: >
      {{ is_state('light.eetkamer_lamp_1', 'off') and is_state('light.eetkamer_lamp_2', 'off') }}
  - condition: state 
    entity_id: sun.sun
    state: 'above_horizon'
  action:
  - service: scene.turn_on
    entity_id: scene.eetkamer_dag


- id: '1591726413131'
  alias: schakelaar eetkamer uit
  description: ''
  trigger:
  - platform: device
    entity_id: binary_sensor.shelly_shsw_1_f394bc_switch
    to: 'off'
  condition:
  - condition: template
    value_template: >
      {{ is_state('light.eetkamer_lamp_1', 'on') or is_state('light.eetkamer_lamp_2', 'on') }}
  action:
  - service: light.turn_off
    entity_id: light.eetkamer_lamp_1, light.eetkamer_lamp_2

- id: '1591726962429'
  alias: schakelaar eetkamer nacht
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.shelly_shsw_1_f394bc_switch
    to: 'on'
  condition:
  - condition: template
    value_template: >
      {{ is_state('light.eetkamer_lamp_1', 'off') and is_state('light.eetkamer_lamp_2', 'off') }}
  - condition: state 
    entity_id: sun.sun
    state: 'below_horizon'
  action:
  - service: scene.turn_on
    entity_id: scene.eetkamer_nacht

NOTE
I’m unfamiliar with how Shelly switches are represented in Home Assistant. Are you certain the Shelly switches are modeled as binary_sensor entities? I would think they would appear as switch entities.

Thanks for the reply!
The shelly 1 has a switch (the relay output) and a binary_sensor (the physical switch input).
I tried your off automation but the behaviour is the same, when only one of the lights is on it does nothing.
Using only the on or off as a trigger makes you need to switch twice when the lights were toggled by the app or voice command.
The night on automation will be tested in some hours :wink:

The condition clearly uses a logical OR. If either lamp_1 or lamp_2 is on it proceeds to execute light.turn_off.

The issue is that all three automations are triggered by a single binary_sensor. What does this binary_sensor represent? If it represents lamp_1 shouldn’t the trigger also include the binary_sensor representing lamp_2?

Question for you: what determines the binary_sensor’s state?

A physical toggle switch that’s on the input of the shelly 1. When the shelly 1 has current on its input it’s on, otherwise it’s off.

The lights are hue lights and are totally independent of the switch.