šŸ’” Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

Thanks for this Blueprint.
I am trying to automate my garage lighting, and mounted a momentary switch with an in-wall dimmer. You know, for the WAF factorā€¦ a motionsensor controls the lights with help of your blueprint. I read that choosing a scene is under development, but if a device has a level-setting, why not just use that in the blueprint?

Other question, is it possible to use the momentary switch with a double tap as the bypass?
Thanks again!

Hi @ConTS10 happy the hear that the blueprint is working for you.

Spoil alert, I have scenes working in this blueprint and it will be in my next release. Scenes is used by 99.6% of the active installations so it make sense to include it into this blueprint.

I havenā€™t used this but maybe have look at the Shelly i4. I believe this will allow you to have a switch with 3 actions.

Thanks for your reply!

I did not mean to imply that it does not make sense at all :wink: I just thought it would also make sense to have an entry with a percentage in the blueprint to. Not only on/off, but a level as well.

The Shelly I4 looks nice, but my question about the double tap is about the existing switch with which I can control my lights manually. It is not specific to your blueprint, but a general question. I made a helper switch for being able to use the bypass. I was wondering of I can have some script that detects a double tap of momentary switch on the zigbee dimmer, to toggle that helper switch.

I think it is possible, I will investigate. Thanks for your replies!

All good, I did think about adding a light % as well as it is just quick an easy to set. So yea this may be added in the futureā€¦ will put it on the list. :+1:

I think it is possible to but havenā€™t tested itā€¦ if you do test it could you let us know how you go.

Thanks

Hi There,

This seems to be the most complete blueprint i saw in the area of lighting. While not a blueprint, i have built several automations with motion sensors (i donā€™t use sun elevation or Lux though) and perhaps i can outline some ideas:

In the below code i use:

  • Time of the day to activate certain scenes. For example, after 22:00 i activate a scene in which the brightness is 10%
  • My biggest problem was that if i was in a room and wasnā€™t moving much, the sensor would turn the light off. I do have a manual override switch but usually the light is already off until i remember to press it :slight_smile: The way that i fixed that, is i made the automation not to turn the light off immediately, but rather reduce the brightness. Example: my motion sensor, has timeout 1 min. When the sensor will timeout, instead of turning the light off, i turn the light to 50% brightness indicating visually that there was no motion. If i continue not to move, for another 10 seconds, the light will drop to 1% and if i donā€™t do anything it will finally turn off after another 10 seconds. This way, i give to myself a visual guidance that either i need to move, or press the override button. Perhaps you can consider implementing such a solution as optional.
  • In my kitchen i have a similar setup but the difference is through the kitchen, i go to the balcony (usually to smoke). The light from the kitchen, illuminates the balcony too but the motion sensor is located in the kitchen and does not face the balcony. This means, that when i am passing through the kitchen, the light will turn on, and while me being in the balcony it will turn off after 2 min since there is no motion. The override switch is also inside the kitchen. In order for me to avoid buying another switch, i found a cheaper solution by using an NFC tag in the balcony that overrides the motion sensor. Usually i have my phone with me. Perhaps itā€™s something you can consider as well as an option.

Here is the code of my automation including the scenes and reducing the brightness of one light:

alias: WC - Light on motion
description: Turns on the WC Light specific scenes based on time
trigger:
  - type: motion
    platform: device
    device_id: 27dcedeed0861d6e05aa677e910b9173
    entity_id: binary_sensor.ewelink_ms01_565bac23_ias_zone
    domain: binary_sensor
    id: WC Motion
  - type: no_motion
    platform: device
    device_id: 27dcedeed0861d6e05aa677e910b9173
    entity_id: binary_sensor.ewelink_ms01_565bac23_ias_zone
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 30
    id: Light Off
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: WC Motion
              - condition: time
                after: "22:00:00"
                before: "08:00:00"
                weekday:
                  - mon
                  - tue
                  - wed
                  - thu
                  - fri
                  - sat
                  - sun
        sequence:
          - service: scene.turn_on
            data: {}
            target:
              entity_id: scene.wc_warm_dim_light
      - conditions:
          - condition: time
            after: "08:00:00"
            before: "17:00:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - sat
              - fri
              - sun
          - condition: trigger
            id: WC Motion
        sequence:
          - service: scene.turn_on
            data: {}
            target:
              entity_id: scene.wc_neutral_light
      - conditions:
          - condition: time
            after: "17:00:00"
            before: "22:00:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
              - sat
              - sun
          - condition: trigger
            id: WC Motion
        sequence:
          - service: scene.turn_on
            data: {}
            target:
              entity_id: scene.wc_warm_light
      - conditions:
          - condition: time
            after: "22:00:00"
            before: "08:00:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
              - sat
              - sun
          - condition: trigger
            id: WC Motion
        sequence:
          - service: scene.turn_on
            data: {}
            target:
              entity_id: scene.wc_warm_dim_light
      - conditions:
          - condition: trigger
            id: Light Off
        sequence:
          - if:
              - condition: time
                after: "22:00:00"
                weekday:
                  - mon
                  - tue
                  - wed
                  - thu
                  - fri
                  - sat
                  - sun
                before: "08:00:00"
            then:
              - delay:
                  hours: 0
                  minutes: 2
                  seconds: 0
                  milliseconds: 0
              - type: turn_off
                device_id: 6a41513c104d9aee4ccec6c9237cc64b
                entity_id: light.wc_light_local
                domain: light
            else:
              - condition: state
                entity_id: binary_sensor.ewelink_ms01_565bac23_ias_zone
                state: "off"
                for:
                  hours: 0
                  minutes: 0
                  seconds: 30
              - service: light.turn_on
                data:
                  brightness_pct: 50
                target:
                  entity_id: light.wc_light_local
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 30
                  milliseconds: 0
              - condition: state
                entity_id: binary_sensor.ewelink_ms01_565bac23_ias_zone
                state: "off"
                for:
                  hours: 0
                  minutes: 0
                  seconds: 30
              - service: light.turn_on
                data:
                  brightness_pct: 10
                target:
                  entity_id: light.wc_light_local
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 30
                  milliseconds: 0
              - condition: state
                entity_id: binary_sensor.ewelink_ms01_565bac23_ias_zone
                state: "off"
                for:
                  hours: 0
                  minutes: 0
                  seconds: 30
              - type: turn_off
                device_id: 6a41513c104d9aee4ccec6c9237cc64b
                entity_id: light.wc_light_local
                domain: light
    default: []
mode: restart

New update 1.6

You have the option to add scenes.

Enjoy

Blacky :grinning:

Hi Michail, thanks for your input glad you like it. :grinning:

You can do this with this blueprint V1.6 (just added scenes). If you need more than one time just create a different automation using this blueprint.

That is a inherent problem with motion sensors. Some new sensors are out that have presence detectors. I havenā€™t got one (love to get may hands on one) but I read people are very happy with them. They have a slow first response but once they detect you, you can fall asleep and it will still keep the lights ON. People say to have a motion for the first response and then have the presence to keep the light ON.

There is a by-pass option where you could use a NFC tag or make a switch explained in the FAQ if you like but I would recommend just putting another motion sensor out there an adding it to the blueprint. Then you donā€™t have to think it just works.

New update 1.7

You can add any Binary Sensors you like as the trigger.

This blueprint can be more than just a sensor light. Check out Binary Sensors. Any trigger from OFF to ON can turn ON anything with a time delay to turn it OFF.

Enjoy

Blacky :grinning:

Hi, any chance you could add a by-pass/test for deferring the switch-off event rather than just by-passing the main execution? My use case is having the light persistently switch on while Iā€™m working from home. I have a magic button I click to set a WFH toggle sensor to ā€˜onā€™ with a 6 hr delay before it sets the WFH toggle back to off. It also does some other things to do with heating in the room.

In some scenarios I will manually turn off the light out of habit when I go down for lunch, but using your blueprint, the toggle sensor will by-pass/block the reactivation of the light in all scenarios including when the motion sensor detects me coming back into the room within the 6 hrs. I donā€™t want to reset the 6 hrs on that event, just trigger the light turning back on and blocking/deferring it turning off (even if Iā€™m sitting really still).

Thereā€™s probably already a way to do this, but it would be neat if embedded within your blueprint.

A reliable occupancy sensor would do the trick also!

-M.

Would it be possible to add a Color Temperature selector? This would make the blueprint perfect and complete for me. Thanks a lot for sharing!

1 Like

Try creating a scene with your colour temp and adding that scene. Make sure you create another identical scene with the lights OFF and put it in the scenes OFF.

Hi @mjsblume It is probably just me but I am not full understanding what is happening but I will try to answer your post.

  1. you have a magic button that you switch ON and then a time delay of 6 hours starts before it turns itself OFF.
  • If that magic button is also set in the blueprint it should disable any triggers you have and your lights should work as normal. If you go to lunch and you would like the light OFF you will have to turn it OFF manually. When you get back you will have to turn it back on manually. It will work like this until the magic button 6 hour time delay goes to OFF. If the light is turned ON and then the time delay goes to OFF the light will stay ON until a trigger happens and the blueprint automation runs.
  • If them magic button is not connected to the by-pass in the blueprint then it should work as normal. The light may turn ON and OFF if you sit still but that is a motion sensor.
  • If the magic button disables the motion sensor some howā€¦thenā€¦ not sure what is going on.

If the magic button is connected to the by-pass option in the blueprint and it is ON then this is how it should work. You will have to turn the light on manually.

I think you just need to manually turn the light back ON. If you donā€™t want to do that then a presence detectors is the go. I havenā€™t got mine yet as it all sold out but I will be getting one if he makes more.

1 Like

This is the best documented Blueprint Iā€™ve ever seen in this community.
Well done!!

And thanks for sharing!

5 Likes

FAQ - My light turns on but then turns off and stays off, or the automation isnā€™t working correctly with multiple trigger sensors or binary sensors.

Now, you can add any binary sensors youā€™d like as the trigger. However, the blueprint may not function correctly if more than one motion sensor or binary sensor is selected.

With the introduction of new presence sensors and contact/door sensors, you might encounter a scenario where the light turns off and stays off, even if the presence sensor remains in the ON state.

If youā€™re experiencing issues with multiple motion or binary sensors, and itā€™s driving you crazy, try following these steps to potentially resolve the problem.

ADD A GROUP HELPER

  1. Go to Settings > Devices & Services > click on the Helpers tab > click + CREATE HELPER and select Group.

  2. Select Binary Sensor Group.

    2

  3. Enter a name for the group, such as ā€œSensor Light - Front Door - Groupā€. Then, select the Members or entities that will be included in the blueprint automation. Ensure that the Hide Members and All Entities toggles are OFF, as shown below.

  4. Next, return to the automation and in the Trigger Sensor - Binary Sensors section, search for the group name you just created, such as ā€œSensor Light - Front Door - Groupā€, and select it. Ensure that only this group is selected here.

    If you need to add or remove entities, go back to the helper and edit it as needed (see below).

  5. Now, go through the blueprint and click Save. This should resolve your issues.

EDIT HELPER

If you need to edit the Helper, go to Settings > Devices & Services > click on the Helpers tab > select the helper you want to edit (e.g., ā€œSensor Light - Front Door - Groupā€) > click the cogwheel icon.

8

Then select Group Options.

You will then see your entities. Edit them as needed.

If youā€™d like to learn more about groups and their use, please click here.

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

Back to ā€œThe Settings & Best Practice Guidelinesā€ Click Here

3 Likes

Hi Edward, thanks for your kind words. It is nice to get feedback when people like it. :smiling_face_with_three_hearts:

Back to top: Click Here

3 Likes

FAQ - How do you update the blueprint from version 1.4 - 1.7 to version 1.8 and above?

New update 1.8

Before upgrading from Version 1.7 and below please see below upgrade options. If you are installing from new then you donā€™t need to do anything just install the blueprint.

  • More user friendly selection for enabling and disabling options.
  • Bug fix. Fixed a issue where light would not turn ON when option was made. Example: Using the new presence sensors, door sensor, contact sensor that hold their state to ON for long periods and one of the options being sun, LUX or time would pass through its condition and the light would remain OFF until you walk out of the room and entered again resetting the sensor or you would have to close the door and open it again because the trigger is in the ON state. Anyway it is fixed and is worth the upgrade.

UPGRADE OPTIONS

  1. Delete the automation, upgrade and set up again.
    or
  2. Follow the steps below.

Go into your automation and click on the three dots. Select ā€œEdit in YAMLā€

Check you ā€œambient_light_sensorā€ to see if the option is set to ā€œnoneā€. If you have a sensor here you can upgrade no need to read further. If you have ā€œnoneā€ then we need to change it.

1

Replace the ā€œnoneā€ with ā€œā€ code below.

    ambient_light_sensor: []

3

Click save. Now you ready to upgrade.

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

FAQ - Sun Elevation Condition

Why did you choose to use sun elevation?

I initially considered using Sunset and Sunrise, with a time offset but Home Assistant recommends using sun elevation for more consistent performance throughout the year. Following their advice, I opted for sun elevation. This is because the actual light level differs when using a fixed time after sunset or sunrise during winter versus summer. By setting a sun elevation, you achieve consistent light levels throughout the year.

How do I set up sun elevation settings for my lights in the blueprint?

Itā€™s really easy to set up. First, check your sun elevation degrees and set your Sun Elevation Falling and Sun Elevation Rising to match your specific location, as every site is different. The easiest way to do this is to add the sun solar elevation entity to your dashboard (see below). One evening, observe the sunset and note the elevation at which youā€™d like the lights to turn on. Set this value for Sun Elevation Falling. Repeat the process for sunrise, noting the elevation at which you want the lights to turn off, and set this for Sun Elevation Rising. Then, monitor to ensure itā€™s working correctly and meets your preferences. If adjustments are needed, you can easily make changes as necessary.

Note: If the slider doesnā€™t allow you to set your desired sun elevation degrees, simply type the value into the text box and click save.

135

Night Lights - Sun Elevation

When choosing to use a sun elevation condition for night lights, it is not necessary to enable the sun elevation condition for normal lights. The night lights sun elevation condition will function independently.

Note: If youā€™re incorporating sun elevation conditions for both normal lights and night lights, itā€™s recommended to use a lower value for night lights. This ensures smoother transitions and more accurate lighting adjustments based on ambient conditions.

Can the sun elevation be used to trigger the lights ON and OFF?

Yes, if the Trigger Sensor is ON (active, detected, etc.), the lights will turn ON and OFF when the sun elevation crosses the setpoints you have configured.

How do I add the Sun Solar Elevation Entity and Sun Entity to a Home Assistant Dashboard?

To add the sun solar elevation and sun entity to your dashboard, follow these steps:

  1. Access your Home Assistant instance through your web browser or the Home Assistant App.
  2. Navigate to the dashboard where you want to add the sun entities.
  3. Click on the pencil icon in the top right corner of the dashboard to enter edit mode.
  4. Click on the + Add Card button at the bottom right of the dashboard.
  5. In the pop-up window, scroll down and select the Entities card.
  6. If the card includes any default entities, click the X to remove them.
  7. Under Entities (required), click on the Entity dropdown and search for and select the Sun Solar Elevation (e.g., sensor.sun_solar_elevation) entity. This will display the sun elevation.
  8. Click on the next Entity dropdown and search for and select the Sun (e.g., sun.sun) entity. This will display whether the sun is ā€˜Above horizonā€™ or ā€˜Below horizonā€™.
  9. Optionally, give the card a title, such as Sun.
  10. Click the Save button to add the card to your dashboard.
  11. Click DONE in the top right corner to exit edit mode.

Now you will have the sun elevation and sun status displayed on your dashboard, allowing you to evaluate and adjust the sun elevation values for your automations.

136


Enjoy

Blacky :grinning:

Back to FAQ: Click Here

Back to ā€œThe Settings & Best Practice Guidelinesā€ Click Here

2 Likes

Hi Dude,

Nice Blueprint, I have a question.
Is it possible to start a script instead of a scene?
I use the Adaptive Lighting Integration and scenes unfortunately do not work with templates :confused:

1 Like

Hi @clipse , not currently in the blueprint but yes I could change it to also start a script.

Are you wanting to create a script that turns your lights ON and then create another script to turn your lights OFF just like scenes?

or

Are you wanting to start a script (Adaptive Lighting) and then let it do the rest?

Hi,

I just stumbled accross your blueprint and i think it is great :slight_smile: thank you for the hard work and sharing with the community.
I tried the blueprint on a basic light with a motion and a lux sensor and it works great !

However i fail to see why it doesnā€™t work all the time with multiple binary sensors as trigger. My case is that i have more then 15 lights that rely on motion (sometimes 2 of them), door, and lux sensors. I understand creating helpers ā€¦ willā€¦ help :slight_smile: but iā€™d like to use the blueprint as it was designed so i can change stuff quickly and see all info in one place.
I have automations that rely on multiple triggers and they work just fine.

Thank you !