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

Thanks!! It works!!! :sunglasses:


Nice one, thanks for getting back to us.


Blacky :smiley:

Hi @Blacky
Just removed the scene in the Off settings, but it does not make a difference.

If a person enters the area in the 10 sec. dim-off period, the lights does not get triggered to go back on.
I have the EPL Presence state visible on a dashboard, and the censor trigges as expected.

Would it make a difference, if I put the lights in a scripts?


Okay :thinking:

Is there a reason why you have set your time delay to 0. Is this just for testing?

If you can see the sensor detecting motion, check to make sure the automation get triggered again. If the automation is triggered again it will send the data if HA see the light as OFF. It may be that the lights state in HA is ON. There could be a delay with the LIFX downlights. In the automation if the light is ON it will not send the data to it. It is done like that for many reasons.

If you like try this test. Turn the light OFF with a transition and see if HA reacts fast and the light is displayed OFF while it is transitioning.

You can try using a scene or a script. But don’t use the scene script helper as that makes it function like a light and it will work the same way.

I ask LIFX if they would send me a light so I can test it but they refused so I can test it and make sure it works.

Blacky :smiley:

1 Like


First of all, thanks for all your blueprints.
I have a small question about this one, I use it with the Shelly blu motions and these are sometimes a bit slow, so that I am faster at the light switch out of habit. When I switch on the light using the light switch, the timer does not come on, would it be possible to add an option here so that the timer also comes on when the light is switched on manually? Or am I overlooking this possibility?

Thank you very much


Welcome to the community.

Your welcome.

If you turn your light ON manually as long as you can turn it OFF in HA it will work I do this from time to time here. Example. If you turn the light ON and then your Shelly BLU motion detects motion the automation will run and take over turning your lights OFF.

You may find that your Shelly BLU motion is not detecting motion. I had a lot of problems with the Shelly Motion 2 sensors not detecting motion. I did an update about a while ago and they are now working well. I would check your Shelly BLU motion for updates and make sure it is detecting motion.

Let us know how you go and if you need more help.

Blacky :smiley:

1 Like

Hi @Blacky

In the automation if the light is ON it will not send the data to it. It is done like that for many reasons.

Is that HA not triggering the light-on, or your blueprint?
Cause when I use this bluebrint, “Controller - EnOcean PTM 215Z switch”, I can trigger one button that starts a fade, and mid-fade hit another button that trigger the same lights (or some of them) to another state (like: Fade off → Fade On)

Press Button 3: Automation that dim all lights to off
Press Button 1: Fade bedroom lights on.
BP Yaml is like this:

alias: Controller - Soveværelse
description: ""
  path: EnOcean/EnOcean_PTM215Z_switch.yaml
    controller_entity: sensor.lab3d01_action
      - service: light.turn_on
          transition: 4
          color_temp: 412
          brightness_pct: 100
          area_id: sovevaerelset
    button_1_held: []
      - service: light.turn_on
          transition: 5
          color_temp: 461
          brightness_pct: 12
          area_id: sovevaerelset
      - service: automation.turn_on
        data: {}
          entity_id: automation.sluk_huset
      - service: light.turn_on
          transition: 4
          color_temp: 500
          brightness_pct: 10
          device_id: b23a161e6ac605c27f2f46c4a7c79172
      - service: light.turn_off
          transition: 3
            - 07c00a35854e6482cd845c8eca709f68
            - 63ca47f6597335aea1caef9a3bd2002b

If it’s a setting in your Blueprint, could you point me to the code, that I could try to bypass it and see if that helps?


This blueprint it a bit more technical then a simple ON /OFF and has things that you will probably never notice. Not noticing is a good thing.

I will try and explain.

When the BP turns the light ON the BP send the data to the light. If the light is ON and the automation (BP) keeps being triggered it does many things but one being if the light is ON then don’t send any data to it, just leave it alone… the light is ON. This allows you to change any of the light settings once the light is ON and the automation will not change it back on every trigger. The trigger is normally a motion sensor that can trigger many times when the light is ON. It also has other benefits but I will not go into them all.

So what I am thinking is when the BP turn light OFF, normal lights will go OFF instantly in HA and then fade… so if the BP gets triggered again during this period (seconds even milliseconds) and the light is fading the BP knows the light is OFF and then sends the data again to the light to turn back ON. If the light status in HA is delayed then the BP will think the light is ON and when triggered again (during the fade) it doesn’t send the data to the light to turn ON because it thinks it is ON already (we are talking seconds even milliseconds). My lights do this all the time no problem. I use Shelly dimmers with normal down lights.

This is why I asked if when you turn the light OFF with a fade does HA see it as OFF as soon as you hit the button (no delay instant) or is there a delay. Example you hit the button to turn it OFF, it starts to fade and in HA the light still shows ON. This may only be seconds but seconds count.

The LIFT down light may be slow to show status in HA. They could be going to a cloud service, They could just be slow locally… many things.

If you can test this for me as I don’t have LIFX lights and let me know what is happening.

Blacky :smiley:

1 Like

HI @Blacky
Ah, ok, yeah, just digged into developer tools, and:
State: Flippes to Off very shortly, then back to On while dimming (down). Then goes to Off when Brightness reach zero(null).

That might explain it then.


Hi Jakob

That’s is some good information.

So what I think may be happening is… your light turns OFF… while transitioning your motion sensor trigger’s turning it ON. The trigger then clears fast… you have set 0 for your time delay so it turns OFF instantly.

Try setting your time delay to 2 min. This is a very important setting in the BP. See below. Then run a test.

Let us know how you go.

Blacky :smiley:


Can you also set an entity to activate the automation. So if all motion automation can be switched off and on via an entity. (helper)

How can I use the automation at night and adjust when the brightness sensor is too low.


Welcome to the community :wave:

Yes you can use anything that has a ON / OFF state. If you copy your entity ID you would like to use and then in the automation just any entity as the trigger, then edit the automation in YAML (3 dots top right) then find the entity you just entered in as the trigger and replace it with the entity you would like to use. Click save and your done.

There is no option for a LUX sensor condition at night, however you can use the state condition option. You then create a template sensor so when the LUX is below X then = ON.

Go to Settings / Devices & Services / Helpers Tab at the top / Create Helper / Template / Binary Sensor / Enter in the name you would like to call it and in “State Template” paste the code below. Click Submit and then use that binary template sensor in your night lights state. This is for below 50 so just adjust it to your liking and update ‘sensor.your_lux_sensor_here’ with your actual entity ID of your LUX sensor.

  {% if states('sensor.your_lux_sensor_here')|float < 50 %}
  {% else %}
  {% endif %}

Hope this helps you.

Blacky :smiley:

1 Like

Hi @Blacky,

To stop this action of the light turning off being seen as motion also, is there anyway to add a condition such as would check if the light has been turned off in the last x seconds and if so then don’t trigger the automation / turn the light on again ?


I am not sure why or your use case for this. Currently the automation will not do that.

Maybe you can explain your use case and then I may be able to help more.

Blacky :smiley:

I have a motion sensor/lux sensor in my laundry room. I would like the light to turn on for 5 minutes if the lux reading is below 50 OR if the sun elevation is below 0. I know this should be 101 level but I’m not sure I’m figuring out the right settings.

My use case is this:
I should be able to rely on the lux setting to turn on the light whenever the room is dim. However, once in a blue moon my lux sensor will fail to update and it will provide a spurious reading for a while. During the day, we don’t worry if the light fails to go on, as there is enough outside light to navigate, but at night if the lux reading is spuriously high it leaves one completely in the dark.


The conditions for sun and ambient are global. If you enable them both then both must be true for it to work.

You lux sensor providing spurious reading for a while is it because it is using an old value that the LUX is high thus not allowing the light to turn ON or is it becoming ‘unavailable’ thus not updating or is it affected by the light?

The best way for what your are trying to do is to use the ambient option but you do say that during the day there is enough outside light but I am guessing you would rather have the automation come ON during the day if it goes below 50 as that may happen in your site. If it is always above 50 during the day then you could use the sun condition.

If you would like to use your lux sensor then we need to look at why it is giving spurious reading for a while. Once we know that we then can try to solve your problem other than getting a lux sensor that works well.

If you can look into this and get back to me maybe I can help more.

Blacky :smiley:

Yes, we prefer to have the light come on in the daytime when it gets dim/cloudy.

I have the ambient threshold set to 50. When things fail, I usually see the Lux stuck at like 63. It is a battery powered device so I don’t expect it to update continuously. Usually by the time my wife complains and I walk into the laundry room the light works as expected, (which doesn’t increase her happiness).

Would two automations work together as expected?
Automation 1. Elevation above 5, Ambient < 50lux, +Motion = light
Automation 2. Elevation below 5, +Motion = light


Yeah agree and when you trigger motion once it will probably update and then you come in to check it and it working.

No because elevation works below not above.

Try this.

  1. Leave your lux sensor as is in the automation. That will work during the day.

  2. Then we will create a binary template sensor and use it in the bypass option 1. This will be for night time. We will use your motion sensor and sun elevation. Both need to be true for it to be ON.

    Go to Settings / Devices & Services / Helpers Tab at the top / Create Helper / Template / Binary Sensor / Enter in the name you would like to call it and in “State Template” paste the code below. I have set it for -1.5 but you can set it to 0 if you like. You will need to update your “binary_sensor.your_motion_sensor_here” with your actual motion sensor entity ID. Click Submit and then use that binary template sensor in your bypass option 1.

{{ is_state('binary_sensor.your_motion_sensor_here', 'on') and state_attr('sun.sun', 'elevation') < -1.5 }}
  1. Bypass - Time Delay = Set it the same as your “Time Delay”.

Let me know if this works for you.

Blacky :smiley:


My first comment here, and let’s start with a thank you for your awesome blueprints!

Sensor Light works great, and I have no less than 18 automations using it - lots of motion sensors and lights in my house :slight_smile:

Recently, I started moving to lux based dynamic light, but now it seems my lights stay on after the timeout.
I don’t know if this is expected behavior, but I’ve been reading on the FAQ, best practice etc. and could not find anything.
It’s probably something trivial, but I can’t figure it out…

Here’s one of the automation configs I would use:

alias: "Motion Gallery "
description: ""
  path: Blackshome/sensor-light.yaml
      - binary_sensor.gallery_motion_occupancy
      entity_id: light.gallery
    dynamic_lighting_lux_sensor: sensor.balcony_motion_illuminance_lux
    time_delay: 3
    light_transition_on: 5
    light_transition_off: 30
      - use_transition
    include_dynamic_lighting: enable_lux_controled_brightness
    dynamic_lighting_min_brightness: 40
    dynamic_lighting_max_brightness: 80
    dynamic_lighting_min_colour_temp: 4000
    dynamic_lighting_max_lux: 130
    dynamic_lighting_min_lux: 0
      - if_lights_are_on_adjust_when_crossing_over
      - use_transition
      - use_colour_temperature
      - use_brightness
    night_lights_before_time: "07:00:00"
    night_lights_after_time: "21:00:00"
      - time_enabled
    night_light_colour_temperature: 2000
    night_light_transition_on: 5
    night_light_transition_off: 30
    night_light_brightness: 15
    include_night_lights: night_lights_enabled
      entity_id: light.gallery
    night_time_delay: 3

I use “Trådfri” motion sensors and lights and lux is coming from an outdoor Phillips motion sensor.
I’m on latest HA and blueprint v6.5
Hope you have an idea :slight_smile:


Hi Martin, welcome to the community :wave: and your kind words.

Nice one :+1:

Thanks for providing your YAML. I have tested your exact set up and my lights turned OFF and they should turn OFF. That would be the expected behavior.

I am very keen to know more about this. Currently I am working on dynamic lighting, on the performance side so you got me at a good time.

Can you check a few things for me?

  1. Test it again and make sure your motion sensor is not triggered in the 3 min and 30 sec (+ a bit for lag in time). After no motion is detected then your light should turn OFF. Put your motion sensor into a dashboard so you can see it when it goes clear then time it. Really important you check this or we will go down a rabbit hole. I checked this and it worked perfectly.
  2. If 1st test fails then can you set your transition OFF time to 0. Then run test 1 again but you only have to wait 3 min now (+ a bit for lag in time).

Blacky :smiley: