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

Yes it is a trigger as well for ON and OFF.

Blacky :smiley:

@NoClaim

Please see the description on what it can do above. Try it out and see if it works for you.

Blacky :smiley:

1 Like

@bleomycin

Quick answer is no, you will always have a time delay as the automation started. Sometime over complicating things gets tricky.

Blacky :smiley:

@mountainbikert

Thanks for providing your YAML.

All looks good. One thing I can see is you said during the day your LUX value is 40.

Your Ambient Light - Low Lux Value is set to 50 so 40 is lower than 50 :thinking: your lights will come ON. Try setting this lower than 40. This setting allows the lights to come on when they are below the set value. I have tested it here again and it is working.

When your lights turn ON they will stay ON until the LUX value is above your Ambient Light - High Lux Value of 110 or the trigger turns OFF.

Let us know how you go.

Blacky :smiley:

Thank you, this helps me understanding how it works! Iā€˜ll try to find a way, for my usecase.

Maybe itā€™s a possible feature for a future release :wink:

Thanks for your help an your time supporting all the users

Thanks
Maxx

Thanks so much, I finally got it functioning as it should. My lux value is going up and down and constantly triggering the threshold value. Iā€™ve set it a bit lower and it seems to function quite well. Now letā€™s dive in the night light and dynamic lighting settings!

@mountainbikert

Nice one, glad you got it working. Have fun trying out the other options.

Blacky :smiley:

@Blacky

Hi Blacky! Thanks for this wonderful, state-of-the-art piece of craftmanship youā€™ve put up together here, brilliant work! Iā€™ve ditched all of my light automations and switched to yours one. Currently every single light bulb in my house is controlled with this blueprint.

After playing with those for more than a month now, scrolling back and forth through this forum - Iā€™m still finding myself with a bunch of questions Iā€™d like throwing, hope youā€™ll find a minute!

So here they come:

  1. Any ideas how to implement light triggered by motion sensor, but then maintained by presence one? In some of my rooms I have a pair of motion+presence and experienced false positives coming from presence sensors. Was wondering how to smooth them out :slight_smile:

  2. Currently Iā€™m using Dynamic Light Lux-based Inverted, since I like seeing the high-to-low brightness slope, but was wondering do you have any ideas (or plans maybe?) for implementing ā€œAdaptive Lightā€-alike functionality for gaussian-alike brightness curve, that could gradually increase and then decrease depending on LUX, time or other factors? :slight_smile:

  3. Have you been trying to marry your blueprint with Adapative Lightning by any chance? Iā€™ve tried running them both and they sorta work, but after your blueprint kicking in, second lighter AL would adjust brightness resulting in flickering symptom. Not cool. So was wondering how to squeeze best of two worlds.

  4. Iā€™m having some problems with Nanoleaf-wood lights, where upon turning on, they ramp up quickly with brightness, to then slowly dash downward to whatever Iā€™ve configured. Gimmick is, these are my staircase night-helpers, so it kinda hurts to get smacked by all those lumens during night. Could I share my YAML here maybe?

  5. Another issue I have is that, I really could never get ā€œBypass STOP / aka Keep current lightsā€ to work. Iā€™ve got binary_sensor being set to True, but regardless light will still trigger. Had to eventually work around that by enabling/disabling light automation, but wondered how else could I troubleshoot it?

  6. I think it could be worth stating in blueprint docs, that when using Time trigger, that would need to encompass Night Time period as well, otherwise when time_enabled and doesnā€™t include the night, night mode wonā€™t kick in. At least thatā€™s what Iā€™ve learned the hard way. :slight_smile:

  7. Any plans on adding maybe another field like ā€œCustom Actionā€ to run whenever light turns ON or turns OFF? I really like the logic you came up with and would love to jack in there with my actions if possible!

Would love to hear your thoughts on above ones!

Big fan of all the things you share to the community, Blacky! :fire:

Best regards,
Mariusz.

PRESENCE SENSOR JUST NOT WORKING: Hi @Blacky. I highlighted the topic here so I could follow it more easily.

As you know Iā€™ve been using this automation for months and love it. Iā€™m using a combination of motion and lately, powered (5v) radar presence sensors. Sometimes a helper group containing a presence sensor (using both its motion and presence entities) and a motion sensor is what triggers the automation. The presence sensor is one of several different models Iā€™ve purchased from https://docs.screek.io/., a small Shenzhen company who is making reasonably priced innovative sensors.

The problem is not the triggering. The problem is the presistence of the light switch remaining on while the person remains in the zone. I have changed sensors to eliminate a hardware issue. Iā€™ve changed sensor settings, deleted and re-created the automation several times, made sure Iā€™m using the most current version of the automation. Iā€™ve simplified the automation taking out luminence. Iā€™ve made sure All Sensors is not enabled in the group settings. Yet, the problem persists.

Front-hall-occupancy

Using this card, I can watch the 3 sensor entities in the hall. The three are comprised of:

  • An Aeotec Multi-sensor 6 for sensing motion
  • Currently the SCREEK F2 a 24G radar based on an LD2410 chip. This provides both motion and presence info.

Together, they form the Occupancy Group, the entry on the bottom. I move into the front hall, all 4 lights go on. The z-wave switch turns on the light. I remain there, moving around. All 4 lights entities remain on. But then after a minute or so, the light goes off.

Iā€™ve been struggling with this for over a month, trying to work it out, but itā€™s making no sense to me at all. Do yo have any ideas?

alias: Front Hall Light On with Motion by Sensor Group
description: Front Hall Light On with Motion by Sensor Group
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.front_hall_motion_and_occupancy_sensor_for_light
    light_switch:
      entity_id: light.front_door_dimmer_switch_z_wave
    include_light_control:
      - use_brightness
      - use_transition
    time_delay: 2
    light_brightness: 60
    include_night_lights: night_lights_enabled
    night_lights:
      entity_id: light.front_door_dimmer_switch_z_wave
    night_time_delay: 3
    include_night_light_control:
      - use_brightness
    night_light_brightness: 10
    night_lights_conditions:
      - time_enabled
    night_lights_after_time: "22:00:00"
    night_lights_before_time: "06:00:00"

@MariuszBit

Thanks for your kind words.

I will try and go through each point.

1 - You have to group them.

2 - I have never looked at gaussian-alike brightness curve. I have looked at time but I got distracted and put it on the back burner.

3 - I have never used Adaptive Lightning but I know some people have used it with success.

4 - When the automation turns the light ON is just sends the data you requested example 10%. Dynamic lighting option can send data high first then slowly adjust lower so for night time if using dynamic lighting try just setting a set value and donā€™t use dynamic lighting. If you are not using dynamic lighting then if the light goes 100% to then your set value of say 10% it will be in your light not the automation.

5 - Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on ā€œ</>ā€ and paste code in there.

6 - Have a look at the link in the time condition. I takes you to exactly what your are asking with a :+1: and a :-1: in the example.

7 - It may not look like it but this blueprint has a lot of scenarios (moving parts) and I have tried to make them all work together even linking other blueprints of mine. If I added actions it could prevent it from working correctly. What actions are you trying to do?

Blacky :smiley:

@harryfine

Hello Harry :wave:

Everything you are doing appears to be good.

If you can hold your phone and walk around seeing that the group is ON and the light goes OFF there are a few things that we can test.

  1. Create a toggle helper. Then go into the automation and edit in YAML. Change / replace your group ID with the toggle helper ID and click save. Then toggle ON the helper and your lights should turn ON and stay ON until you toggle the helper OFF.
    • When you leave it ON if your lights turn OFF make sure another automation didnā€™t trigger and turned it OFF. Go to point 2
    • If they stay ON then you will know the problem is in the group helper and or sensors in the group. Go to point 3
  2. When you leave the helper ON and your lights turn OFF: You can look in the history to see what turned it OFF or you can go into the automation and look at the ā€˜last triggeredā€™ column and look for a automation that was just triggered.
  3. Add you group back in removing the toggle helper. Then trigger it again and follow point 2. If you canā€™t find anything delete the group. Reboot system, not a restart but a reboot. Create a new group with a different name so you get a fresh entity ID. Make sure everything is correct in the groupā€¦ add it in and test it :crossed_fingers:

Let us know how you go.

Blacky :smiley:

Hi.

Im using this to control my bathrooms lights, however I find it annoying when entering at night and the lights turns on.
I could ofcourse set it only to work at night, but if Im actually awake and goes to the bathroom I want them to work so I dont want a fixed time.

I think what would be perfect is to only turn on the lights in the bathroom only when the lights outside of the bathroom is turned on. Is this possible to do?

Blacky

4h

  1. Create a toggle helper. Then go into the automation and edit in YAML. Change / replace your group ID with the toggle helper ID and click save. Then toggle ON the helper and your lights should turn ON and stay ON until you toggle the helper OFF.

DONE

  • When you leave it ON if your lights turn OFF make sure another automation didnā€™t trigger and turned it OFF. Go to point 2

LIGHTS STAYED ON. Only other automation that triggers that switch is the front door opening and closing using your automation. That automation works great.

  • If they stay ON then you will know the problem is in the group helper and or sensors in the group. Go to point 3

2. When you leave the helper ON and your lights turn OFF: You can look in the history to see what turned it OFF or you can go into the automation and look at the ā€˜last triggeredā€™ column and look for a automation that was just triggered.

  1. Add you group back in removing the toggle helper. Then trigger it again and follow point 2. If you canā€™t find anything delete the group. Reboot system, not a restart but a reboot. Create a new group with a different name so you get a fresh entity ID. Make sure everything is correct in the groupā€¦ add it in and test it

I have now deleted both the old group and the toggle helper. I then rebooted. Going to create a new group with only one hardware device at a time and see what happens.

Thanks Blacky

Hi @Blacky! Thanks for finding time to address my questions.

Let me write you back on them:

  1. I do use groups to figure out movement/presence based on multiple sources, but that doesnā€™t address my use case. I want the motion to turn ON the lights and then presence to keep them ON. Any idea how that could be implemented?

  2. Yes, thatā€™s probably something to do with my light, will troubleshoot, thanks!

  3. Hereā€™s YAML for my dining room presence-based light. The last line points to the binary_sensor that when turned ON, should prevent automation from doing anything:

- id: '1705796620857'
  alias: Światło - Obecność Jadalnia
  description: ''
  use_blueprint:
    path: Blackshome/sensor-light.yaml
    input:
      zone: zone.home
      motion_trigger:
      - binary_sensor.grupa_czujnikow_obecnosci_jadalnia
      light_switch:
        entity_id: light.jadalnia
      time_delay: 2
      include_light_control:
      - use_transition
      light_transition_on: 5
      light_transition_off: 5
      include_dynamic_lighting: enable_lux_controled_brightness_inv
      dynamic_lighting_lux_sensor: sensor.stacja_pogodowa_solar_lux
      dynamic_lighting_max_lux: 3000
      dynamic_lighting_min_lux: 40
      dynamic_lighting_max_colour_temp: 4000
      dynamic_lighting_max_brightness: 100
      dynamic_lighting_min_brightness: 40
      motion_bypass_lights_on: []
      include_sun: sun_disabled
      include_device_tracker: zone_enabled
      include_night_lights: night_lights_enabled
      include_night_light_control:
      - use_transition
      - if_lights_are_on_adjust_when_crossing_over
      night_light_transition_on: 5
      night_light_transition_off: 5
      night_light_colour_temperature: 3000
      night_lights_before_time: 06:00:00
      sun_elevation: -0.35
      night_light_brightness: 30
      night_lights:
        entity_id: scene.jadalnia_nocna
      light_brightness: 80
      light_colour_temperature: 4000
      night_lights_conditions:
      - time_enabled
      night_time_delay: 1.3
      include_ambient: ambient_enabled
      ambient_light_sensor: sensor.stacja_pogodowa_solar_lux
      ambient_light_value: 2500
      ambient_light_high_value: 3000
      motion_bypass_lights_off:
      - input_boolean.domownicy_spia
      include_bypass:
      - bypass_enabled_turn_off
      - bypass_enabled_stop
      include_bypass_auto_off: []
      motion_bypass_lights_stop:
      - binary_sensor.bypass_swiatla_timer_jadalnia_uruchomiony
  1. With regards to custom actions, I was thinking to implement my own logic for ensuring trigger wasnā€™t a false positive (I use presence sensors, they tend to turn on my lights ever now and then without anyone being in room, I wanted to pop in some actions resulting in full STOP preventing automation from triggering when I sense nobodyā€™s in the room)

8. Also, would have forgot, recently I started observing some exceptions getting thrown from some of the automations based on the blueprint, would you mind taking a look?

2024-02-21 22:29:36.334 ERROR (MainThread) [homeassistant.components.automation.swiatlo_obecnosc_kuchnia] Światło - Obecność Kuchnia: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Choose at step 3: Dynamic Lighting -  Lux Controlled Brightness - Inverted for the normal lights switch: Error executing script. Error for repeat at pos 1: Error rendering data template: ZeroDivisionError: float division by zero
2024-02-21 22:29:36.338 ERROR (MainThread) [homeassistant.components.automation.swiatlo_obecnosc_kuchnia] Światło - Obecność Kuchnia: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Error executing script. Error for choose at pos 3: Error rendering data template: ZeroDivisionError: float division by zero

Hereā€™s the relevant YAML:

- id: '1705627611445'
  alias: Światło - Obecność Kuchnia
  description: ''
  use_blueprint:
    path: Blackshome/sensor-light.yaml
    input:
      motion_trigger:
      - binary_sensor.grupa_czujnikow_obecnosci_kuchnia
      light_switch:
        entity_id: scene.automatyczne_swiatlo_w_kuchni
      end_scenes:
      - scene.kuchnia_swiatlo_wylaczone
      time_delay: 0.5
      include_sun: sun_disabled
      include_time: time_disabled
      after_time: '16:00:00'
      before_time: 06:00:00
      include_device_tracker: zone_enabled
      zone: zone.home
      sun_elevation: -0.35
      night_lights:
        entity_id: scene.automatyczne_swiatlo_w_kuchni_wieczor
      night_time_delay: 0.3
      include_night_light_control:
      - use_brightness
      - use_colour_temperature
      - use_transition
      - if_lights_are_on_adjust_when_crossing_over
      night_light_brightness: 30
      night_light_colour_temperature: 2500
      night_light_transition_on: 3
      night_light_transition_off: 4
      include_night_lights: night_lights_enabled
      night_lights_before_time: 06:00:00
      night_lights_after_time: '23:00:00'
      include_ambient: ambient_disabled
      ambient_light_sensor: sensor.stacja_pogodowa_solar_lux
      ambient_light_value: 2500
      ambient_light_high_value: 3000
      include_dynamic_lighting: enable_lux_controled_brightness_inv
      dynamic_lighting_lux_sensor: sensor.stacja_pogodowa_solar_lux
      dynamic_lighting_max_lux: 3500
      dynamic_lighting_min_lux: 40
      dynamic_lighting_max_colour_temp: 4000
      dynamic_lighting_max_brightness: 100
      dynamic_lighting_min_brightness: 40
      include_light_control:
      - use_transition
      light_transition_on: 2
      light_transition_off: 3
      night_lights_conditions:
      - time_enabled
      include_bypass:
      - bypass_enabled_turn_off
      - bypass_enabled_stop
      motion_bypass_lights_off:
      - input_boolean.domownicy_spia
      - input_boolean.movie_mode_salon
      motion_bypass_lights_stop:
      - binary_sensor.bypass_swiatla_timer_kuchnia_uruchomiony

Anything stands out here?

You could use night lights. Then create a script for night lights an use a if-then-else action. So if the outside lights are on turn on light else turn off light.

Hope this helps you.

Blacky :smiley:

1 Like

@harryfine

No problem. At least you are on a path to find out what is wrong. We know the automation works. Hope you can find it and if you need any help please ask.

Thanks for keeping us in the loop.

Blacky :smiley:

@MariuszBit

No problem.

1 - Currently you have to use group. 99% of the time your motion will turn ON the light as they react faster then presence sensors. If your presence is ON it is irrelevant if motion is ON or not. However if you would like to do what you are asking you will need to create a template sensors that will handle your action.

3 - all looks okay the only thing is to check your bypass has a ON and OFF state. It must stay ON to keep the bypass active.

7 - This would be a condition not a action. So you can create a template sensor and use it in the bypass. I can see in my head that you will be up for challenges and conflicts. I personalty would make my presence sensor work correctly.

8 - You are using a scene for dynamic lighting and you canā€™t do that. It must be a light entity that has the ability to preform that actions you are requesting.

Blacky :smiley:

Hi @Blacky ,

Thanks for your replies. Iā€™ve started experiencing more and more issues lately, resulting with exceptions I canā€™t really nail down myself. Could you help me out, Iā€™m lossing my mind here?

Exception 1:

2024-02-23 19:28:37.867 ERROR (MainThread) [homeassistant.components.automation.swiatlo_sypialnia_lozko] Światło - Sypialnia ÅĆ³Å¼ko: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Error executing script. Error for choose at pos 3: Error rendering data template: AttributeError: 'list' object has no attribute 'lower'
2024-02-23 19:28:44.159 ERROR (MainThread) [homeassistant.components.automation.swiatlo_sypialnia_lozko] Światło - Sypialnia ÅĆ³Å¼ko: Choose at step 1: default: Error executing script. Error for parallel at pos 4: Error rendering data template: AttributeError: 'list' object has no attribute 'lower'
2024-02-23 19:28:44.160 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 572, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2332, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 883, in __call__
    state = _get_state(self._hass, entity_id)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1136, in _get_state
    return _get_template_state_from_state(hass, entity_id, hass.states.get(entity_id))
                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1760, in get
    return self._states_data.get(entity_id.lower())
                                 ^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'lower'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 366, in async_prepare_call_from_config
    render = template.render_complex(config[conf], variables)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 236, in render_complex
    render_complex(key, variables, limited, parse_result): render_complex(
                                                           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 242, in render_complex
    return value.async_render(variables, limited=limited, parse_result=parse_result)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 574, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: AttributeError: 'list' object has no attribute 'lower'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/trace.py", line 283, in async_wrapper
    await func(*args)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1096, in _async_parallel_step
    raise result
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1088, in async_run_with_trace
    await self._async_run_script(script)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1100, in _async_run_script
    result = await self._async_run_long_action(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 943, in _async_choose_step
    await self._async_run_script(script)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1100, in _async_run_script
    result = await self._async_run_long_action(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/trace.py", line 283, in async_wrapper
    await func(*args)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 916, in _async_repeat_step
    await async_run_sequence(iteration)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 842, in async_run_sequence
    await self._async_run_script(script)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1100, in _async_run_script
    result = await self._async_run_long_action(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 943, in _async_choose_step
    await self._async_run_script(script)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1100, in _async_run_script
    result = await self._async_run_long_action(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 694, in _async_call_service_step
    params = service.async_prepare_call_from_config(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 373, in async_prepare_call_from_config
    raise HomeAssistantError(f"Error rendering data template: {ex}") from ex
homeassistant.exceptions.HomeAssistantError: Error rendering data template: AttributeError: 'list' object has no attribute 'lower'

Corresponding YAML:

alias: Światło - Sypialnia ÅĆ³Å¼ko
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    zone: zone.home
    motion_trigger:
      - binary_sensor.grupa_czujnikow_obecnosci_lozko
    light_switch:
      entity_id: scene.sypialnia_lozko_relaks
    time_delay: 2
    include_light_control:
      - use_transition
    light_brightness: 70
    light_colour_temperature: 2000
    include_sun: sun_disabled
    after_time: "16:00:00"
    include_time: time_disabled
    include_night_lights: night_lights_enabled
    include_device_tracker: zone_enabled
    before_time: "01:00:00"
    motion_bypass_lights_stop:
      - binary_sensor.bypass_swiatla_timer_sypialnia_uruchomiony
    include_bypass:
      - bypass_enabled_turn_off
      - bypass_enabled_stop
    include_bypass_auto_off: []
    night_lights:
      entity_id: scene.sypialnia_lozko_chinatown
    night_lights_conditions:
      - time_enabled
    night_lights_after_time: "23:00:00"
    night_lights_before_time: "01:00:00"
    night_light_brightness: 30
    include_night_light_control:
      - use_brightness
      - use_transition
      - if_lights_are_on_adjust_when_crossing_over
    end_scenes:
      - scene.sypialnia_swiatlo_wylaczone
    motion_bypass_lights_on: []
    night_lights_entity_state:
      - binary_sensor.czujnik_obecnosci_sypialnia_pokoj
    include_ambient: ambient_disabled
    ambient_light_sensor: sensor.stacja_pogodowa_solar_lux
    light_transition_on: 2
    light_transition_off: 3
    include_dynamic_lighting: enable_lux_controled_brightness_inv
    dynamic_lighting_max_lux: 3500
    dynamic_lighting_max_brightness: 100
    dynamic_lighting_min_brightness: 0
    night_time_delay: 1
    night_light_transition_on: 2
    night_light_transition_off: 3
    motion_bypass_lights_off:
      - input_boolean.domownicy_spia

Problem 2:

The light never turns ON. Current time: 19:30 (7:30 PM), itā€™s pitch black outside. YAML:

alias: Światło - Obecność Łazienka DĆ³Å‚
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    zone: zone.home
    motion_trigger:
      - binary_sensor.grupa_czujnikow_obecnosci_lazienka_dol
    light_switch:
      entity_id: light.lazienka_dol
    time_delay: 0.3
    include_light_control:
      - use_colour_temperature
      - use_transition
    light_brightness: 80
    light_colour_temperature: 3500
    light_transition_on: 1
    light_transition_off: 3
    include_dynamic_lighting: enable_lux_controled_brightness_inv
    dynamic_lighting_lux_sensor: sensor.stacja_pogodowa_solar_lux
    dynamic_lighting_max_lux: 6000
    dynamic_lighting_min_lux: 400
    dynamic_lighting_max_colour_temp: 4000
    dynamic_lighting_max_brightness: 100
    dynamic_lighting_min_brightness: 0
    include_sun: sun_disabled
    sun_elevation: -0.35
    include_time: time_disabled
    after_time: "16:00:00"
    before_time: "06:00:00"
    include_device_tracker: zone_enabled
    include_night_lights: night_lights_enabled
    night_time_delay: 0.5
    include_night_light_control:
      - use_brightness
      - use_colour_temperature
      - use_transition
      - if_lights_are_on_adjust_when_crossing_over
    night_light_colour_temperature: 2000
    night_light_transition_off: 3
    night_light_brightness: 20
    night_lights_conditions:
      - time_enabled
    night_lights_before_time: "06:00:00"
    night_lights:
      entity_id: light.lazienka_dol
    motion_bypass_lights_on:
      - input_boolean.bypass_swiatla_lazienka_dol
    ambient_light_sensor: sensor.stacja_pogodowa_solar_lux
    ambient_light_high_value: 5000
    ambient_light_value: 4500
    ambient_light_options: ambient_light_option_disabled
    include_ambient: ambient_disabled
    include_bypass:
      - bypass_enabled_turn_on
    night_light_transition_on: 3

Problem/Question 3:

Iā€™m using Dynamic Lightning - Lux Controlled Inverted. I would like to have the light start at 100% brightness when outdoor LUX surpasses certain threshold, and then gradually decrease onto letā€™s say 40%.

That being said, I want the minimal brightness to reach 40% and then not go any lower.

When I set dynamic_lighting_min_brightness: 40 the light turns ON randomly during the day - even during morning, when outdoor LUX has like 30kLUX.

Any ideas how to achieve that?

Question 4

Is it possible to prevent blueprint from turning OFF lights that werenā€™t turned on automatically? Use case:

  • Iā€™m outside the Kitchen. Then I turn on kitchen lights using Hue Mobile App.
  • Then I enter kitchen.
  • I want them to stay for as long as I need (regardless what kitchen sensors say)

Any ideas how to make something like this happen?

Best,
Mariusz.

Hi,

I have 3 Shelly motion sensors that I have combined into a group as my trigger. The daytime timing schedule seems to work fine but the night time doesnā€™t work (lights donā€™t turn on). Any ideas why this is like this?

alias: Hall Lights
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.hall_motion_sensors
    light_switch:
      entity_id:
        - light.hall1
        - light.hall2
    time_delay: 15
    include_light_control:
      - use_transition
      - use_colour_temperature
      - use_brightness
    light_brightness: 31
    light_colour_temperature: 2700
    after_time: "16:00:00"
    before_time: "23:59:59"
    include_night_lights: night_lights_enabled
    night_lights:
      entity_id:
        - light.hall1
        - light.hall2
    include_night_light_control:
      - use_brightness
      - use_colour_temperature
      - use_transition
    night_light_colour_temperature: 2700
    night_lights_after_time: "00:00:00"
    night_lights_before_time: "08:59:00"
    end_scenes: []
    include_time: time_enabled

@MariuszBit

Sure lets see how we go.

You cant use a scene. A lot of information on dynamic lighting can be found in the FAQ. Here is the link directly to it. You will have to expand the settings areas to see all of it.

You have your ā€˜Dynamic Lighting - Min Lux Valueā€™ set to ā€˜0ā€™. You will need to change it to a min value or ā€˜0ā€™ = lights OFF.

Have a read of the FAQ and see if that helps you. It has graphs and everything you will need to know.

You will need to use a bypass for this.

Hope this helps you.

Blacky :smiley: