Turn on light, switch, scene, script or group based on motion, illuminance, sun (+ more conditions)

Good evening, the script works perfectly, I would like to have the light switched on via a door contact and if no movement was detected for a period of 5 minutes, switch the light off again. Maybe someone can help me

Just use the door sensor as the motion sensor entity.
Otherwise just use the blueprint as described, it will work if the door sensor state = ‘on’ when the door is open :slight_smile:

1 Like

Hey, i use this automation to trigger two scripts that call rest commands. One as the turn on entity and one as the turn off entity.Any ideas how I can wrap these scripts in some entity so that the turn off wait time will work?

Indeed, my apologies (RTFM). It’s now up and running in the correct way.

I created two automations with it: one for a Xiaomi based motion sensor, the other with a Lidl sensor.

The Xiaomi based sensor works well with the script; the Lidl one (which has no Illuminance) doesn’t trigger the script. I created different Helpers to check if that is the case ( I wanted different settings), but it didn’t help so far.

Am I doing something wrong?

Hmmm, again I know the answer. Just import the latest Blueprint, delete the old one. Everything works what I want to achieve.

1 Like

Hello I have a question.
I want to use this blueprint to toggle my lighswitch with a motion sensor.
I want that the light is turned off after 2mins, I used 2 as InputNumber.
But the switch is tunred off after 1,30 mins. It tunes off after the motion sensor change to state clear.

I hope you can help me

I’ve got a feature request. At night I prefer to have the lights a little bit less bright.

Could you add a brightness parameter to turning on the lights?
And optionally… a second brightness between specific times. But I could work around this by creating 2 blueprint automations I guess

Can you add conditions for sunrise and sunset?

If you want to trigger script A as the turn on entity and script B as the turn off entity, you could do this:

  • Simply set script A as turn on entity
  • Define a input_boolean value, called ‘script B trigger’ or something.
  • Create an automation that triggers on the input_boolean turning off, which has an action to run script B.

I dont know if this effort is worth your while just to be able to use this blueprint, but I’ll let you be the judge of that :wink:

Have you created an input_number entity like described in the first post? Or have you entered a hardcoded value in the blueprint? Please read the first post again.

Do do this, you can define a scene for the light(s) with a specific brightness you want, and use this scene as the target entity.

Indeed, you can create 2 automations with different time limits (and different target entity scenes) to do this.

Well I don’t really see the point in that… you either want to control your lights based on illuminance levels or by sunstate right? Or am I overlooking some usecase?

I want that light turns on motion sensors, but only after sunset and before sunrise.

Hi, first of all, thank you for all the effort you’ve put into this Blueprint.
I probably have a noob question but I was wondering the Following:
my setup is pretty basic: Activate a scene(since I want to dim my light) by motion and auto turn the
target entity off. My Yaml file looks like this.

- id: '1612558178556'
  alias: Turn on light, switch, scene, script or group based on motion and illuminance.
  description: ''
  use_blueprint:
    path: freakshock88/motion_illuminance_activated_entity.yaml
    input:
      motion_sensor: binary_sensor.shenzhen_neo_electronics_co_ltd_battery_powered_pir_sensor_v2_sensor_5
      target_entity: scene.badkamer_snachts
      target_off_entity: light.badkamer
      no_motion_wait: input_number.badkamer_wait_time

Unfortunately the light does not turn off automatically.
any idea where this is going wrong?

Thanks in advance!

I think there’s other blueprints available to suit that purpose, this one supports illuminance conditions.
I don’t want to make an overcomplicated blueprint that ‘does-it-all’, that would be unmaintanable.

Your automation looks good. What’s the value of input_number.badkamer_wait_time? Perhaps you expect the value to be in seconds? It is actually the amount of wait time in minutes.
I’ll try to make that more clear in the docs.

Thank you for your reply.
In the helper I’ve set the slider to 5.
I’ve figured it out in the Yaml code that it’s in minutes but unfortunately also this didn’t work.

You can imagine I’m a bit lost😊
Nevertheless, I believe this blueprint has great potential for me.

Thanks again for your efforts :+1:t2:

Xiaomi Gateway light does not turn on, most likely due to the fact that he also needs to specify the brightness and color of the lamp. How to do it?

   data_template:
     brightness_pct: 60
     rgb_color: [169, 153, 255]

Working perfect for me. Thank you. :+1:

Blueprint is working great. The only issue I am having is more a logic one. I am using in the main area of the house. When we come down in the morning it is dark and the lights come on. But then they never go off as the room stays “active” regardless how bright is eventually gets. Could be for any part of the day if its rainy and dark then lights still are on but there would always be motion to keep the lights active.