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

@andyblac

Similar to what @fbloemhof suggested. You create a script to enter in the “Scenes - Scripts To Turn OFF” input. When creating the script you will have a “if-then” and else similar to Fred.

Try it out and if you have any questions just ask.

Blacky :smiley:

2 Likes

@voydz

Yes that is correct. Scenes and scripts have no state not like a light or a switch and we know if it is ON or OFF. This is currently under review / development, I don’t like saying to much as it may not make it but keep an eye out.

Blacky :smiley:

I need to do some more testing but what I see now:

  • when Dynamic Lighting is enabled, the script and the automation interfere with eachother, so the automation will reapply the dynamic lighting settings
  • somehow my automation is not activating the lights anymore after disabling dynamic lighting, need to look into this

I try to use the IKEA Styrbar button for the by-pass light on and off option. This button is supported in ZHA and the 4 button press results are visible in the appliances as short/long press ON, OFF.
I don’t see the on/off state status as a entity to use in the by-pass, only battery and identifier. How can I use this IKEA button?

@fbloemhof

Dynamic lighting has a heartbeat so it is alive and has to be. Depending on how you use your scripts is whether it will interfere. Dynamic lighting needs to have light entities and the light entities need to support what your asking dynamic lighting to do. You wouldn’t turn a light on with a script to then have dynamic lighting control it by entering the lights used in the script. I have no idea on what you are doing but I thought I would give you some information and you may already know this.

If you select to disable dynamic lighting using the drop-down menu then it will disable it and return your light to normal control.

Blacky :smiley:

1 Like

@Fred54

Your IKEA Styrbar button will need to have an ON / OFF state. Go into development tools and under the states tab find your entity you are trying to use and test your IKEA Styrbar button to see what happens. You may need to create a toggle helper and have your IKEA Styrbar button toggel it ON and OFF. Then you can use the toggle helper as the by-pass.

This blueprint :nazar_amulet: Press Button - Turn ON & OFF Entities can help you achieve this.

Blacky :smiley:

I need some help. I love this blueprint btw… I use it for several automations… I have a new one that should be pretty easy, but I’m not sure how to do it. I have an motion sensor in the bedroom, multiple lights in the bedroom and a bed sensor. So, what I want to do is to turn on the lights whenever there’s motion in the bedroom, but NOT if there is someone in the bed. I have a binary_sensor call Is_Masterbed_occupied that is on if someone is in the bed and off otherwise. How can I do this? Thanks so much!

I configured a light entity for the ON and a script for the OFF and that seems to work but the automation keeps running and dynamic lighting continues to be enabled whilst the OFF command already was executed. Maybe I need some delay in my script?

@GGHack

Use your binary_sensor call Is_Masterbed_occupied and use option “2 - Enable the By-pass - Turn lights OFF” in the bypass and input it into the “By-pass Switch - Turn lights OFF”.

Blacky :smiley:

1 Like

I am not sure exactly what you are doing but once the automation if done then nothing is running. If motion is OFF the automation will still run until the time delay has expired.

Blacky :grinning:

Hi Blacky, not sure I understand the by-pass option correctly.
My goal, turn light on using a motion sensor during the time set and use manual buttons to turn the light on/off as long needed. The motion detection works as expected.
When I enable the by-pass on and off option I expect the light will still turn on when motion is detected. However, enabling the by-pass on/off options the motion detection stops working. My expectation is that both motion sensing and do a short press on the Ikea Styrbar ON button will turn the light on and stays on as long as no short press on the Ikea Styrbar OFF button is done.
Or must the ON state be active all the time, so not for short period?

I also created two helpers and in development status I see two entities changing state when the on or off button is pressed but using these two entities in the by-pass options the light does not turn on and off.

That did it! Thank you!!

I just love the blueprint, congrats to developer.

However I’d like to know if is it possible to prevent light turning off when I turn on the one manually?

Yeah, I see the By-pass, but I need to apply it to relay, so if I turn on the light on relay or app, the light will keep on, even with no more motion.

Blacky, still having trouble with multiple sensors (in group), one an aeotec motion sensor and the other a presence sensor, keeping a light on once it’s been triggered. Question. If I have 2 items in a group, both binary sensors, but they return different things (on-off vs detected-clear), will your Blueprint work as designed? I’m wondering if your blueprint is only responding to the on-off of the Aeotec motion sensor, and not the detected-clear of the presence sensor.

@Fred54

All good… your lights are coming on and off with motion.

Now you by-pass. What ever you use to turn the by-pass on and off the entity that turns ON / OFF must be seperate for each by-pass. Example,

Not sure how your Ikea Styrbar works but lets look at a few things.

Short Press

If a short press turns ON helper 1 and a short press again turns OFF helper 1 then that is good.
If a short press turns on a separate entity (entity 1) that you can use and a short press turns OFF entity (entity 1) then that is good to.

You then have a short press separate entity you can use in the by-pass.

Long Press

If a long press turns ON helper 2 and a long press again turns OFF helper 2 then that is good.
If a long press turns on a separate entity (entity 2) that you can use and a long press turns OFF entity (entity 2) then that is good too.

You then have a long press separate entity you can use in the by-pass.

By-pass

Option 1, 2 or 3 has to have a different entity for it to work. It can’t be the same entity used in each option.

  1. Option 1 = Short Press. When this happens and the entity 1 or helper 1 turns ON the light will turn ON.

  2. Option 2 = Long Press. When this happens and the entity 2 or helper 2 turns ON the light will turn OFF.

  • If both by-passes are ON they both have to turn OFF for motion to work again.
  • If both by-passes are ON and the light is OFF and you would like option 1 by-pass to turn the light ON then you must turn OFF option 1 and then turn it back ON again for the light to come ON.
  • If both by-passes are ON and the light is ON and you would like option 2 by-pass to turn the light OFF then you must turn OFF option 2 and then turn it back ON again for the light to turn OFF.

Now knowing this the best way to handle this is to decide what you would normally like to happen when the b-pass is turned ON. Would you like option 1 to turn the light ON, Option 2 to turn the light OFF or option 3 to keep the light in it current state being ON or OFF at the time you turn the by-pass ON. When the by-pass is ON (any option) you then can manually turn your lights ON or OFF as you wish and it will stay that way until you turn the by-pass OFF. When you turn the by-pass OFF it will evaluate your site conditions and preform the correct action. FAQ question below for more information on the by-pass.

Q: By-pass 101 - Every thing to know about the by-pass and how to use the “Trigger Sensor By-pass” without having a physical switch?

A: Please Click Here

Hope this helps.

Blacky :smiley:

Nice one thanks for letting us know.

Blacky :smiley:

@VCTGomes

Thanks

In HA the switch and the light are one entity. When you add the light in, motion can turn it ON / OFF then you can’t have the switch do something different as it is the one entity. Example, when motion turn on the “Light / Switch” it need to preform a set of actions and then turn it OFF. If you turn on the “Light / Switch” you can’t have this as a trigger to then run a different set of actions as this is what motion does. So we need to use a separate entity that will preform the actions we would like to do. This is the by-pass. If your light is turned ON by a relay then it is like any light you turn on in HA. The by-pass will turn ON or OFF the relay / light depending on the option you use in the by-pass.

Then you will need to choose option 1 in the by-pass.

Q: By-pass 101 - Every thing to know about the by-pass and how to use the “Trigger Sensor By-pass” without having a physical switch?

A: Please Click Here

Blacky :smiley:

FAQ - Understanding Group Functionality For The Trigger Sensor

To find out more about Groups from the official Home Assistant website please Click Here

How Groups Operate

In a group of motion or binary sensors, each sensor has an ON and OFF state. Home Assistant (HA) may represent these states in different ways (e.g., clear/detected), but they are fundamentally binary. When sensors are grouped, they function as a single entity. If any sensor within the group is ON, the group itself is considered ON. The group remains ON as long as at least one sensor is active. Conversely, if all sensors are OFF, the group switches to OFF.

Purpose of Utilizing Groups

Groups are useful when automations are triggered by multiple sensors. Typically, an automation focuses on the initial sensor that activated it. Subsequent activations by other sensors in the same group might be ignored, as the automation remains tied to the primary trigger. When the primary sensor deactivates, the automation ends, even if other sensors are still active.

Grouping helps address this by consolidating sensors. When the initial sensor triggers an automation, the group remains ON. If other sensors in the group activate before the initial sensor deactivates, the group status remains ON. The group stays ON as long as at least one sensor is active, even if the primary sensor has deactivated. It only turns OFF when all sensors in the group are OFF.

Testing Group Functionality

To ensure your group functions correctly, add it to your dashboard alongside the individual sensors. Trigger the individual sensors and monitor the group’s response. This will help identify any discrepancies or issues with the group’s functionality, allowing you to troubleshoot and optimize its performance effectively.

How to create a group of binary sensors to be used in the trigger sensor input Click Here

Hope this gives you a better understand of groups and why we use them for the trigger sensor.

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

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

@harryfine

Hi Harry :smiley:

I have just did a FAQ on groups. Have a read of it and please if you are still having any problems or this helped you then just let us know.

Also can you provide us your YAML again.

Blacky :smiley:

1 Like

I am still struggling with the best way to have my lights at a default state and have the Sensor Light blueprint brighten them when it is triggered.

I was thinking, maybe you can add an option to save and restore the state of the entities in a scene? HA allows to create and use scenes on demand.

I tried to keep it simple for my testing setup:

alias: Sensor Light - Achtertuin v3
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.achtertuin_motion_sensor_occupancy
    light_switch:
      entity_id: light.z2m_group_buiten_achtertuin
    end_scenes:
      - scene.achtertuin_10
    include_light_control:
      - use_brightness

The scene also as quite simple:

- id: '1706087837296'
  name: Achtertuin 10%
  entities:
    light.z2m_group_buiten_achtertuin:
      brightness: 128
      color_temp_kelvin: 2000
      friendly_name: Achtertuin
      state: 'on'
  icon: mdi:palm-tree
  metadata: {}

When the lights are off and motion is triggered, they turn on at 100% like expected. After the timeout the scene gets activated, also expected. But at the next motion trigger, nothing seems to happen.

The trace of the automation looks like this:

Not sure if there is anything else I can share.