Bedroom light automation

Hey,
I´m trying to improve my light control in my bedroom.

- alias: AUTO ON (MOTION) master_bedroom-light
    trigger:
    platform: state
    entity_id: binary_sensor.master_bedroom_motion
    from: 'off'
    to: 'on'
  condition:
    condition: and
    conditions:
      - condition: numeric_state
        entity_id: sensor.master_bedroom_lux
        below: 10000 
      - condition: state
        entity_id: light.master_bedroom
        state: 'off'
        for: 
          minutes: 1 
  action:
    service: homeassistant.turn_on
    data_template:
      entity_id: >
        {% set hour=states("sensor.time").split(':')[0] | int %}
        {%- if hour >= 19 or hour < 6  -%}
          scene.master_bedroom_relax
        {%- elif hour >= 6 or hour <9  -%}
         scene.master_bedroom_read
        {%- else -%}
          scene.master_bedroom_see
        {%- endif %}s

This works OK. But I have another automation for the “off-turning” part

- alias: Bedroom_motion_off
  trigger:
    platform: state
    entity_id: binary_sensor.master_bedroom_motion
    to: 'off'
    for:
      minutes: 4
  action:
    service: homeassistant.turn_off
    entity_id: 
      - scene.master_bedroom_see
      - scene.master_bedroom_relax
      - scene.master_bedroom_read
     -  scene.master_bedroom_dim

So this one dosent work.
I don´t want that this automation turns every light off… So if i manually turn a light on, it would be great if this automations doesn´t turn it off.
Is there a way that my off turning automation just turn the scene off ?

I have found this handy:

1 Like