💡 Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

Thanks for the detailed reply, between changing the device to green and adjusting the timers, it’s now working!

1 Like

No problem, glad you got it all working :+1:

Thanks for your reply :heart:

I don’t know why, but the blueprint doesn’t get triggered sometimes…? Could you check on something

Here;s my yaml

alias: Main Door 2 Motion description: "" use_blueprint: path: Blackshome/sensor-light.yaml input: motion_trigger: - binary_sensor.100148d374_4 light_switch: entity_id: switch.4_switch_kamonk_47_switch_3 time_delay: 1 include_time: time_enabled after_time: "18:00:00" before_time: "21:00:00" include_zone: zone_disabled include_night_lights: night_lights_enabled night_lights: entity_id: switch.4_switch_kamonk_47_switch_4 night_time_delay: 1 night_lights_after_time: "20:59:00" night_lights_before_time: "07:00:00"

and its 23:30 in India right now.

@technokul firstly welcome to the community :+1:

TIP: When pasting code into this forum use the “</>” button as it will then display correctly and be much easer to read.

When using the “Use The Time Options (Optional)” this is a global time, so it also has to include your night light time.

So currently you have your time set to “18:00:00” to “21:00:00” so the automation will only work between this time period. You will need to include your night light time and set it to “18:00:00” to “07:00:00”. Then your night light time can be “21:00:00”(or “20:59:00”) to “07:00:00”

Blacky :smiley:

Hello,

I have in-wall smart switch module wired to regular switch for my kitchen. Lights are also normal spot lights. I use motion sensor as binary sensor. Can I use by-pass feature of this blueprint with that setup? It kind of works but not perfect. Switch toggles itself off than on immediately after time delay if I am still in the kitchen. If I am not, it turns off normally. I hope I explained clear enough. Is there anything I should consider? Such as my smart switch settings? Currently it is set to “state” mod of operation. Other 2 options are toggle and momentary. Thanks in advance.

alias: Kitchen Motion Sensor
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.kitchen_motion_sensor_occupancy
    include_sun: sun_enabled
    sun_elevation: 3
    time_delay: 1
    include_bypass: bypass_enabled
    motion_bypass: switch.kitchen_lights_l2
    bypass_time_delay: 2
    light_switch:
      entity_id: light.kitchen_light

Just to add, “switch.kitchen_lights_l2” and “light.kitchen_light” are basically the same thing. I used HA change device type and defined switch as light. That might be the reason why it wont work correct as I have to choose different entities. Hope there are some workarounds…

One problem I have is that it doesn’t seem to work with the adaptive lighting component,
When the lights turn on, they flash to full brightness white, then turn to the correct intensity and colour temperature. I can’t work out why this happens.

My old automations that I made used the turn on command and adaptive lighting turned the bulb immediately to the correct brightness and colour temperature.

@inancatl

Yes, I have the same setup here.

:thinking: In order for it to get to the end of the time delay there must be no motion detected or by-pass setting causing this.

This normally relates to what type of physical switch you are using. If you can see your switch turning ON and staying ON until you turn it OFF then that is a good start.

Below is a screen shot from a Shelly 1PM. This is how Shelly has set it up. I use toggle but you realy need to know what type of switch you have, how it works and follow the manufacture instructions of your smart switch.

Yep you cant do that. This is you problem “by-pass”. The by-pass entity cannot be used in “Lights - Switches - Scenes” and or “Night Lights” selections. So looks like you piggybacked the “light.kitchen_light” and created another entity called “switch.kitchen_lights_l2”. If you would like a physical switch it must be totally separated or you can crate a by-pass without having a physical switch. To do this see our FAQ on " Q: How to use the “Trigger Sensor By-pass” without having a physical switch?".

I would remove your “switch.kitchen_lights_l2” and create a “Trigger Sensor By-pass” without having a physical switch and you should be good to go.

Let us know how you go.

Blacky :smiley:

Hi @woowoo we should be able to sort this out. Could you provide us your YAML of the automation. To do this go into your automation, top right 3 dot, Edit in YAML, copy all the code, back to the forum and in your reply at the top tool bar click on “</>” and paste code.

I see that I had put a transition in my old automations to cover up the flash.

These three were using adaptive lighting:

  action:
  - service: light.turn_on
    entity_id:
    - light.bathroom_light
    data:
      transition: 1

 - service: light.turn_on
   entity_id: light.pantry_light
   data:
     transition: 1

  action:
  - service: light.turn_on
    entity_id: light.tv_room_light
    data:
      transition: 2

While this light freaks out with adaptive lighting and so it was set without a transition:

 - service: light.turn_on
   entity_id: light.kitchen_sink
   data:
     brightness: 50

The motion sensor turns on three lights each with different capabilities.

Is it possible to add some logic so that when Home Assistant gets restarted or the automations get reloaded, lights that were on when the event happened will be turned off? I’m asking because I’ve had the situation that a light in my shed happened to be on at the time i did a reload of my automations and as a result of the reload this light wasn’t turned off automatically anymore. It was a few days later before I saw it was still on and turned it off manually.

I know that the both below triggers can be used for triggering the automation. Adding these triggers can however have the -for some possibly unwanted- side effect that a light may get switched off after a reload or restart even though that light wasn’t switched on by the automation, so maybe if you add these triggers, we also need another setting to enable or disable this feature.

trigger:
  - alias: When Home Assistant starts
    platform: homeassistant
    event: start
  - alias: When automations are reloaded
    platform: event
    event_type: automation_reloaded

Hi @woowoo transition is under construction.

@rrozema Hi Richard, thanks for your feedback. Agree This will be done.

I ended up creating helper but it is not actually what I am looking for and not sure if my need is possible with current setup. I just want both trigger and switch available at the same time. For instance if I walk in the kitchen lights turn on. Motion timeout is lets say 2 minutes. Then if I switch the flip switch to normally “on” position, keep lights on and wait longer than 2 min to turn off the lights. With the helper, I need to open HA to disable trigger sensor totally.

It doesnt look like possible on hardware level i guess :sweat_smile:.

Edit: Okay I think I figured. I need 2 gang smart in-wall module for 1 gang flip switch. Flip switch would be the by pass switch and I need to wire ceiling lights to other output on module which wont have any physical switch.

@inancatl You can do it but you just need a separate switch to turn the bypass on. You can also have that switch if you like turn your lights on and if needed control a time delay. The switch can take the spot of your current light switch.

How it is now, the automation turn the light ON. The switch turn the light ON. That switch can’t be the by-pass as every time the automation turns the light ON it also turn the switch ON, and if the switch is the by-pass then every time the automation starts it turn the by-pass ON as well and stops.

EDIT: Just saw your edit. Yes your correct if that is how your smart switch is.

Is there an option the light stays on in the last place movement is dectected? That would be very useful for me.

Hi @oli737 Firstly welcome to the community.

If you are asking it to turn a light on when motion is detected and stay on until you manually turn it off then no, sorry.

If you are asking if you walk around your house and the lights turn on and off as you move around and when you stay in a room then the light stays on? then yes, but you will need to set up different automations for each room or area. To do this you just open the blueprint set your setting for the light and motion sensor located in that room / area and click save, name it (example - kitchen Lights). Then just do it again for the next room and so on.

New update 2.9

This is quite a big update :firecracker: You will need to clean up a bit of code in the YAML. I will post a “How To” below. It is quite easy to do … Sorry it had to be done to get transition set up nicely :wink:

Maybe consider hitting the :heart: at the top post if you liked it.

New Features :new:

  • Added transition time for lights. :partying_face:. You now can set the dimming time (Transition) of your lights when they turn ON and OFF so it is softer on your eyes. You can also use this option to notify you when the lights are about to turn OFF by selecting a longer “Transition - OFF” time. This can give you a warning indication that the lights are about to turn OFF by slowly dimming and allow you to wave your hands :wave: around so you can trigger the motion sensor and keep the light ON :bulb: :+1:.
  • Added crossover from night lights to normal lights. If the night lights and the trigger is ON when the night lights end time expires, it will now cross over to normal lights.
  • Added a safe guard :shield:. It will now check the automation and continue on a restart of Home Assistant :gear: :stethoscope: :infinity:.

Bugs Fixes :bug:

  • Fixed a bug in light flicker when crossing over from normal lights to night lights.
  • Fixed bugs when using multiple triggers.
  • Fixed a bug in the by-pass.

:page_facing_up: NOTE: It will only turn ON and OFF - Lights, Switches & Scenes now. This prevents you turning off automations, etc within an area if an area is selected.

:white_check_mark: The code is now to big to post at the top. There is a link to my GitHub at the top where you can copy the code and update your files. Click Here to go to the top where you can find the link to my GitHub.

Enjoy

Blacky :grinning:

1 Like

FAQ - How do you update the blueprint from version 1.8 - 2.8 to version 2.9 and above?

If you haven’t yet installed the blueprint then all you need to do is to click on the big blue button “Import Blueprint” at the top of this post and follow the steps. Click Here to go to the top of the post.

If you would like to update without deleting all your automations and the blueprint, then reinstalling the blueprint again and adding back all your automations then continue to read. It is very simple to do.

First you need to update the blueprint. If you don’t know how to do this then Click Here as I have a “How to update a blueprint” already explain for this. Once you have updated your blueprint then come back here and follow the steps below.

You will need to do this for each automation you created with this blueprint.

Go into an automation you created using this blueprint and click on the 3 dots at the top left, then select “Edit in YAML”.

You can now see your YAML code. You could see a two different options (see below) but we are looking for the two lines that say “include_light_control:… & include_night_light_control:…”.

Now you will need to delete the 2 lines with “include_light_control:… & include_night_light_control:…” as shown below. Then click save.

Then go back into your automation by again clicking on the 3 dots and select “Edit in visual editor”. You then will need to re-select your selections under “Light Control & Night Lights - Control” and click save. Your are done. :tada:

If you see something different with a row of dashes and letters, you will need to delete all the dashes, and some with a dash and a single letter “- a” as shown below.

From this

To this, then click save.

Once you have clicked save, you then will need to re-select your selections under “Light Control & Night Lights - Control” and click save. Your are done. :tada:

Now just repeat for all your other automations you created using this blueprint.

If you would like to check what you have done then go back into your YAML and it should look something like this depending on your selection options.

NOTE: If you don’t see one or both of the lines with “include_light_control:… & include_night_light_control:…” then you have never selected these options and your already good to go.

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

FAQ - How do the time options work including night lights time?

Below are all the time settings and what they do.

Using Time Options (Optional)

Enabling time options allows you to set specific start and end times, and define weekdays, restricting the automation to run only within the chosen period. These settings act as global conditions and can be used alongside with other global conditions.

Common Question: How do time options interact with night lights and their schedules?

Enabling time options is not required for using night lights and their schedules. If you want your automation to operate 24/7, it’s best to disable the main time condition and only use the night lights time condition.

  1. Example of Correct Configuration: :+1:

    • Main Time Condition: Disabled
    • Night Lights Time: 10 pm to 7 am

    In this setup, the automation will run continuously, and the night lights will activate from 10 pm to 7 am as specified.

  2. Example of Correct Configuration: :+1:

    • Main Time Condition: 6 pm to 7 am
    • Night Lights Time: 10 pm to 7 am

    In this setup, the automation will run only from 6 pm to 7 am, while the night lights will be active from 10 pm to 7 am as specified.

  3. Example of Incorrect Configuration: :-1:

    • Main Time Condition: 6 pm to 10 pm
    • Night Lights Time: 10 pm to 7 am

    Here, the automation will only run from 6 pm to 10 pm, making it impossible for the night lights to activate if their schedule starts after the automation period ends.

Understanding how these time options interact will help ensure your automation and night lights function as intended.

Start Time

The start of when the automation can run.

End Time

The end of when the automation can’t run.

Note: Think of the start and end times as a race. The start time is like the “starting line,” and the end time is the “finish line.” The automation will only run during this time frame, just as a race occurs between the starting and finishing lines.

Weekdays

It will only work on the selected days. This is a good option if you have a different schedule for weekends using the same lights, or if your office is only open from Monday to Friday and you don’t want the light coming ON Saturday or Sunday.

Night Lights - Start Time

The start of when the night lights can run. You don’t need to “Enable the time options” for this to work. The “Night Lights - Start Time” is enabled when you “Enable the night lights options”.

Night Lights - End Time

The end of when the night lights can’t run. You don’t need to “Enable the time options” for this to work. The “Night Lights - End Time” is enabled when you “Enable the night lights options”.

Hope this gives you a better understand of the time settings.

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

Back to “The Settings & Best Practice Guidelines” Click Here

1 Like

Thank you again for yet another awesome update, your blueprints are always inspirational! :tada:

1 Like