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

Is it possible to add an if statement to the blueprint, i have alarmo and when armed, i dont want the lights turning on when the dog moves around

@dezito , firstly welcome to the community.

In your alarmo when you arm it do you have a entity that will go ON when armed and OFF when not armed. If so put that entity into the by-pass selection so when alarmo is armed it will stop the blueprint from running and the lights will stay OFF.



There are a couple ways to do this. Below is one example on how to update a blueprint. You can also find out more information on the Home Assistant official website if you prefer.

This is the official Home Assistant web site Using Automation Blueprints - Home Assistant

Example Below

1 - First most important, do a full backup of your Home Assistant, and store it in a location where you can get to it if you brick your Home Assistant (on a separate computer not running Home Assistant).

2 - To update a blueprint you must have a file editor. There are few to choose from. If you don’t have one already installed then this is how to add the official “File Editor” into your Home Assistant. Go to Settings / Add-ons and then click on “add-on store”. In the " Official add-ons" heading you will see “File Editor”, click on it and install it.

3 - In all my Blueprints, the official latest code is in the first post at the top unless it is to big as this form restricts how much you can include in any single post. If that is the case then there is also a link to my GitHub were you can find the code to copy. For this blueprint you will need to copy the code from GitHub.

  • Go to my GitHub link at the top of this post Click Here, in the code area there will be a “Raw” button. If you click on it you will then be able to easily copy the code without copping anything else.

4 - When you have copied the code, go into your file editor. At the top leftish there is a folder icon. If you click on it a navigation area is shown. Navigate to the file of the blueprint you would like to update. For this blueprint it should be in “blueprints/automation/Blackshome” and select “sensor-light.yaml” file.

5 - Once you select the file you should see the code of the blueprint displayed in the right section. At the top of all my blueprints it should say the name, in this case, “Sensor Light” and you should also see the version you are on. This let’s you confirm that you are on the correct blueprint your about to update and not changing some other code that could brick you HA. Once confirmed, delete all the code and paste the new code you copied before in its place. You should now see the name again and the new version in the code at the top confirming your paste was successful and you are happy to proceed. When you pasted the code a red save button pops up and most importantly you will also see a green tick. If you don’t see this green tick, then stop, something is wrong, check the steps again until you see the green tick. If you see the green tick and you are happy with everything (again, a backup of HA) then and only then should you click save.

6 - Once saved you will need to reload the blueprint to reflect the changes before it will take affect. In the file editor you will see a cog wheel at the top right. When you click on it, select “Reload Automations”. A confirmation will pop up to confirm if your happy to proceed, click yes if your happy.

You have now updated a blueprint :tada:.

To check everything was done correctly, go into your automation and or the blueprint, you should see the new version displayed at the top confirming you are on the latest.


Blacky :smiley:

Back to FAQ: Click Here


I really enjoy this automation, but could you add the ability to (1) turn on a blocker helper and a (2) sensor that suspends turning off the light? The reason for (1) is sometimes I head to bed early and the light turning on and off because I roll around is disturbing. As for (2) I have ESPresense sensors and I plan to buy mmWave sensors that will detect if I am in a room and keep the light on without me flapping my arms around while watching a movie.

Also enjoying this automation and have the same question about ESPresense and also planning to buy a mmWave to make my life easier. It would be great to include those parameters also :slight_smile:

Hi @NeoFax75 and @Geo

Thank you for your kind words.

So you will need something to know you in bed early. That something has to have a ON & OFF state. If you put that something in your By-pass then it will disable the automation from running and your light will not turn ON and OFF. If you then switch to night lights in the automation and you need that something to only be on for a short time (preset time) so the night lights will work when you get up in the middle of the night later then maybe consider my Entity - Run ON Timer for your something. This way it will turn the by-pass on for a preset time period.

If you have a mmWave sensor, they are very good at staying in the detected state or the ON state for a long time.

I have worked with other people with these types of sensors and this automation works perfectly.

The below explanation also applies if you have sensors that are in a ON state for long periods like contact sensor, etc.

If you going to use a ESPresense, so you get a fast reaction time, with a mmWave sensor then you must create a group helper for the trigger sensor.

The reason being is when you walk into the room the ESPresense detected motion and the lights turn ON (because it a quick reacting sensor), then before it clears the mmWave sensor changes state to detected (ON state) and the automation doesn’t see it, so the mmWave stays ON for a long time and the automation never gets a trigger from the mmWave sensor again making it useless. The light goes OFF and you have to wave your hands around for the ESPresense to detect motion again and turn your lights ON, remember the mmWave sensor is still ON but will not send a trigger again until is clears goes to OFF state and then goes to detected or ON state (The trigger is from OFF to ON state).

When you create a group helper if any sensor that is in the helper goes from OFF to ON then the trigger is received, Lights ON. It then waits until all sensors are OFF before it goes to a OFF state. So with a group helper as the trigger sensor, if you walk into the room the ESPresense detected motion and the lights turn ON (because it a quick reacting sensor), then before it clears the mmWave sensor changes state to detected (ON state). The group helper is in the ON state. The ESPresense clears and goes to the OFF state but because the mmWave sensor is in the ON state the group helper is still in the ON state and your lights stay ON. The automation just sits there waiting for the group helper to go to the OFF state before the time delay is activated and your lights turn OFF. No more flapping your arms around. Then the automation works perfectly.

Hope this make sense.

This is a link to one of our FAQ on how to set up a group helper for this reason. Click Here


You could create a binary template sensor that detects when the TV is ON so you don’t have to flap your arms around while watching a movie.

1 Like

Hey Blacky

Thank you so much for this awesome blueprint, so many options :grinning::muscle: I use i all over I’m our house :blush:

One thing I’m missing is…

I have a button that I use to bypass the sensors, but it is in the room with the sensor.
So, the light turns on with the sensor, and then I bypass, that same button turns a dimmed light scene, on the same light bulb/strip as the sensor.
After the time has past, it sets the scene light off, because the timer continues :joy:

Is there a chance that there could be an option to stop and reset the timer, so it won’t run before it is triggered again by the sensor, when the bypass is off again?

Am I making any sense, or just confusing you? :thinking: :joy::see_no_evil:

Thank you, Morten

Hi @Shortykiller

Yes your making perfect sense. This is how it was designed as I always wanted to turn off the lights if the by-pass was turned on when the light was on. I was going to work on it as I got it on my list to do but haven’t got around to it yet.

I will make a option for this and post a new release soon :+1:

Thanks for the suggestion.

Edit: In the new Version: 2.6, and in the by-pass options you will need to select “Enable the By-pass - If lights are ON, leave lights ON” and it should work. :crossed_fingers: Updating now.

Blacky :grinning:

1 Like

New update 2.6

Added a new option to the by-pass. It is in the existing “Use The Trigger Sensor By-pass Option”. You can now choose what to do to the lights if the lights have already been switched ON by the automation and you turn the by-pass ON.

Your options now are

  • Enable the By-pass - If lights are ON, turn lights OFF
  • Enable the By-pass - If lights are ON, leave lights ON
  • Disable the By-pass option


Blacky :grinning:


Hey Blacky

Thank you so much, it works perfectly :smiley:
Also, I updated my first Blueprint by following your guide higher up in this thread, thank you :slight_smile:

Have a good day, Morten

1 Like

Hi Blacky,

I’d also love to see the option of adding transition duration to the scenes/light :slight_smile:

Thank you for your efforts on this great blueprint. :heart:

@davekoep Hi Dave, firstly welcome to the community :slightly_smiling_face:

Thanks for your feedback, I am glad you like the blueprint. :+1:

I will add your suggestion to the list.

Blacky :smiley:

I’m brand new to this group and wanted to thank you for this sensational Blueprint!
I think I got everything right. I chose the way without scenes. I haven’t quite discovered the advantage yet. When I was testing it earlier, I had the situation that if a movement was detected and I switched off the light manually via the dashboard, it would no longer be switched on via the movement.

Firstly welcome to the group, and thank you for your kind words :slightly_smiling_face: :+1:

You don’t have to use scenes, but some people like to use them when they have a group of lights that they would like different brightness, colours etc when they turn them on. You can achieve this by using scenes.

I would say that your movement sensor didn’t go from OFF to ON at the time or your sensor has a time out feature.

Please be assured the automation works and it will be something in your system, what you may have just experienced at the time and or the sensor. So your motion sensor has to go from OFF to ON or Clear to Detected to send a trigger to the automation.

You may have experienced this. If you have a sensor that detects (goes ON) and you lights come ON and then you manually turn your lights OFF and you keep walking around and you sensor says ON then the lights will not come ON until your sensor goes OFF and back ON. Hope this make sense.

Blacky :smiley:

Hi @Blacky and rest of the community! :wave:

I also want to thank you @Blacky for that awesome blueprint! :clap: :beers:
It works pretty well with my Philips Hue Motion sensors in couple of rooms.

If there is any suggestion box - could I kindly ask how I could include in the blueprint logic the door sensor? Let’s say I have it mounted on bathroom doors. Dunno if that’s even possible - blueprint already uses a “wait for change” and it’s code is pretty confusing for me :thinking:

Anyways - I would be grateful for any tips :pray:


It all makes total sense, thank you for the great explanations. I still have one question. Back then :slightly_smiling_face: : I operated the Philips lamps via the Philips Hub and now via the new stick from HomeAssistant and this great Blueprint. Since the changeover, however, I have noticed a positive behaviour, the lamps go on very quickly :), but back then it was an easy transition both when switching on and off. Is it possible to implement such a slow transition?

Hi Blacky,
fantastic blueprint. Thank you very much for your work.
I do have the same issue though that you may have solved with momo earlier in this thread.
I want to use 2 motion sensors (each side of the stairs). The sensors support illumination/lux, but the value is only sampled when motion is detected. Hence, the triggering sensor contains the “correct” value, the other one is outdated. Do you know of a way to handle that?

I have the same issue with lux sensor in my Philips Hue Motion sensors. The official site points out that there was an firmware update which should fix the issue: Philips Hue Support - Release Notes Accessories | Philips Hue US

Unfortunately I don’t know how to check current firmware version (I don’t have hue bridge) and how to update…

After a good night sleep and some more considerations, I solved this by feeding the blueprint with a virtual motion sensor, which is loaded with either sensor1 or sensor2 data by some pre-processing automation rules.

@narandill , firstly welcome to the community.

Your welcome, glad you enjoy it.

You can have a door sensors as a trigger. You can use one or multiple Binary Sensors for the trigger sensor. If you are going to use 2 or more binary sensors in the trigger selection and 1 of them is a sensor that can stay in the ON state for some time (like a door sensor) then I would recommend you consider using a group helper as shown in our FAQ. If your just using one trigger sensor that stays on for a long time then you will not need a group helper and you can just add it to the automation by selecting it.