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

The “off” state in @redmumba post sounds the same as the “ambient” lighting state in my last post where after dark and between certain times the lights come on at a low level brightness.

New update 4.5

:warning: Some work is required in this upgrade. Please see below on the steps required when upgrading. It is easy and not a breaking change.

New Feature :new:

Trigger Sensor By-pass - Switch"

You can now have multiple by-pass switches :partying_face:

What can this now do? :thinking:

You can now have multiple By-pass that will disable your automation. It is a good easy way to now enable or disable multiple automation using the one by-pass (helper) and having multiple by-passes you can choose any by-pass that suit you when you turn it ON. It can work like a group or just be a stand alone by-pass. You can also have automations turn a by-pass ON, like my sensor light add on blueprint :rocket: Example of some by-pass you could now include in your automations are;

  • All light Automations
  • Party Mode
  • Guest Mode
  • Night Time
  • Sleep Mode
  • Movie Mode
  • Upstairs Lights
  • Downstairs Lights
  • Bedroom Lights
  • Smoke Alarm
  • Alarm System
  • Kitchen Lights
  • Etc

Now you have more control over your automations and it will work better with my :infinity: Sensor Light Add On - Media & Movie Lights - House Alarm Lights - Smoke Alarm Lights & Exhaust Fans + More blueprint. We are also getting ready for more to come in the road map ahead :wink:

:warning: :stethoscope: STEPS REQUIRED WHEN UPGRADING :white_check_mark:

If you have never selected to use a by-pass then most likely you won’t need to do anything but you may want to check just encase you have selected by-pass in the past.

1 - Upgrade your blueprint.
2 - Go into your automation (the ones using this blueprint). If you have entered in a by-pass then you will see a missing input. If you don’t see this missing input then you have never selected it and your all good to go, your done. If you see it then continue on.

3 - Click the 3 dots top right and “Edit in YAML”.

4 - We are looking for the words or input called “motion_bypass: ???”

3

You have 2 options you can choose from;

  • Delete this line,(“motion_bypass: ???”)

    5

  • Edit the code as shown below but with your entity ID

    4

        motion_bypass: 
          - input_boolean.halway_lights_by_pass
    

5 - Then click 3 dots and select “Edit in visual editor”

9

6 - Depending on what option you have chosen above in step 4 you will see this.

7 - Click save, you’re done. Now just do the same in your other automations using this blueprint.

TIP
If you would like to easily find all the automation that are using this blueprint so you can check your YAML. Go into blueprints and click on the 3 dots next to the sensor light blueprint and select “show automations using this blueprint” You then can easily edit them all. See below.

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:

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

2 Likes

New update 4.6

:warning: If upgrading from Version 4.4 please read the post above.

Bugs Fixes :bug:

  • Fixed an bug in HA Restart By-pass not preforming the correct action.
  • Fixed an bug in HA Restart By-pass producing error logs.
  • Fixed an bug in HA Restart light Transition.
  • Fixed an bug in By-pass “Enable the By-pass - Turn lights ON” normal lights not working correctly.

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:

Enjoy

Blacky :grinning:

Yes, exactly what was said here, @Blacky – also, your blueprints are amazing and I really appreciate your work!

@Blacky

Just wanted to say thank you for this piece of awesomeness!

For personal intrest: is it technically not possible to automate based on whenever a area is active, and then turning on all the lights in an area or is groups just more reliable?

And +1 for the “option to dim the lights for an interval before Turing them off” feature.

Thanks again!

Your welcome and thanks for the kind words.

1 Like

@matrover

Your welcome and thanks for your kind words.

At that start I did do this. In version 3.2 I removed it as “Targets” are complex. Now I can make it work more reliable and it resolved so many things I was facing. I kept “Targets” because is is a realy nice way to find your entities and it is realy easy to expand down.

:wink: your welcome, glad you like it :+1:

I have 5 outdoor hue lights around my house and 2 hue PIR - sensor with builit in light sensor outside. I tried to trigg the automation on low lux around <20 to just have them when it’s dark. The problem is that the sensor is not far away from the lights so when it turns on the lux goes above 20 and then the automation stops triggering. Maybe I’m doing something wrong but how can a solve my problem?

I also tried to use the sun elevation but the problem is that my garden is a litte hidden buy other houses and it’s very diffrent lighting so I don’t think it works for me but I only tried the defualt -1.5 settings.

Also is there some backup if the sensor that detecting the lux is offline can it be trigger anyway like always.

Im running the system on a rpi4 + skyconnect

Blacky, I have an automation turning on a light by way of a motion sensor. It’s in a hallway, I don’t need the light to come on when it’s bright, light coming through the windows, but if the hallway and front entrance is dark, I want the light to come on.
I’ve used the bypass for ambiant light, but it comes on too often when the light is actually sufficient. So which value makes it less likely to come on. Put another way, what’s the right value if I don’t want the light to come on unless it is getting dark.

alias: Front Hall Light on with Motion & Lumens
description: Front Hall Light on with Motion & Lumens
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.front_hall_motion_and_presence_sensor_motion_detection
    light_switch:
      entity_id: light.front_door_dimmer_switch_z_wave
    time_delay: 3
    include_light_control:
      - use_brightness
      - use_transition
    light_brightness: 60
    light_transition_on: 1.5
    light_transition_off: 1.5
    include_night_lights: night_lights_enabled
    include_night_light_control:
      - use_brightness
      - use_transition
    night_light_transition_on: 1.5
    night_light_transition_off: 1.5
    night_lights_conditions:
      - sun_enabled
    night_time_delay: 3
    include_sun: sun_disabled
    sun_elevation: -1.5
    night_lights_sun_elevation: -1.5
    night_lights:
      entity_id: light.front_door_dimmer_switch_z_wave
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.front_hall_motion_and_presence_sensor_illuminance
    ambient_light_options: ambient_light_option_enabled
    ambient_light_value: 50

FAQ - Template Sensors?

Below are some template sensors. This is done in the modern configuration way that Home Assistant would prefer. You still can use the Legacy way but HA no longer recommended it. Template have also been added to helpers and a lot of these can now be added that way. See below for more information on Template Helpers. Trigger templates still need to be added to the configuration.yaml file.

If you choose to add your template sensor to your configuration.yaml file for it to take effect you have 2 options.

  1. Go into Developer Tools > YAML and click Template Entities.
  2. Restart Home Assistant.

Every time you change the code, you will need to do one of the 2 options above for the changes to take effect unless you decided to use a template helper.

Even though the heading may reflect a particular type of sensor, the format can be changed to suit your needs.

I have put them under heading Trigger Sensor, but a lot of the same sensors can also be used as a by-pass switch.

If you are adding multiple sensors to your configuration.yaml file you will only need to put the heading template: once at the top followed will all your sensors below this heading. Example;

template:
# Define state-based template entities
  - sensor:
      ...
  - binary_sensor:
      ...

  # Define trigger-based template entities
  - trigger:
      ...
    sensor:
      ...
    binary_sensor:
      ...

Using a Template Helper in Home Assistant

To create a Template Helper:

  1. Navigate to Settings > Devices & Services > Helpers (tab at the top).
  2. Click Create Helper and select either Template - Binary Sensor or Sensor, depending on your needs.
  3. In the “State template” field, add the state code from the examples provided (e.g., REF - TS-9).
  4. Submit your changes. You don’t need to restart Home Assistant or reload the template; changes are applied automatically when you click submit.

If you have questions or need assistance with templates, the community is a great resource. Feel free to post a new topic in the forum for help.

Icons In Templates

For all the icons you can choose from Click Here


TEMPLATE SENSORS EXAMPLES BELOW

:zap: TRIGGER SENSORS

REF - TS-1

:honeybee: Bee In The Hive Sensor :honeybee: (“This is a realy nice sensor I love” :heart: )

The following code lets you create an occupancy sensor, called Bee In The Hive, for rooms like your bathroom, toilet, or any other space. To set it up, you’ll need a contact sensor on the door and a motion sensor in the room. After creating the Bee In The Hive sensor, you will need to set up a sensor group… click here for instructions if needed. When creating the group, add both the Bee In The Hive sensor and your Motion sensor (but not the door contact sensor). Finally, use this group as the trigger in your blueprint.

The 10 second delay in the code allows the motion sensor time to clear once no one is in the room and the door is closed. You may need to adjust this delay to match your sensor’s reset time. For example, if your motion sensor takes around 1 minute to clear, set the delay to approximately 70 seconds. You might need to test it a few times to find the optimal setting for your setup. To do this, trigger the motion sensor, close the door, and stand outside the room. The light should turn OFF after the set delay time in the blueprint. Alternatively, you can add your sensors to a dashboard to monitor their status in real time, as shown below.

22

In this example, we’ll show how our Queen Bee :honeybee: enters the bathroom for a relaxing bath. The purpose of this sensor is to determine when someone (the Queen Bee) is in the room once the door is closed. Here’s how it works in different scenarios:

  1. The door closes, and the motion sensor is triggered – This indicates that the Queen Bee is in the hive (the room). She won’t be able to exit without opening the door first.
  2. The door closes while the motion sensor is already ON – If the motion sensor remains ON after a 10-second delay, we know the Queen Bee is in the hive. She will stay there until the door is opened.
  3. The door closes, but no one is in the hive – If the Queen Bee isn’t in the room, the motion sensor should clear within the 10-second delay. In this case, the occupancy sensor will not turn ON, and the lights will turn OFF as usual.

When scenarios 1 or 2 apply and the Queen Bee :honeybee: is in the room, this sensor will stay ON until the door is opened.

The purpose of this sensor is to keep the light ON for as long as the Queen Bee is in the room, no matter how still she sits reading her book in the bath or taking a shower, where the motion sensor might not detect her. When she’s done, she’ll open the door, and the sensor will turn OFF right away (signaling the Queen Bee :honeybee: has left the hive :wave:). At this point, your automation will function normally, relying on the motion sensor.

I thought I’d have a bit of fun with the description above. Hope you don’t mind!

The reason we need to group the sensors: When you enter the room and trigger the motion sensor, the light will turn ON as usual, based on the blueprint. The added Bee In The Hive occupancy sensor ensures that the light stays ON in situations where the standard motion sensor alone might not. Grouping the Motion sensor with the Bee In The Hive sensor allows the automation to function smoothly, achieving the intended results.

Below is the code for the :honeybee: Bee In The Hive :honeybee: sensor

The items you need to change:

  • binary_sensor.your_door_sensor_here - This is your door contact sensor.
  • binary_sensor.your_motion_sensor_here - This is your room motion sensor.

Optional customizations:

  • "Bee In The Hive" - The name of your new sensor. Feel free to choose any name you like.
  • Device class ("occupancy") and icon ("mdi:account-box-outline") - Customize to fit your preferences.
  • "10" - The time (in seconds) that your motion sensor needs to clear after the door closes if no motion is detected.
template:
  - trigger:
      - trigger: state
        entity_id: binary_sensor.your_door_sensor_here
        to: "on"
      - trigger: state
        entity_id: binary_sensor.your_door_sensor_here
        to: "off"
        for:
          seconds: 10
      - trigger: state
        entity_id: binary_sensor.your_motion_sensor_here
        to: "on"
    binary_sensor:
      - name: "Bee In The Hive"
        device_class: occupancy
        icon: mdi:account-box-outline
        state: >
          {{ is_state('binary_sensor.your_door_sensor_here', 'off') and is_state('binary_sensor.your_motion_sensor_here', 'on') }}

REF - TS-2

CCTV Camera Motion Sensor

The below code is if you would like to add a delay to your cameras motion sensor. This can be handy when bugs are flying around triggering the cameras motion sensor providing false triggers.

The things you will need to change are;

  • binary_sensor.your_camera_motion_sensor_here = this is your camera motion sensor

The things you can change to your liking are:

  • “CCTV Camera Front Yard” = This is the name you would like to call your new sensor.
  • device class “motion” and icon “mdi:cctv”. = Change to your liking
  • “2” = This is the time your motion sensor must be ON before it will report a value.
template:
  - binary_sensor:
      - name: 'CCTV Camera Front Yard'
        device_class: motion
        icon: mdi:cctv
        state: >
          {{ is_state('binary_sensor.your_camera_motion_sensor_here','on')}}
        delay_on:
          seconds: 2

REF - TS-3

Power Sensor

The below code is if you would like to add a power sensor as the trigger. When it is ON and above 85 watts then your sensor will be ON (Detected). When it is below 85 watts then it will be OFF (clear). This can be useful for when your computer is ON and you would like the lights to stay ON. It can prevent you from waving your arms around to keep the lights ON. This can be used in a group sensors Click Here with your motion sensor. It will make sure the lights stay ON when the computer is ON.

TIP: If your computer go into standby mode, make sure you set the power level between standby power consumption and the power consumption when it is running. Then when you forget to turn the computer OFF and your computer goes into standby mode, your lights will still turn OFF.

The things you will need to change are;

  • sensor.your_computer_power_sensor_here = this is your sensor that monitors the power

The things you can change to your liking are:

  • “Work Computer Power” = This is the name you would like to call your new sensor.
  • device class “power” and icon “mdi:laptop”. = Change to your liking
  • “85” = This is the power in watts that it must be above for the sensor to be ON (Detected).
template:
  - binary_sensor:
      - name: "Work Computer Power"
        device_class: power
        icon: mdi:laptop
        state: >
          {% if states('sensor.your_computer_power_sensor_here')|float > 85 %}
            on
          {% else %}
            off
          {% endif %}

REF - TS-4

ON Sensor

The below code is if you would like to add a sensor for your TV when it is ON. It can be anything you like with an ON / OFF state. In this example it is handy to keep the lights ON when the TV is ON. This can be used in a group sensors Click Here with your motion sensor to make it more reliable so you don’t need to wave your hands around when sitting still watching TV. It can also create a switch, light, etc (different domain) into a binary sensor so it can be added as a trigger into the automation.

The things you will need to change are;

  • switch.your_tv_sensor_here = this is your ON (TV) sensor.

The things you can change to your liking are:

  • “Family Room TV” = This is the name you would like to call your new sensor.
  • device class “running” and icon “mdi:television”. = Change to your liking
template:
  - binary_sensor:
      - name: "Family Room TV"
        device_class: running
        icon: mdi:television
        state: >
          {{ is_state('switch.your_tv_sensor_here', 'on') }}

REF - TS-5

Garage Door Sensor

The below code is if you would like to add a sensor for when you open the garage door.

TIP: Sometimes you can use the button or the remote receiver that has a quick ON / OFF state. This can be useful as every time you open and or close the garage door the light will turn ON for as long as you set the delay time, to then turn OFF the lights. It is best when you also have a motion sensor in the garage and then use a group sensors Click Here. You will then add the group sensor into the trigger in the automation.

The things you will need to change are;

  • switch.your_garage_door_sensor_here = this is your push button and or remote receiver sensor.

The things you can change to your liking are:

  • “Garage Door Lights” = This is the name you would like to call your new sensor.
  • device class “garage_door” and icon “garage-open-variant”. = Change to your liking
template:
  - binary_sensor:
      - name: "Garage Door Lights"
        device_class: garage_door
        icon: mdi:garage-open-variant
        state: >
          {{ is_state('switch.your_garage_door_sensor_here', 'on') }}

REF - TS-6

Garage Door Sensor - Auto OFF

The below code is if you would like to add a sensor for when you open the garage door and if the door says open it will automaticity turn OFF after X amount of time (5 minute shown below). This way when you open the garage door your light will turn ON for X amount of time (5 minute shown below) and then turn OFF.

Note: If the door is opened the sensor will go ON. If the door closes the sensor will stay ON until the time has passed.

TIP: When grouped with a motion sensor if your door is opened then garage lights will be ON for X amount of time and then turn OFF if no motion is detected. If your door is open and the lights are OFF then motion will be the trigger to turn the light ON. If the door is closed then motion is the trigger. It is a realy nice way to set up your garage lights.

The things you will need to change are;

  • input_boolean.your_garage_door_sensor = this is your garage door sensor.

The things you can change to your liking are:

  • “Garage Door Auto Off” = This is the name you would like to call your new sensor.
  • “5” = This is the minutes the sensor will be ON for when your garage door sensor changes to an ON state.
  • device class “garage_door” and icon “garage-open-variant”. = Change to your liking
template:
  - trigger:
      - trigger: state
        entity_id: input_boolean.your_garage_door_sensor
        to: "on"
    binary_sensor:
      - name: "Garage Door Auto Off"
        device_class: garage_door
        icon: mdi:garage-open-variant
        auto_off: 
          minutes: 5
        state: "true"

REF - TS-7

Inverted Sensor

The below code is if you would like to add a sensor that is inverted. If your actual motion sensor is ON this sensor will be OFF. If your actual motion sensor is OFF this sensor will be ON. We have used a motion sensor in this example but it can be any type of entity that you would like to invert the state of.

The things you will need to change are;

  • binary_sensor.your_inverted_sensor_here = this is your contact motion sensor.

The things you can change to your liking are:

  • “Inverted Sensor” = This is the name you would like to call your new sensor.
  • device class “motion” and icon “mdi:motion-sensor”. = Change to your liking
template:
  - binary_sensor:
      - name: "Inverted Sensor"
        device_class: motion
        icon: mdi:motion-sensor
        state: >
          {{ is_state('binary_sensor.your_inverted_sensor_here', 'off') }}

REF - TS-8

By-pass Person Sensor

The below code is if you would like to add a by-pass to disable your automation when someone is in the zone. This can be used if you would like security lighting to only come ON when no one is in the zone.

The things you will need to change are;

  • device_tracker.your_phone_here = this is your phone you are tracking.

The things you can change to your liking are:

  • “By-pass When We Are Homer” = This is the name you would like to call your new sensor.
  • device class “presence” and icon “mdi:home”. = Change to your liking
# to track one phone then see below.

template:
  - binary_sensor:
      - name: "By-pass When We Are Home"
        device_class: presence
        icon: mdi:home
        state: >
          {{ is_state('device_tracker.your_phone_here', 'home') }}

# If you would like to have more than one phone to track then see below.

template:
  - binary_sensor:
      - name: "By-pass When We Are Home"
        device_class: presence
        icon: mdi:home
        state: >
          {{ (is_state('device_tracker.your_phone_here', 'home')) or (is_state('device_tracker.your_phone_here', 'home')) }}


REF - TS-9

TV Power Sensor with some Safeguards

The below code is if you would like to add an additional TV trigger with your motion sensor to your automation so the lights will stay ON even when you are sitting still watching TV and your TV is ON. This is if you don’t have a TV status in HA. You will need to have a smart plug that measures watts (power). We are also going to add some safeguards in so if you restart HA or just if the smart plug becomes unavailable or unknown for a short time the light will stay ON if the light is already ON. Once you created this template binary sensor you will need to group it with your motion sensor.

We are going to show a different way this time to the above templates. You can adopt this method with any of the templates shown here as long as the template is not a trigger template.

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 set the device class to power (You can chose anything you like here) and in “State Template” paste the code below replacing the two inputs with your entity ID’s

  • sensor.smart_plug_current_consumption = Your smart plug
  • light.Your_light_or_switch_here = Light or switch used in “Lights - Switches - Scenes - Scripts”.
{% if states('sensor.smart_plug_current_consumption')|float(0) > 50 %}
  on
{% elif is_state('sensor.smart_plug_current_consumption', 'unavailable') and
  (is_state('light.Your_light_or_switch_here', 'on')) %}
  on
{% elif is_state('sensor.smart_plug_current_consumption', 'unknown') and
  (is_state('light.Your_light_or_switch_here', 'on')) %}
  on
{% else %}
  off
{% endif %}

:sunny: AMBIENT LIGHT SENSORS

REF - ALS-1

LUX / Illuminance Sensor

This sensor is when your sensor reacts to fast and as a result it turns the lights ON and OFF too fast. This can happen when you have cloudy days and you using the ambient (LUX) sensor for day time. By slowing down the reporting time we can get a better reading so the automation works better. If you can adjust your sensors reporting time then it is best to do it there rather than creating this sensor.

What this sensor does;

  • The LUX value is set it to 10. If you would like 20 then you would set it to 20. This will be the same reading that is in your automation.
  • When your lux sensor drops below 10 it has to stay below 10 for 1 minute before it will report a value. The value will never be the accurate reading but we are just interested if it is below 10.
  • When your lux sensor rises above 10 it has to stay above 10 for 1 minute before it will report a value. The value will never be the accurate reading but we are just interested if it is above 10.
  • If the sensor becomes ‘unavailable’, ‘unknown’ or ‘none’ the sensor will report “0.0 lx”. This is a safe guard so by default the light will come on.

The things you will need to change are;

  • sensor.your_sensor_here = this is your lux sensor

The things you can change to your liking are:

  • “10” = this is the LUX value you would like to set.
  • “1” = This is the time your sensor must be below or above before it will report a value.
  • “Illuminance Sensor” = This is the name you would like to call your new sensor.
template:
  - trigger:
      - trigger: numeric_state
        entity_id: sensor.your_sensor_here
        below: '10'
        for:
          minutes: 1
      - trigger: numeric_state
        entity_id: sensor.your_sensor_here
        above: '10'
        for:
          minutes: 1
      - platform: state
        entity_id: sensor.your_sensor_here
        to: 
          - 'unavailable'
          - 'unknown'
          - 'none'
        for:
          minutes: 1
    sensor:
      name: "Illuminance Sensor"
      device_class: illuminance
      unit_of_measurement: lx
      state: "{{ states('sensor.your_sensor_here') | float(0.0) }}"

REF - ALS-2

LUX / Illuminance Sensor With A Default Value

This sensor is when your sensor keeps going ‘unavailable’, ‘unknown’ or ‘none’ and stops the automation from running. It will report a default LUX value of “0.0 lx”. Example below of sensor.

23

24

The things you will need to change are;

  • sensor.your_sensor_here = this is your lux sensor

The things you can change to your liking are:

  • “Lux Sensor With A Default Value” = This is the name you would like to call your new sensor.
  • unit_of_measurement “lx”, device class “illuminance” and icon “mdi:brightness-5”. = Change to your liking
template:
  - sensor:
      - name: "Lux Sensor With A Default Value"
        device_class: illuminance
        icon: mdi:brightness-5
        unit_of_measurement: lx
        state: "{{ states('sensor.your_sensor_here')|float(0.0) }}"

CONCLUSION

More information on template sensors can be found on the official Home Assistant website Click Here

I hope this gives you a better understanding on how we can use template sensors in our blueprints.

If I haven’t got the template sensor for you? then please let us know and I will add it.

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

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

8 Likes

@jonas18z1

Hi Jonas, firstly welcome to the community :wave:

In :Ambient Light Sensor - Site Conditions" please enable “YES - My Ambient Light Sensor is affected by the Lights”.

I will put this in the above post on how to do this. Just give us some time to set it up.

Blacky :smiley:

@harryfine

This is best controlled by a illuminance (LUX) sensor so you would use “The Ambient Options”.

If your LUX sensor is effected by the lights when they turn ON then in site conditions you would select “YES - My Ambient Light Sensor is affected by the Lights”. By selecting that the LUX sensor is only considered before the lights are turned ON.

The problem you can face is if your LUX sensor react to fast, by clouds and of the like. I have just added a FAQ for template sensors. More will be added and I will also show some tips on how to make adjusting them easer in the coming days. I just published my first one " LUX / Illuminance Template Sensor". This will create a new sensor using your LUX sensor and slow the reporting down. Don’t be concerned by the sensor not updating or if it is accurate as the automation just need to know if it is below or above the setting we choose. So if you are finding that when clouds pass over your lights keep turning ON and OFF due to the LUX sensor this can help.

Have a read of it and if you have any questions just ask Click Here

Blacky :smiley:

@harryfine

Sorry Harry I didn’t realy answer your question.

Each LUX sensor can report slightly different values. Everyone has a different opinion as to what value is acceptable. There is probably a standard that is required and that would depend on what country / state you live in. I would recommend to do some research to find your standard. If this is not a concern to you then you could just watch you sensor and the light level in you hall to determine what value you would like. I would always want the light to come ON more often as having more light is better than not enough light and it will only be ON for the time you pass through. Example; in my hallway, the light always comes ON regardless.

Makes sense

Hi All, thought I would give a shout out and let you know I created some template sensors a few post up that may help you with this blue print.

I have had some requests in the past to create / add a new feature for occupancy. @cirkator suggested it a while back, so I created a template sensor that hopefully will do the trick :crossed_fingers:. I called it “Bee In The Hive”. You can find out more information on it by Clicking Here.

Hope you like it

Blacky :smiley:

I am having some family troubles :slight_smile: …mostly when we have guests as they get confused and stand there pressing the switch repeatedly trying to get it to turn on or off.
At the moment the switch is fully disabled as the light is 100% controlled via the presence sensor.

Maybe it is possible and I jsut dont know, but I think we really need the following:

  1. A way to trigger this on when a switch changes state; but critically to not force the light on permanently. So maybe when the trigger changes state it activates the light for X time. So they ‘feel’ like they have done something, and then when they are in the room the presence sensor can take over…

  2. A way to force the light off; so when they leave they can press the button and when we see the switch change state it will turn off the light even though the presence sensor is still active. Again maybe we need to debounce for a minute or so.

One key point in above is that it is not about switch position itself, it is a change in state of the switch. IE: What happens if they just walk in as the sensor does everything, but when they leave they dont see it going off so they press the button.

3 Likes

@Brad_Ford

Thanks for reaching out and your suggestion :+1:. It is always nice to get ideas. I will put it on the list of suggestions.

Blacky :smiley:

2 Likes

@jonas18z1

Hi Jonas, sorry for the delay. I have now included a FAQ Template Sensor for you in the above post. It is under the heading;

REF - ALS-2
LUX / Illuminance Sensor With A Default Value

You will need to create the template sensor as described in the post and add this sensor into the automation as your “Ambient Light Sensor”.

Blacky :smiley:

1 Like

Thanks! Many times

1 Like

Hi there,I just upgraded from 2.4 to 4.6 and let me say this Blueprint is amazing…thanks for the hard work !

However ( there is usually a however :slight_smile: ), I am struggling getting the “Bee in the Hive” Setup to work. IN my case trying to raise the WAF by preventing the light to go off :slight_smile: .

What I have done so far:

Doorsensor
Motion Sensor ( Cleares after about 40 secs )

  - trigger:
      - platform: state
        entity_id: binary_sensor.sensor_klotur_window_door_is_open
        to: "on"
      - platform: state
        entity_id: binary_sensor.sensor_klotur_window_door_is_open
        to: "off"
        for:
          seconds: 50
      - platform: state
        entity_id: binary_sensor.hue_motion_sensor_1_motion_6
        to: "on"
    binary_sensor:
      - name: "Jemand im Klo"
        device_class: occupancy
        icon: mdi:account-box-outline
        state: >
          {{ is_state('binary_sensor.sensor_klotur_window_door_is_open', 'off') and is_state('binary_sensor.hue_motion_sensor_1_motion_6', 'on') }}
  • created a template.yaml with this in it that is referred to in configuration.yaml
sensor: !include sensors.yaml
template: !include template.yaml
  • Created a Helper Group with both of them in it
  • Created an Automation
  • Set the Trigger Sensor as the above created Group
  • Light-Switches set to Entity of the Light
  • Time Delay set to 2 Mins
  • Light Control set to Brightness ( 100% )
  • Ambient Option enabled ( set to illuminance of the Motion Sensor )
  • Night Light enabled

everything else is disabled.

Now when I enter the room, close the door the light still goes off after 2 mins.

I am missing something, right ?

Thanks !