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

Hi,

Initially I wanted to start controlling my lights based on circadian lighting using the adaptive lighting custom integration GitHub - basnijholt/adaptive-lighting: Adaptive Lighting custom component for Home Assistant which looks very good.

Then I also found this blueprint which looks amazing and also offers similar functions like color temp and brightness based on time of day and lux and also a night mode.

Before I start doing test use cases and spend lots of time I was wondering if anyone has done that already and knows both? What do you prefer? Where are major differences?

Thanks a lot!

I have a question to the bypass. You write that I should add the switch entity and depending on the setting my lights will go on, off or keep their state.

I use primarily Friends of Hue EnOcean switches (Friends of Hue Smart Switch - EnOcean) that are connected to HA via Zigbee2MQTT (same as the lights). These have 4 ā€œbuttonsā€ with multiple actions each (e.g. press, hold etc.). Currently they are setup (via automations) that one button turns lights on, one turns off, and other 2 call scenses.

In the blueprint I can select the switch e.g. under bypass switch - turn lights ON but how will be determined which action was triggered / which button was pressed? Or will simply any press on the switch turn the lights on? That would kinda defeat the purpose of the way the switches are setup.

Or do I understand this function completely wrong?

Hi Blacky,

Iā€™ll set the time to 60 as you suggest and work from there, Iā€™ll let you know how I get on.

Iā€™ll also set the ā€˜Triggerā€™ to end at 9pm ish and then have the ā€˜Night Lightsā€™ start at 10pm ish and see what happens.

How about the idea of running a new instance of your ā€˜Blueprintā€™ after the first instance has finished at say 9pm ish at 10pm ish and have it turn down the lights using your original ā€˜Dim the Lightsā€™ as the Sun drops even more over my horizon?

Iā€™ll try it and let you know how I get on after trying your idea re the 60 setting aboveā€¦

Again thanks for the helpā€¦

Iā€™m sure we/you will eventually crack it and it will help a lot more people with there home and outside lighting.

Best Regards,

Bobā€¦

PS: If I wanted to try and write my own code to drive something like my lights or whatever how would I get started? Iā€™ve done some code bashing many years back, done some assembler coding +++ some C+ coding so Iā€™m not exactly innocentā€¦

Any idea where I should start educating myself?

Regards,

Bobā€¦

Hi Backy,

This is my new YMAL.

A few points:
1, My lights can dim to 1% so no problem with this setting.

2, Iā€™ve set the lights to come on at sun set ,elevation falling, 0ā€™ (Donā€™t have a degrees sign) and off at Dusk -6ā€™ just to test.

3, Through the ā€˜Sunā€™ global option I have enabled only Sun Descending Action as I have set it to Elevation Falling between 1ā€™ and -7ā€™ ie: just before Sun Set and just after dusk. (Iā€™m in the UK and we are going into late Sun Setā€™sā€¦

4, Night Light set to transition 60 as requested down to 1ā€™ and stay on at 1ā€™ until turned off by the Trigger Helper (9.30pm off - 5 below)

5, Trigger Helper set to on at 3pm and off at 9.30pm - Iā€™m hoping this will turn the Test Light OFF for the night (9.30pm OFF).

Thanks yet again for your supportā€¦

Regards,

Bobā€¦

alias: Blacky Outside light tester
description: Blacky Outside Lights on and off test
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - schedule.a_test_light_schedule
    light_switch:
      entity_id: light.my_test_moer_zigbee_dimmer_light_2
    time_delay: 0
    include_light_control:
      - use_transition
    light_transition_on: 1
    include_dynamic_lighting: enable_sun_elevation_brightness_inv
    dynamic_lighting_min_brightness: 1
    dynamic_lighting_sun_elevation_start_falling: 0
    dynamic_lighting_sun_elevation_end_falling: -6
    include_sun: sun_enabled
    sun_elevation: 1
    include_night_lights: night_lights_enabled
    night_lights:
      entity_id: light.my_test_moer_zigbee_dimmer_light_2
    night_time_delay: 0
    include_night_light_control:
      - if_lights_are_on_adjust_when_crossing_over
      - use_brightness
      - use_transition
    night_light_brightness: 1
    night_light_transition_on: 60
    night_light_transition_off: 2
    night_lights_conditions:
      - time_enabled
    night_lights_after_time: "21:00:00"
    night_lights_before_time: "21:30:00"
    night_lights_sun_elevation: 0
    dynamic_lighting_sun_elevation_start_rising: -6
    dynamic_lighting_sun_elevation_end_rising: 0
    sun_elevation_rising: -7

Hy Blacky,

Iā€™m trying to implement weather bypass for motion sensors in following way:

  1. I do not possess ambient light sensor.
  2. Iā€™d like to be able to activate motion sensor lights if itā€™s ā€œcloudyā€ or ā€œrainā€ outside.
  3. It can be a simple helper switch automated to get ON or OFF state based on weather conditions.

In other words, Iā€™m trying to activate lights if it is a day (and with already existing settings lights would not turn ON) but if this helper switch is ON, it would bypass normal behavior and activate lights when motion is detected.

Something like this:

Many thanks for your help.

@hesspoint

The blueprint requires an entity that has a ON / OFF state. You may need to have your buttons toggle a toggle helper and then add the helpers to the blueprint. Not sure what you are doing in regards to your trigger and if you are wanting a button to be used as the trigger to run dynamic lighting or just the automation. You can do this by inserting your button entity ID into the YAML. To do this, just use any entity as the trigger then edit in YAML and swap over the entities IDā€™s.

If you had the buttons toggle a toggle helper and use those toggle helpers in the automation then you could have one button as the trigger, one button as the bypass and the other 2 you can keep what you have to call scenes but I am not sure what you are exactly trying to doing.

Blacky :smiley:

@Bobie

Hi Bobie

I will go through your points.

  1. Nice okay noted.
  2. These settings are for dynamic lighting to follow and because you have 1% in the ā€˜Min Brightness Valueā€™ is not for when the light comes ON. It is the linear line for dynamic lighting. Example. If you donā€™t use the sun global condition and just your schedule the light would turn ON at 3pm at 1% and when it get below 0Ā° the light will start to transition to 100% linear between 0Ā° to -6Ā°. When it gets to -6Ā° it will be 100%. This is all good the way you set it up just trying to explain the settings. See point 3 for when it comes ON.
  3. All good. The main setting we are looking at for your set up is ā€˜Sun Elevation Fallingā€™ @ 1Ā°. Because the schedule is 3pm well before 1Ā° the automation will wait for sun elevation to turn the light ON. When it gets to 1Ā° and below the light will turn ON @ +1% as per your ā€˜Dynamic Lighting - Min Brightness Valueā€™. This is what turns your light ON not point 2. Example, say your ā€˜Sun Elevation Fallingā€™ was set @ 5Ā°, between 5Ā° to 0Ā° your lights would be at 1%. Then the light will start to transition to 100% linear between 0Ā° to -6Ā° as per you dynamic lighting settings. I use ā€˜Sun Elevation Fallingā€™ @ 5Ā° in this example because your settings are 1Ā° to 0Ā° and this will happen quickly and you may not notice anything. All your settings are okay with what you have just trying to explain to hopefully make sense.
  4. That is good. Because your trigger helper set to on at 3pm and off at 9.30pm at 9:30pm is when the light will turn OFF. Because your ā€˜Night Lights - End Timeā€™ is also set to 9:30pm is should work without transition back to normal lights. If you would like to be safe then you could set your ā€˜Night Lights - End Timeā€™ to say 10pm. This setting of 10pm is not when the light will turn OFF as your trigger helper set at 9.30pm, it is for when night lights will be applied. I am just trying to avoid a flash of 100% brightness in the transition to OFF. Try setting your ā€˜Night Lights - End Timeā€™ to 10pm if you are getting a flash of 100%.
  5. Yes this will happen. It will start to transition OFF at 9:30pm and because you have 0 time delay with 2 sec transition delay it should be OFF at 9:30:02pm.

Looks like we finally got there.

Blacky :smiley:

@dr_digital

Okay, so you would like a condition that the motion sensor will only work if it is ā€œcloudyā€ or ā€œrainā€ outside.

What you can do is create a binary template sensor so when motion is detected and the helper switch is ON the binary template sensor is ON. Then use this binary sensor in your trigger not the motion sensor.

But not sure if you would like it to work at night when it is dark. If so in your helper switch for the weather you will need to make it so if it is day time and it is cloudy or raining then ON else ON. Make sure you put a day condition in it so the else ON will be ON at night. You could also just do all this in a binary template sensor also adding in your motion sensor and use this as the trigger.

Blacky :smiley:

Hello everyone,

Can anyone enlighten me on how I can add the motion detection time?
Iā€™m using a Hue Philips motion sensor, which, in normal automation, allows the detection time to be added (e.g.: on same places, I would prefer to only activate lights if movement is detected for 5 seconds).

Have a nice weekend!

Kind regards

@lmarcelocc

Some motion sensor can have this option in there settings. If not, to make it work you can create a template binary sensor using your motion sensor and put a delay in of 5 sec. I have template examples in the FAQ but here is the link to them, click here

The example you would use it REF - TS-2. Once you create this template binary sensor you would use it as your trigger and not your actual motion sensor.

Hope this helps you.

Blacky :smiley:

1 Like

@Blacky

Hi,

Thanks for the proposed solution. Although I know how to do it as a separate automation, I wanted to implement this feature as an addition to your marvelous blueprint. :blush:

It has all of the other features needed, but Iā€™m missing this one.

So either to add additional condition that will override currently inactive lights during the day via switch or by checking string value of a provided helper.

This is what Iā€™m trying to do. Form of a blueprint feature request :slight_smile:

And yes, you got it right. During the night it shouldnā€™t change behaviour.

Many thanks for support.

Hey again! That was a bit long but now i 100% know what this issue is caused by zigbee2mqtt new version which got updated few days before 2024.4 release. Zigbee2mqtt 1.36.1 have this issue with my Sonoff zigbee stick. And issue disappearing after i restore 1.35.3

@dr_digital

Okay, looking at your example above (the image) and your postā€¦ looks like bypass 2 is what you are looking for. This will disable the automation based on your helper and turn the lights OFF. The bypass is quite powerful in what it can do, it digs deep analyzing what it happening when the bypass turns OFF.

I understand you know how to do this but for the others reading I will provide an example.

If we create a template sensor helper that has some conditions that are, it must be day time + cloudy or raining and if not turn the helper ON else turn it OFF. In the code below I have added unavailable and partlycloudy in the example but you can remove them. Then when bypass is ON the lights will turn OFF if the conditions are met + the automation will be disabled. When the bypass turns OFF as the conditions are not met it will check the site conditions and preform the correct action. I have not tested this code just typed it out but it should work. We would enter this code into the ā€˜State templateā€™ of the template sensor helper.

EDIT I have updated the code.

{% set weather_state = states('weather.forecast_home') %}
{% if is_state('sun.sun', 'above_horizon') and weather_state not in ['partlycloudy', 'cloudy', 'rainy', 'unavailable'] %}
    on
{% else %}
    off
{% endif %}

Is this something that would work for you?

Blacky :smiley:

@Sk1vvy

Thanks for the update. I am glade you found it as these bugs can drive you crazy. Nice one :+1:

Blacky :smiley:

Hi. I am having issues when using this automation with IKEA Styrbar remote control for manual override. I connected this switch though ZHA but it does not create binary output. Instead, this switch generates zha_event with unique cluster_id and end_point_id.
Below is an automation written by Malte to control lights using this remote switch.
ZHA - IKEA four button remote (Styrbar) for lights (E2001, E2002) - Blueprints Exchange - Home Assistant Community (home-assistant.io)
Are there any possible way to use this switch for manual override control? Your input is much appreciated. Thank you.

@erichousetkc

Welcome to the community

What I would do is have the switch (IKEA Styrbar remote) toggle a ā€œToggle Helperā€ ON and OFF when you press the switch. I would then use the ā€œToggle Helperā€ in the bypass as they have an ON / OFF state.

To create a toggle helper go to settings > devices and services > click on helpers tab at the top > click create helper and select toggle.

Let us know how you go.

Blacky :smiley:

Iā€™m new to HA and a friend of mine helped me get started with your blueprint. Itā€™s really awesome. However there is one thing I could not figure out:

We have some color Hue lights and is there a way to set the color for those with your blueprint? The only thing Iā€™ve seen is to set the ā€œtemperatureā€.

@Blacky
Can the Night Lights - Entity State be a Motion Sensor?
Coming up the stairs, a motion sensor triggers the light in the hall (this is a Sensor Light BP) that leads to the bed and bathroom. The bathroom has a motion sensor too.
Using the Night option of the bathroom Sensor Light BP, I want the bathroom light to switch on when motion is detected by the hall (landing?) motion sensor, but only during the Night Time hours setting.
I tried to use the hall motion sensor as a Night Lights - Entity State for the bathroom but this does not work. Any suggestion how to get it working?

Hi Blacky,

Just been diagnosed with Covid!! :sneezing_face: :woozy_face: :face_with_spiral_eyes: :face_with_head_bandage: :face_with_thermometer: :roll_eyes:

I can read your words but canā€™t make out the sentencesā€¦

When Iā€™m better Iā€™ll have a better chance of understanding your reply aboveā€¦

Best Regards,

Bobā€¦ :face_with_spiral_eyes: :face_with_spiral_eyes:

Hi Blacky. Can you just point me in the right direction. Have motion sensor dimmable smart bulbs, I use night light feature for quieter light after 9pm and the bypass when a day/night helper binary toggle switches to night.

Soā€¦question is, I just bought a lux sensor from these Screek, love their esp32 5v radar sensors for motion. This one for lux is new, just released:

Anyway, Iā€™m already using the bypass for the day/night toggle. How would I also bypass the light turning on if the lux level is below a certain level?

Thanks