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

New update 2.0

Added a option for the Ambient Light Sensor.

In some cases when your lights turn ON your ambient light sensor is affected increasing its LUX value. This can cause the lights to go OFF prematurely. You now have the option to set the “Ambient Light Sensor - Site Conditions”.

  • YES - My Ambient Light Sensor is affected by the Lights
  • NO - My Ambient Light Sensor is not affected by the Lights


Blacky :grinning:

1 Like

@Momo @EsserA

Please upgrade to V2.0 and select the “YES” in “Ambient Light Sensor - Site Conditions”. This should resolve your automations.


Blacky :grinning:

I was drunk when i was doing this​:joy::joy:. Now i have to drink again to get into the mode​:rofl:. My physical switch is a toggle if thats the correct way to name it? I can easily remove the spring behind the button then i have a on and off but then i will lose the possibility of dimming which is used very frequently. But how about using a cheap smart switch behind a wall switch ( a different wall switch) and then make the new smart switch as a trigger to the lights without dimming option and also use it as the by pass switch. Or does it have to be physically connected to the lights?
In other words the new smart switch will be used in an automation to trigger the lights on and off😊. I hope this makes sense and not just a hungover brain😵‍💫😵‍💫

Is there a way to deactivate the motion detector when a computer is turned off?

Thanks in advance

First go into developer tools / states / select the entity you are using. Then look at the state see if it goes ON and OFF when you toggle it.

If you use the same switch for the light and the by-pass it will only work when the light is ON (switch is ON) and you must manually turn it on before the automation does. So if your switch is connected to the lights and you have it selected in the by-pass and you manually turn on the light with the switch the light will remain ON until you turn the light OFF. The by-pass will not work if you would like to keep the lights OFF. This is why it says next to the by-pass selection that the switch must not be included in the lights selection.

So if you would like a by-pass for ON and OFF you will have to have a separate independent switch for your by-pass or you can create a helper in HA and you will have to use the HA to turn the by-pass ON and OFF.

If you would like to have a by-pass that will only ever keep the light ON then you can use the same switch in the by-pass selection, but remember you must turn the light ON before the automation turns the lights on, or you will have to turn the light OFF manually and then turn the light back ON manually.

Yes you can but you will have to do a few things.

First in order for HA to know your computer is ON or OFF. The best way I have found is to have a smart plug that will measure your power in watts. Then plug your computer into the smart plug. Add the smart plug to HA devices.

Then you will have to create a switch that has a ON and OFF state when your computer turns ON and OFF. To do this you will need to add this into your “configuration.yaml” file

  - platform: template
        friendly_name: "my computer"
        device_class: power
        icon_template: mdi:laptop
        value_template: >-
          {% if states('sensor.your_computer_power_sensor_here')|float < 85 %}
          {% else %}
          {% endif %}

Now you will need to add this binary sensor into the by-pass selection.

So now when your computer is OFF the binary sensor will be ON and thus the by-pass will be ON deactivating the motion sensor. When you turn your computer ON the by-pass will be OFF and the motion will be active.

Some Notes:
This part in the code; ‘sensor.your_computer_power_sensor_here’ you will need to change to suit your power (smart plug watts) entity ID. They normally read watts so the “85” will need to be adjusted to your computer watts. Example if your computer watts when ON reads 100W and OFF reads 5W then 85 will be ok. But just adjust that works best for you.

1 Like


great news! I will test the new version soon .
THX a lot :slight_smile: !!


so the Helper works flawlessly. I was wondering if one could use on of those ikea Zigbee buttons like the coffee maker button. Seeing that the helper works I thought the Ikea button could work😀.

I really thank you for the time you put into our comments😀

As long as the button has a ON & a OFF state for the by-pass it will work.

No problem at all, happy to help. :slightly_smiling_face:

No problem at all, let us know how you go. :slightly_smiling_face:

I tested version 2.0 with the Lux option set to “YES”, but I have the feeling that it didn’t bring any improvement.

@fakorte Can you please confirm if you are just using only scenes? (no individual light selection) If so I will do a FAQ for this on how to resolve it.

@fakorte I will do a FAQ for the LUX option. This will also help if someone is having a similar problem. It will be my next post.

FAQ - Ambient Light Sensor & Site Conditions

If you have only selected scenes in the “Lights - Switches - Scenes” or in “Night Lights” then continue to read. If you have selected an entity in “Lights - Switches - Scenes” or when using “Night Lights” you have an entity selected then it should work.

Sometime when setting the “Ambient Light Sensor - Site Conditions” to “YES” it doesn’t keep the lights ON and appears that this option isn’t doing anything. This can happen when you haven’t selected an entity in the “Lights - Switches - Scenes” or in "Night Lights when using this option.

The easiest way to resolve this is to add just one light or switch (entity) from your scene to the “Lights - Switches - Scenes” or into “Night Lights” when using this option. If it is a scene then do not remove the lights from your scene, just add one light or switch (an entity) again separately to the automation. The scene should still adjust the lights to your liking. If you have a light in your scene that has no special settings (brightness, colour, effect etc) then it is best to add that light separately.

Below show the scene added to the automation. In the scene, it has many lights, all with different settings.

Below shows the same scene added. It also shows one light form the scene added separately. This is how it should look like.

Now you will find that your selection “YES” in the “Ambient Light Sensor - Site Conditions” will work and function correctly.

PS: The “YES - My Ambient Light Sensor is affected by the Lights” option need just one entity added into “Lights - Switches - Scenes” and or “Night Lights” when using this option. An entity will provide the ON / OFF state to the automation so it can function correctly. Scenes do not have an ON / OFF state and is the reason why we need to enter in an entity :wink:


Blacky :grinning:

Back to FAQ: Click Here

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

1 Like

Thank you very much, that looks very helpful I will test it soon. I really only had scenes in my automation

No problem, your welcome :slightly_smiling_face:

Hi, great blueprint thanks!

Is it possible to adapt this for check to see if known people are at home?

I have pets and they’re forever triggering these types of things, so I need a way to stop this from running if no-one is at home. I have the zone.home to check against as well as a person group.

I tried it with a scene and a single device (that is also in the scene) and it still doesn’t work… :triumph:

alias: Sensor light Kueche Nacht
description: ""
  path: Blackshome/sensor-light.yaml
      - binary_sensor.zb_ms_kueche_occupancy
        - scene.szene_sensor_light_kueche_nacht
      device_id: 648d94f5811833b627d23b8da05897a5
      - scene.szene_sensor_light_kueche_aus
    time_delay: 2
    ambient_light_sensor: sensor.zb_ms_kueche_illuminance_lux
    ambient_light_value: 4
    motion_bypass: input_boolean.dauerlicht_kuche
    include_bypass: bypass_enabled
    include_ambient: ambient_enabled
    after_time: "21:00:00"
    before_time: "06:00:00"
    include_time: time_enabled
    ambient_light_options: ambient_light_option_enabled

@fakorte So close :slightly_smiling_face: It can’t be a device. It must be a entity with a ON / OFF state. This is what we are looking for. Drill into the device and just add the entity your turning ON and OFF or just select a separate light or switch.

@romprod I will PM you.