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

@kman42

First you need HA to know your TV is ON or not. Some TVs have a integration or something that works for HA. If not a smart plug can do this. If you use a smart plug then create a template binary sensor using this code. go to settings / devices & services / helpers tab / create helper / template / binary sensor / add your name (lets call it “TV ON”) and in “state template” use this code adding your smart plug entity in and adjusting the 85 to your requirements (when TV is ON/OFF check power and adjust).

{% if states('sensor.your_power_sensor_here')|float > 85 %}
  on
{% else %}
  off
{% endif %}

If you are not using night lights then use the “TV ON” or you TV may have a state when it is ON already and you didn’t need to create the template sensor using a smart plug… what ever it is use it in “Enable entity state option” option for night lights. Then set up your lights as required under night lights and you are done.

If you are using night lights see above post for a rough guide as it is the same way… create another automation …

Let us know how you go.

@fvhemert

Welcome to the community :wave:

If this is the case then you will need to use your binary sensor in the by-pass option 2. Your binary sensor has to be OFF when you would like the lights ON. Not sure if you can edit your binary sensor to do this. If not create another one using your binary sensor you have making it work the opposite way like this.

Go to settings / devices & services / helpers tab / create helper / template / binary sensor / add your name (lets call it “LUX Dark”) and in “state template” use this code

{{ is_state('input_boolean.your_binary_sensor_here', 'off') }}

Then add “LUX Dark” to the by-pass option 2

Let us know how you go.

Blacky :smiley:

@Blacky thanks for the quick reply. I’ll give it a try this weekend and post the results.

Thank you again for the quick response.

The nightlight option is working :slight_smile: , but the problem is that I do want to use the nightlight option later on.

The other option is (for me) to much a work around, and I am afraid I cant recall the automation later on. I know that this is not your problem, but I am not a everyday poweruser of HA. So I do want to make things as understandable as possible for myself.

May I brutally ask if there is a plan to add the Kelvin (and maybe the transition) option to the bypass option? That would solve all the problems. And I really do think there are more people who want to override the settings (bypass) with other settings then the original, and not only change the delay.

There are a ton of options you can use the bypass option for, if you can change the brightness and Kelvin.

@Hassio

Nice one

This is a problem for me to as it keeps growing and has so many scenario / options to keep track of.

This will grow the automation. Then there so many more different options. The best way is to provide the by-pass trigger then the user can go in any direction they like.

Blacky :smiley:

FAQ: How to use scenes and scripts

Scenes and scripts are powerful tools in Home Assistant that allow you to automate and customize your smart home. These tools enable you to create specific states or sequences of actions for various devices, giving you complete control over your environment. Whether you want to adjust lighting, set an ambiance, or orchestrate complex sequences, scenes and scripts offer flexibility to personalize your experience.

Personalize Your Lighting – Your Way :bulb::sparkles:

With scenes and scripts, you can control your lighting with precision. Set the different colours or brightness for your lights, or create custom lighting behaviours using scripts.


Scenes

Scenes are ideal when you want to set different colours or brightness levels for your lights, creating unique ambiance or moods. However, if you need to set the same brightness levels or colours across multiple lights, it’s generally better to use the blueprint’s light control options. This method ensures more consistent behaviour and reduces the chances of light flicker, as using entities directly ensures that the blueprint functions at its best.

Why use scenes?

  • Lighting Control: Set different colours and brightness levels for your lights, creating the perfect ambiance.

Scripts

Scripts provide greater flexibility by allowing you to automate sequences of actions based on specific conditions. For example, you can create scripts that turn on or off certain lights or switches depending on the time of day or create special actions you would like to perform when the automation runs.

Why use scripts?

  • Automate Actions: Control specific lights or devices based on triggers like time or conditions.
  • Creative Possibilities: Customize sequences to fit your needs, whether it’s for lighting, switches, or other devices.

Turning Scenes or Scripts OFF

Scenes and scripts are designed to set devices to specific states but are not inherently “active” or have an “ON” state in the traditional sense, so they don’t have a state to “turn off.” To get around this, we need to reset the environment once the automation completes. To do this, we need to create another scene or script to restore the default settings, such as turning devices OFF or performing another set of actions.


Using Toggle Helpers with Scenes and Scripts

Since scenes and scripts do not have an identifiable state, it can be challenging for automations to know when they are active. To solve this, it’s recommended to use a toggle helper when only using a scene or script. This way, the automation system can track whether a scene or script is active and manage subsequent actions smoothly.

How toggle helpers help:

  • State Management: Helps automation recognize if a scene or script is active.
  • Light Control: Works seamlessly when transitioning between normal lights and night lights.
  • Restart Handling: Ensures the correct behaviour after Home Assistant restart.

When configuring scenes or scripts in “Lights - Switches - Scenes - Scripts” or “Night Light,” create a dedicated toggle helper for each input to ensure the automation knows what is going on.


Crossing Over from Normal Lights to Night Lights

When transitioning between normal lights and night lights, toggle helpers become essential. They ensure that the lights switch between states correctly without disruption. To facilitate smooth transitions, you must enable the option “If lights are ON, adjust the lights when crossing over” in the night light settings.

Additionally, you can create scripts used in the “Scenes - Scripts To Turn OFF” section to apply different OFF settings based on whether normal lights or night lights are activated. If you are doing this to help with transitions, also enable the option “Yes - Manage OFF script when crossing over” in the night light settings. This will activate your script when crossing over, applying the desired settings to ensure smooth operation.


By understanding and utilizing scenes, scripts, and toggle helpers, you can create a smart home environment that adjusts to your needs with minimal effort, providing both convenience and personalization.


I hope this explanation helps you understand how scenes and scripts are utilized in the blueprint automation process.

Enjoy

Blacky :smiley:

Back to FAQ: Click Here

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

4 Likes

Great! Thank you. I will try it today

Is there any way to have the blueprint ignore lights that have become unavailable? Sometimes my lifx bulbs drop off the net temporarily and the automation fails because of this

Kitchen Lights: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Choose at step 7: Set the Sun Elevation Lighting - Colour Temp + LUX Controled Brightness for the normal lights switch: Dynamic Lighting Control: Choose at step 1: Set the dynamic lighting lux brightness and dynamic sun elevation colour temperature for the normal lights switch: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'brightness'
Kitchen Lights: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Choose at step 7: Set the Sun Elevation Lighting - Colour Temp + LUX Controled Brightness for the normal lights switch: Dynamic Lighting Control: Error executing script. Error for choose at pos 1: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'brightness'
Kitchen Lights: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Choose at step 7: Set the Sun Elevation Lighting - Colour Temp + LUX Controled Brightness for the normal lights switch: Error executing script. Error for repeat at pos 1: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'brightness'
Kitchen Lights: Choose at step 1: default: Parallel Actions for dynamic lighting: parallel 1: Error executing script. Error for choose at pos 7: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'brightness'
Kitchen Lights: Choose at step 1: default: Error executing script. Error for parallel at pos 4: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'brightness'

@johnwang16

Hi John, welcome to the community.

Can you confirm that your lights have a attribute brightness. Go to developer tools / states tab and search all your light you are using in the automation for the attribute brightness as shown below.

Blacky :smiley:

Thanks, @Blacky, I’m going to try this approach this weekend. Which post are you referring to when you say “see above post”? Here’s a summary of what I think you are suggesting. Note: I am currently using the night light feature.

  1. Create a toggle helper called “TV ON”
  2. Use by-pass option 3 in my existing Sensor Light automation and enter the “TV ON” helper
  3. Create a new template binary sensor. Go to helpers / create helper / template / binary sensor / in states add this. Let’s name this “TV Lights”.
{{ is_state('input_boolean.TV_ON_helper', 'off') }}
  1. Create 2nd automation with lights as required. Do I use the new Turn Light, Switch or Scene On & Off automation or another instance of the Sensor Light automation?

  2. Add the new template binary sensor (TV Lights) into the 2nd automation by-pass option 3.

Do I have this right?

Thanks!

thanks! Yes, the light does have a brightness attribute. Here’s the list when it’s online. I can reproduce the exception if I unplug any light such that it’s unavailable

min_color_temp_kelvin: 2500
max_color_temp_kelvin: 9000
min_mireds: 111
max_mireds: 400
effect_list: effect_colorloop, effect_pulse, effect_stop
supported_color_modes: color_temp, hs
color_mode: color_temp
brightness: 176
color_temp_kelvin: 4999
color_temp: 200
hs_color: 27, 19.257
rgb_color: 255, 227, 205
xy_color: 0.373, 0.349
effect: null
friendly_name: Kitchen Sink
supported_features: 36

Hi Blacky, can you see why this isn’t working again? For a post HASS restart?

different to yesterday. this is a light that has a scene enabled for the on and off commands.

Tested by also using the same automation in another room. The one that did work before. That still works and looks to be identical.

Another one for a light on a simple on/off also failed:

Cant figure out why some worked not others. All ad motion triggered shortly before the HASS restart. Only the Kitchen LED did work.

1 Like

Hey, just another thank you for the blueprint. I just loaded it yesterday and am only working with one bulb so far. Many options! Great work! Works great, once I fixed my mistake of entity vs sensor. :laughing: I also just loaded your sensor light add-on. Both appear to meet and exceed my needs.

Just responding to my own post to help anyone that may be trying to do the same thing.

1-2. No need for a helper if HA recognizes your TV. Just set it as the entity in the bypass.
3. No need for a new template binary sensor.
4. Create 2nd automation with lights as required. Use the new Turn Light, Switch or Scene On or Off automation.
5. Add the TV as the entity into the 2nd automation by-pass option 3.

Works perfectly. It’s like magic!

@johnwang16

Okay, thanks John :+1:… I will have to add this to my list so I can test it. Currently I have completed the next release and working through final checks so I am not sure if I will get to this before then but I will look into it.

Stay turned.

Blacky :smiley:

1 Like

@richsimpson

Yep I know what that is. Because you are using scenes only and the way scenes are handled in HA the automation can’t tell if it is ON or OFF. The good news is I have been working on this and it has been resolved. Stay turned for the next release that will be out soon. If you can’t wait for it then what you can do is just add one light entity used in the scene into “Lights - Switches - Scenes - Scripts” and “Night Lights”.

Blacky :smiley:

@G2740

Hi Dave, it is realy nice to get this type of feedback every now and then without any questions. Glad you like it and thanks for yore kind words :smiling_face_with_three_hearts:

Stay tuned for the next release to be out soon.

Blacky :smiley:

@kman42

Love it :+1:… looks like your are getting the hang of the blueprint… nice work and thanks for the update.

Blacky :smiley:

FAQ: How to use the Ambient Options

What are Ambient Options?

The Ambient Options set conditions that restrict automation to run only when it is dark or below specific ambient light levels. These levels are typically measured in LUX, and such sensors may also be referred to as LUX sensors. These are global conditions and can work alongside other selected conditions if configured.

Ambient Light Sensor

Using a primary outdoor sensor to detect the actual outdoor LUX value can be beneficial, as it allows you to apply a consistent measurement across all lighting automation setups. Indoor sensors may be used when the outdoor LUX value is not relevant, such as when lights are used in enclosed spaces like a garage or when blinds are closed.

Ambient Light Sensor - Site Conditions

Sometimes, when lights turn on, they can affect the ambient light sensor, increasing its LUX value and causing the lights to turn off prematurely. To address this, select an option that best suits your installation.

NOTE: If you are using a buffer zone between the high and low lux values, select “NO” for this option.

Ambient Light - Low & High Lux Values

These settings allow you to create a buffer zone between two lux values to manage light activation and deactivation more effectively.

  • Ambient Light - Low Lux Value: Set this value to determine when the lights should turn ON. The light will activate when the lux level falls below this set value. This value should be equal to or lower than the “High Lux Value” below. A typical guide value is 20 lux (dusk).

  • Ambient Light - High Lux Value: Set this value to determine when the lights should turn OFF. The light will deactivate when the lux level rises above this set value. This value should be equal to or higher than the “Low Lux Value” above. Setting a higher value creates a buffer zone to prevent immediate light deactivation. A typical guide value is 80 lux (dawn).

Enjoy

Blacky :smiley:

Back to FAQ: Click Here

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

I will look out for it. though the last one is screenshot for Utility room failed and is also a simple light and motion sensor. no Night mode, just on and off.