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


Firstly welcome to the community.

I understand what your trying to do but running through some scenarios in my head.

Scenario 1 - Motion sensor in the Hallway

  1. When motion is detected, hall light turn ON - Done
  2. If you are in bedroom and you walk out into hallway motion detected hall light ON - Done
  3. If you are in hall way entering bedroom motion detected hall light ON - Done.

All option covered with just motion. Light turns OFF when motion is not detected. :white_check_mark:

Scenario 2 - Bedroom Door sensor.

  1. In hallway enter bedroom (door sensor), bedroom light ON - Done
  2. In bedroom enter hall open door bedroom light ON, but it should be ON already as you could be in the dark - Not Done :thinking:


  • What turns it OFF?
  • Do you leave the door open when you would like the light ON and then close it to turn the light OFF? If so then that would work :+1:

Scenario 3 - Bedroom Door sensor. If the door is the trigger then it just works of a time delay. Door is open and closed.

  1. In hallway enter bedroom (door sensor), bedroom light ON after some time light OFF - Done
  2. In bedroom enter hall open door bedroom light ON…, but it should be ON already as you could be in the dark, so you have manually turned the light ON already, ok. so we leave bedroom close the door light is ON after some time light OFF - Done

This seems to work but only for a short time :thinking:

Scenario 2 & 3 seams unresolved :thinking: Would a motion sensor be better for a bedroom (Room) as door sensors work well for cupboards or small rooms like food storage, clothes rooms etc.

Maybe I don’t fully understand what you are trying to do in its entirety.

Blacky :smiley:

Is this saying that I would have to leave the room (presence clear) before the lights would turn off? I have a main room that can be used all day. What I would like is that in the morning when it is still dark the lights will turn on, but as the sun rises (and the lux value goes low->high) the lights would turn off, even though I’m still in the room. Is that the intended behaviour? I removed the room from the lights, they still turn on when lux goes high->low, but as long as I’m in the room they just stay on forever.

The should go off

can you give me your YAML now.

Of course, here’s the one where it would not turn off when the lux went low->high with presence

alias: Living Sensor Lights
description: ""
  path: Blackshome/sensor-light.yaml
      - binary_sensor.anyone_home_sensor
        - light.dining_table_light
        - light.dining_wall_light
    include_ambient: ambient_enabled
    ambient_light_options: ambient_light_option_disabled
    ambient_light_value: 37
    include_time: time_disabled
    after_time: "10:30:00"
    before_time: "23:00:00"
    include_sun: sun_disabled
    include_zone: zone_enabled
    zone: zone.home
    night_light_transition_on: 4
    night_light_colour_temperature: 4500
    include_bypass: bypass_enabled
    motion_bypass: input_boolean.disable_sensor_lights
    ambient_light_sensor: sensor.living_room_lux_illuminance

Can you set a delay time and save. Default is 5 min so can you set it to 1 and test it then you can go back to 5 and test it. Thanks.

New update 4.3

New Features :new:

Added the ability to use another condition in night lights called “Entity State” :partying_face:. Night lights have 3 conditions now.

  • Entity State
  • Time
  • Sun Elevation

The entity must have an ON state to activate nigh lights. So now you can use “Do Not Disturb” on your phone, a helper toggle, a switch near your bed, a bed sensor etc to activate night lights. More information can be found in our FAQ or Click Here for more information.

Bugs Fixes :bug:

  • Fixed an error when transition was disabled like shown below. This was probably when you are using zigbee2mqtt.
Transition value 0 is not valid.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:


Blacky :grinning:

1 Like

Thanks for that awesome work and constantly improving this blueprint! :slight_smile:
Just a minor thing i want to point out there is a typo in the change log date of V4.3.

1 Like

No problem, there was a lot of work (code changes) in this release.

All fixed

1 Like

Thats great to hear, i faced issues with the combination of yeelight and nightlight functionality previously. Let me check tonight if this is gone now. If not i’ll come back and post my logs.

awesome! :slight_smile:

this integration can do 'Time Travel` as well :rofl:

1 Like

New update 4.4

Bugs Fixes :bug:

  • Fixed an bug in crossover transition from “night light to normal lights” and from “normal light to night lights” using wrong transition selection.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:


Blacky :grinning:

Well seeing as you’ve released several new versions while we’ve been talking I decided to update to the latest, delete the automation and start it from scratch and it works! Shame we will never get to the bottom of the problem, but I’m happy that is working perfectly now. Thanks so much for all the time you put into your automaton blueprints

Good news!! If it work then I take that :+1:

No problem at all, your welcome. Thanks for letting us know :+1:


Blacky :smiley:

Thanks for your reply and explanation, @Blacky. So in my case I have a variety of ‘kill switches’ for each automation. Stuff like ‘disable downstairs light automations’, ‘guest mode’, etc. It looks like with the current blueprint you can have just a single by-pass? Based on your description of by-pass, seems like that would be sufficient when it comes to achieving my kill switch functionality, but I am constrained by the limitation of allowing only a single entry.

I recently upgraded the blueprint and am seeing an odd error. I did just try to delete the respective automations, delete then re-add the blueprint, and add back one automation.

Error rendering variables: UndefinedError: ‘dict object’ has no attribute ‘entity_id’
(Source: components/automation/init.py:608)

alias: Motion - Closet Mommy
description: “”
path: Blackshome/sensor-light.yaml
- binary_sensor.lumi_lumi_motion_ac02_iaszone_5
device_id: b81a458eeafb2b29e1e02a4aab11ae66


In “Lights - Switches - Scenes” you can’t use areas or devices. You will need to expand down to entities.

Please see “The Settings & Best Practice Guidelines” Click Here as it will guide you on “How To” :wink:

Blacky :smiley:


Thanks for your suggestion “More Than One By-pass”. I will add it to the list.

For now you could and “entities” card to your dashboard with a top toggle and name. This will turn ON and OFF any entities in the card. You could have one for downstairs, guest, upstairs, all light automations, all automations. It will be easy to manage then. :wink:


You could also use areas but name them how you like example area name “Light Automations Downstairs - By-pass” Then put all your by-passes in that area and you can turn on and off areas in automations.

Blacky :smiley:


Thanks, everything is working again. I am not sure what version I upgraded from, but I changed all the previously working ones from “device” to “entity” and everything is working as expected again.

This is my go-to blueprint by far!

My next attempt will be trying to use a humidity sensor (set as a binary sensor helper) to leverage as my “bypass” device. (Am not asking for assistance, as I prefer to tinker and figure it out on my own first). But too often my wife yells at me when she’s in the shower and the lights go off on her. :slight_smile:

Thanks again! And another ask to add to your list… Would be great to be able to use a template value for brighness + color. This would make this blueprint work better with ‘Adaptive Lighting’ integration on HACS.


Love it :hearts:

If you are not sure what version you came from if it is not to much trouble I would recommend a clean install of your automations. This way it will clean up any existing YAML configerations that may cause problems.

In the FAQ under " UPDATES OF BLUEPRINT" it will list all the things that were needed to be done. But again if it has been a wile sometimes it is easer to just redo the automations :wink:

Yes this can be done, but I respect you would like to tinker and try and work it out. In any case if you run into troubles just post a message and I will be happy to help. There is one thing I will say, if you haven’t checked out my :shower: Bathroom Humidity Exhaust Fan then it is realy worth a look. There are 2 blueprints I realy like, this one and the Bathroom Humidity Exhaust Fan blueprint. I think they are a must have, and spoiler alert I am working on the Bathroom Humidity Exhaust Fan blueprint now.

Blacky :smiley: