Problems with switching light scenes with the motion sensor

Good morning everyone,

I’ve been trying to create various automations with the Home Assistant for two weeks now - the results are sometimes better sometimes worse but I’m making progress.

But with one problem I can’t get any further since a few days.

I have searched several HA forums, but have not found anything useful for me.

And here is my task, which I always fail until now:

I have an open living room with a kitchen in one room. I call it living room.

Here I have two motion detectors (BWM).

From sunset to 23.00 the living room (also kitchen) is illuminated with a cozy scene. This scene is not static, but, which is dimmed with dimmer up, or down - depending on mood and need.

There are 4 lamps in the living room and three lamps in the kitchen.

The BWM in the living room is switched off during this time.

The BWM in the kitchen is active. If someone has something to do in the kitchen, the kitchen should be lit brighter with its three lamps.

My problem is, when there is no more movement in the kitchen, these three lamps in the kitchen, should not be switched off, but these lamps should return to their original state.

What could be done here? Please give me some advice.

And two more questions;

  1. how I can define the BWM its active working time between fixed time and sun state?
  2. if I can control the BWM with light conditions during the day, is it brighter in the room, less light, is it darker in the room (cloudy) more light?

I hope for your support and thank you very much in advance

Best regards

You could use a temporary scene to capture the state of the lights and then return to those values rather than turning off the kitchen lights.

Take a look at this video and skip forward to 7 mins 55 seconds:-

Or if the use case is simpler (for instance its only a single switch you want returned to its original state for example), then you could save its state into a variable first:

alias: Top Floor Bathroom - Turn on with humidity level
description: ""
variables:
  previous_light_state: "{{ states('light.lumi_lumi_switch_b1nc01_light') }}"
trigger:
  - platform: state
    entity_id:
      - sensor.lumi_lumi_weather_humidity

Then later on, set the device back to that value, for example:

      - service: homeassistant.turn_{{previous_light_state}}
        data: {}
        target:
          entity_id: light.lumi_lumi_switch_b1nc01_light

And finally, you might not need to create a dynamic scene if you would rather set the lights back to a known scene, just do that instead.

first thank you for quick tip, I will try it tomorrow