šŸ’” Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

Hi,
I currently have an automation that I would like to upgrade using this blueprint.

My current automation is triggered like this:

triggers:
  - trigger: state
    entity_id: event.zijdeur_beweging

However, I can not select this entity as a trigger in this blueprint, only binary sensors. Is there a workaround?

I tried creating a template binary sensor via the UI, but the blueprint automation does not seem to be triggered.


I want the light to come on between the hours noted, when motion detected and then turn off again after 2 minutes of no motion. Camera is Blink door bell, light is Phillips Hue through a Bridge.  

alias: Front door on/off
description: ā€œā€
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
motion_trigger:
- binary_sensor.front_door_motion
light_switch:
entity_id: light.downstairs_landing
time_delay: 2
include_light_control:
light_brightness: 60
after_time: ā€œ15:45:00ā€
before_time: ā€œ23:00:00ā€
include_time: time_enabled

Hi, thank your for your great work on this automation. Every time I look at the traces I thank my lucky stars I didnā€™t have to set all that up :sweat_smile:

I have an issue where two occupancy sensors control the same lights, through two different automation instances of this blueprint, since one is for when Iā€™m sitting at the dining table and one is for when Iā€™m on the sofa, and I want different lighting for both. I tried using the bypass feature to keep current lights when the other sensor is active in both automations, but that only seems to trigger both automations when one sensor detects movement. Am I doing something wrong or is this not the right approach to solve my issue? All I really want is for the light to not turn off if the other sensor is active, since otherwise the other automation activates due to the sensor detecting occupancy, and then the first sensor clears, causing the automation to turn off the lights.

Thanks again for responding. I attempted a script but itā€™s not working the way I want. Basically the blueprint turns on light A when motion is detected in the room and turn off after 5 mins of no motion. I attempted to write a script that said if light A is on, using the same motion sensor, wait 30 mins without motion to turn off light B.What is actually happening is only light A is turning off and B remains on. Should the script work with this logic? Iā€™m sure I have something configured incorrectly. In this scenario, B is being turned on manually by someone. Code below and this is tied to the blueprint under Scenes-Scripts to turn off. Do I need to use helpers to make this work correctly?

if:
  - condition: device
    type: is_on
    device_id: e36874622e3f77dd57e79f554fa9d2f4
    entity_id: 97c166a6ac585c5c4a6ce1121460b8b7
    domain: switch
  - type: is_no_motion
    condition: device
    device_id: e36874622e3f77dd57e79f554fa9d2f4
    entity_id: 24f5306d57fcb59a1e7d746d2232807e
    domain: binary_sensor
    for:
      hours: 0
      minutes: 30
      seconds: 0
then:
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.pool_bathroom_fan_2

Absolutely amazing work, thanks!

I do have a question I couldnā€™t find an answer to: is there an option to NOT change the brightness with dynamic lighting IF the light is already on?
What happens is, as an example, that the light turns on 1% in the middle of the night, and then I change it to letā€™s say 30%, and on the next motion sensorā€™s motion detection basically the automation runs again and changes it back to 1%. My time delay is set to 10 minutes and that happens within those 10 minutes. Any setting I missed to treat that?
Thanks!

@deliverer33

Sounds good, here is the code you will be looking for in your script. Once ceated add it into Scenes - Scripts To Turn OFF.

alias: New Script
sequence:
  - condition: state
    entity_id: switch.pool_bathroom_fan_2
    state: "on"
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.pool_bathroom_fan_2

If you would like a delay before you turn the fan OFF after the light A is OFF then this.

alias: New Script
sequence:
  - condition: state
    entity_id: switch.pool_bathroom_fan_2
    state: "on"
  - delay:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.pool_bathroom_fan_2

What happens is in the end of the blueprint automation it turns light A OFF, then it will run the script. The script says if light B (the fan) is ON then turn fan OFF. The second code I gave you just has a delay of 30 min.

Now I know it is a fan for your pool and your removing humidity I would look at my :shower: Bathroom Humidity Exhaust Fan and link it with the light automation. You will need a humidity sensor to turn the fan ON. In the :shower: Bathroom Humidity Exhaust Fan blueprint look at the FAQ and my set up. I think you will love it.

Blacky :smiley:

@esrauscht

Hi Sebastian, sorry I missed your last post. I normally respond to everyone, but sometimes I miss one, so thanks for asking again.

We canā€™t use the light in the bypass as when the automation turns the light ON it turns the bypass ON and then the automation will never turn the light OFF.

BUT

I do have a blueprint that if you manually turn the light ON (not the automation) it can turn the bypass ON so when the automation turns the light ON the automation will still turn it OFF. You use this blueprint to create a bypass and then use the bypass in the sensor light blueprint. I havenā€™t released this blueprint as of yet but if this is what you are looking for I can provide you a link so you can download the blueprint and test it out. Just let us know and I will set it up for you.

Blacky :smiley:

@DriesA

Yes, as long as your entity has an ON and OFF state just simply copy the entity ID event.zijdeur_beweging and paste it into the trigger and your done, click save.

You may find that your event entity does not have this, so then you will need to find the state it becomes so your code in your template binary sensor will be like this, or similar

{{ is_state('timer.zijdeur_motion_timer', 'active') }}

I just not sure what event.zijdeur_beweging actually does. Have a look at in developer tools > states tab > search for event.zijdeur_beweging and then trigger it to see what happens.

Blacky :smiley:

@104

Hi Steve, all looks goodā€¦ is it not working?

Blacky :smiley:

@nanoandrew4

I going to assume a lot here but it just may help you. I havenā€™t tested it just all in my head so sorry if I get it wrong.

I am thinking sitting at dining table you would like more light 100% and sitting at sofa you want less light 50%.

  1. Use one automation.
  2. Group the triggers and use the group only as the trigger. Link in blueprint trigger description for grouping how to.
  3. Set it up for 100% light.
  4. Use night mode and use the sofa trigger as the state condition for night lights.
  5. Set up night lights for 50%
  6. Now you can enable or disable this option. In night lights look at this option If lights are ON, adjust the lights when crossing over.

Let me know if this works for you.

Blacky :smiley:

@ronlut

If your looking for at night time to have a different brightness then consider using night lights and maybe use time condition in night lights. Dynamic lighting will not work in night lights. You then set your night lights to 30% and they will come on at that every time.

Blacky :smiley:

@Blacky

No problem. Thanks for the answer.
Sure, I am really interested in testing this out.

Hey, thanks for your answer. My idea is as you describe it, but with dynamic lighting in both, since ideally i donā€™t want my sofa lights on one fixed brightness and color. If thatā€™s not possible though, Iā€™ll settle for the option you described and try it out, see if i can make it switch seamlessly between day and night mode when I go back and forth in my living room.

Thanks, but actually this is not what I meant. I mean how do I keep manual changes to brightness throughout one session of ā€œthereā€™s some one in the roomā€?
Even with night lights, if it will change the light to 30% every time it detects motion, this means if I enter the room, it turns on at 30%, I change it manually to 50% with my wall switch and then a minute after it will change back to 30% because I am still in the room and the automation runs again? This is what I am trying to avoid, is that somehow possible? Thanks!

Hi there, thank you for an amazing blueprint!

I find that once the light has gone off, when I walk by again, the lights to not come back on quickly? (If theyā€™ve just gone off for example) What could be the problem here?

I am using a Philips Hue Motion Sensor.

Thanks in advance for your advice and help!

Thank you super helpful and understand this logic now. High level expanding on this automation letā€™s say light A normally turns off after 5 mins but I want it to remain on longer if light C is on. I canā€™t do this is in a ā€œTurn Offā€ script since light A would already be turned off. Do I need I need a script at the beginning vs at the end? I assume yes and I need to check the status of light C before exiting out of the ā€œlightsā€ script?

Okay I will PM you.

Blacky :smiley:

@nanoandrew4

Dynamic lighting will always change your lights, so if you change it dynamic lighting will change it back.

Blacky :smiley:

@ronlut

If you light is ON and you change the brightness then the brightness will remain until the light turns OFF and then comes back ON. It need to be set up correctly.

Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on ā€œ</>ā€ and paste code in there.

Blacky :smiley:

@varsanikr

Hi Kishan, welcome to the community.

Once the light turns OFF and you trigger the motion sensor again then it will come back ON.

If you find the light turns OFF and back ON all the time then look at the time delay and increase the delay time.

When motion is detected, the automation triggers, and the light turns ON. Once the motion sensor clears, a time delay begins. After the delay finishes, the light turns OFF. If motion is detected again, the light will turn back ON.

You can adjust the time delay to fit your specific needs or site conditions. Additionally, you can enable a light transition, so the lights turn ON and OFF gradually, making the changes gentler on the eyes. This setup gives you complete control over how the lights behave.

Blacky :smiley: