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

Good question :slight_smile:
I have ambient light enabled, and sun elevation disabledā€¦ But still the automation stops because of sun elevationā€¦

@tiantianisfox

No, sun elevation and ambient as well as time are all conditions so you can use them but you donā€™t need to use them for dynamic lighting. It is totally up to you if you would like to use the condition in the automation.

Blacky :smiley:

@beurdy

If you have ambient light enabled then this must be true (condition met) for the automation to run. You can do this in dynamic lighting but it all depends on what option you have selected. You have full control over what happens it is just getting your head around that sun, ambient and time are all conditions that must be true for the automation to run.

Blacky :smiley:

hey @Blacky , generally loving this blueprint so thanks, and thanks for all your help so far. iā€™m trying to use it to replicate a very specific use case which is, effectively, the room lighting app from hubitat. iā€™ll explain and hopefully you can tell me either how to achieve it, or if i just need to set a couple of different automations up:

  1. turn lights on on motion, set to a constantly variable brightness based on lux and also follow the sun through the day to decide the colour temperature. (this works, but i find the Adaptive Lighting integration gives me better colour temperature variance than the sun elevation in this app. any idea why?). so nothing to see here really, this use case works perfectly.
  2. bypass / supress the automation if a given switch is on. again, this works perfectly really, no problem
  3. this is the one thatā€™s got me scratching my head. i want totally different behaviour at night time as i have cats in the room. i have a helper which turns on when my house alarm goes into armed night mode. when armed night, i want the lights in this room to turn on low and red for a few seconds when motion is detected on a completely different motion detector (i.e. out in the hallway where the cats canā€™t go but i do if i come downstairs). i donā€™t want the motion detector that triggers the lights during the day involved at all. is there anyway to do this, i.e. supress the ā€˜triggerā€™ motion detector and just have the other motion detector work? (i have setup a mixed group helper which turns on when itā€™s night and motion is detected on the OTHER detector; this group works well, but doesnā€™t affect the automation as iā€™d hoped as it still just seems to turn on when there is motion on the main detector).

really hope you can help; if itā€™s not possible then i can clearly run a couple of different automations but i like simple, and i like to have as many things as possible in one placeā€¦

thanks again
ian

Hello @Blacky.
Is it possible to add different motion triggers for day and night modes?

@Blacky
I am attempting to figure a way to add a humidity sensor to keep the lights on as the wife LOVES to keep the door slightly ajar while showering so that the door sensor doesnā€™t trigger. Is there anyway to do that?
Thank you!

@iandogherty

  1. I am assuming you are talking about dynamic lighting when you say sun elevation. Adaptive Lighting would be different as I havenā€™t modeled dynamic lighting with Adaptive Lighting. I have never downloaded the integration so I am not sure how they do it. Dynamic lighting gives you full control so maybe your settings are different. If you like Adaptive Lighting then maybe stick with this or try and see at what points of Adaptive Lighting sun elevation = brightness / colour temp and adjust your settings to be the same or similar.

  2. Nice.

  3. Maybe have 2 automations and use your helper to switch them. You will need to create another template binary sensor so when the helper is OFF the binary sensor is ON. Then use them in the bypass to switch (toggle) the automations and set it up exactly how you like.

Hope this helps you.

Blacky :smiley:

@SeRG1k17

Currently no you will need to set up 2 automations.

Blacky :smiley:

@Yaksha

Hi John, I use my :shower: Bathroom Humidity Exhaust Fan blueprint to do this and if you look in the FAQ I show you my set up.

I would need more information, like maybe when your exhaust fan is ON you use this in the bypass to turn ON the lights so they stay ON and when the fan goes OFF then the automation can run in auto again.

Anything turns ON then you are showering?

Blacky :smiley:

Hi,

I am facing a new situation BC the sunset is more earlier each day.

And chance to accomplish the following?

Night lights should be turned on by sun elevation, but never before 9 pm. And something similar for the morning.

@Blacky
Feature Request:
I think the following feature would be useful for several users:
Add a timer under ā€œLight Controlā€ to have a delay before the lamp turns off completely after dimming down to the selected brightness.
An example of use would be:

  1. You enter a room that is completely dark. The lights are turned on at 100% by a motion sensor.
  2. You leave the room and the lights dim down to 20% after 3 minutes.
  3. Lights continue to be at 20% until another timer counts down after, for example, 15 minutes and then the lights are turned off completely.

Support:
I canā€™t somehow get my light to use transition OFF. Transition ON works fine.
I have tested several different light entities but none want to use transition OFF.
Do you have any tips on what could be wrong or how I can troubleshoot this?

@chris400

You can use night lights time and sun elevation. Both conditions must be true for night lights to work.

Blacky :smiley:

1 Like

@flaektrem

Hi Martin

For your feature request you can use a script to do what you are after. You will need a scene or a script for Lights - Switches - Scenes - Scripts and then you will need a script for Scenes - Scripts To Turn OFF. Make sure when you do this you add a helper into Scenes & Scripts - Toggle Helper.

For support 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.

Blacky :smiley:

Cool, and thanks for your help. I will experiment with this today, but as a general rule:

  • if I enable the Bypass Off with a binary sensor does the automation stay supressed until that binary sensor is switched off? If it does, then I can simply turn on a Night = True setting, keep this automation thereby off, allow another automation to control my cat-safe night settings for the lights, and then when itā€™s Day again, turn off the Night=True sensor and have everything go back to normal.

@iandogherty

You can, try it out.

Blacky :smiley:

1 Like

Feature request:
Iā€™m sorry but that did not helped me much. Maybe I can try read your FAQ/Best practices to understand what you mean :slightly_smiling_face:

Support:

alias: Lights WC
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.rorelse_wc_occupancy
    light_switch:
      entity_id:
        - light.toalett_tak
    include_light_control:
      - use_brightness
      - use_transition
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - entity_state_enabled
    night_lights_entity_state:
      - input_boolean.sleepmode
    night_lights:
      entity_id: light.toalett_tak
    night_time_delay: 2
    time_delay: 3
    include_night_light_control:
      - use_brightness
      - use_transition
    night_light_transition_off: 4
    night_light_transition_on: 5
    night_light_brightness: 64
    light_transition_on: 1
    light_transition_off: 10

@flaektrem

I will walk you through it.

We need to make 2 scripts and one toggle helper.

1st Script is to turn light ON.

  1. Navigate to Settings > Automatons & Scenes > Scripts tab at the top.
  2. Click on + Add Script & create new script.
  3. Click on add action.
  4. In search type ā€œlight turn onā€ and select it.
  5. Add your light and the settings you would like ā€¦ 100% brightness.
  6. Save the script and add the script into Lights - Switches - Scenes - Scripts. Donā€™t have you light entity in there only the script.

That turns your light ON, now we need to turn it OFF as per your feature request. Your time delay is 3 minutes, it will run the script to 20% brightness then wait 15 min and turn OFF light. To do this we will create another script.

  1. Navigate to Settings > Automatons & Scenes > Scripts tab at the top.
  2. Click on + Add Script & create new script.
  3. Click on add action.
  4. In search type light turn on and select it.
  5. Add your light and the settings you would like ā€¦ 20% brightness.
  6. Click on + Add building Block
  7. In search type wait for time to pass and select it.
  8. Input 15 min
  9. Click on add action.
  10. In search type light turn off and select it.
  11. Select your light.
  12. Save the script and add the script into Scenes - Scripts To Turn OFF.

Now you have the light turning ON 100% and then turning OFF as per your feature request. Next we need to create a toggle helper.

  1. Navigate to Settings > Device & Services > Helpers tab at the top.
  2. Click the Create helper button.
  3. Select Toggle and then enter in a name then click create.
  4. Add the toggle helper into Scenes & Scripts - Toggle Helper.

Your done :partying_face:

Support

All your YAML looks good. Sometimes lights have inbuilt time delays that could be messing with it. Try and type 60 sec in and see if the light will slowly transition OFF.

Hope this helps you

Blacky :smiley:

Thanks for the good description. But this doesnā€™t seem to work as intended. I thought the light and timer would reset to 100% if someone re-entered the room within those 20 minutes like in the example but it didnā€™t.
I have a flow in Node Red that handles this perfectly. But I wanted to try to achieve the same thing through a blueprint instead.

Regarding the transition OFF problem, it also works perfectly in Node Red with the same lamp.

Now Iā€™m going to have to put this down and go back to Node Red, Iā€™m sorry

@fbloemhof

I initially misled you regarding the ā€˜OFFā€™ function, sorry. After testing it, instead of explaining the changes step by step, Iā€™ll just provide the YAML for the OFF script. Please keep the line at the top and simply replace the code in the sequence.

alias: Light 20% # Keep your line here

sequence:
  - action: light.turn_on
    metadata: {}
    data:
      brightness_pct: 20
    target:
      entity_id: light.toalett_tak
  - wait_for_trigger:
      - platform: numeric_state
        entity_id:
          - light.toalett_tak
        attribute: brightness
        above: 99
    timeout:
      hours: 0
      minutes: 15
      seconds: 0
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.toalett_tak
        above: 99
        attribute: brightness
    then:
      - stop: ""
    else:
      - action: light.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: light.toalett_tak
description: ""

If you are still having problems and you would like to sort it out then provide your YAML of the automation and I will look at it. Make sure you remove your light entity in Lights - Switches - Scenes - Scripts and only use a script.

I am interested in this. You say when turning ON the light it works but when you turn OFF the light it doesnā€™t. We send the same command for ON v OFF. Are you able to let us know what command node red sends when turning OFF the light? In the scripts you created you set the transition in the script not in the blueprint. Do they work?

Blacky :smiley:

How can I make an automation where outdoor lights turn on when LUX is below certain value and that the lights stay on all night at 10% until lux raises to some level. I have door sensors on the doors and a motion sensor in the yard and I would want it to work so the lights stay on at 100% when door or motion is detected for 10 minutes and then they go back to 10% brightness. I just canā€™t get this to work.