I think two post up explains how to achieve this. Didnât read it real close yet but Iâm thinking thatâs what Blacky is explaining
FAQ - The Settings & Best Practice Guidelines
Trigger Sensor - Binary Sensors
The trigger sensors are responsible for turning the lights, switches, scenes, or scripts ON and OFF. You can choose any Binary Sensor you prefer as triggers. Alternatively, if you prefer a time-based trigger, you can also add a schedule
For more information + Pro Tips Click Here
On how to set up a schedule helper and a pro tip to use it with a sun condition please click here.
NOTE: When adding multiple trigger sensors, in particular a sensor that can remain in an ON state for long periods of time, it is recommended to group these sensors together as the automation will function correctly. Sometimes depending on many factors, just having 2 or more trigger sensors prevents the automation from function correctly and grouping these sensors together helps. For more information on how to set up group sensors please click here. If you would like to know more about groups and why we use them then please click here. Example of these sensors are;
- Presence sensor
- mm wave sensor
- Contact sensor
- Door sensor
- Window sensor
- Garage door sensor
- Motion sensors with long inbuilt delays
If you find your trigger is not triggering the automation then see below under âLights - Switches â Scenes - Scriptsâ.
If you would like to create a template trigger sensor so you can use it in the blueprint click here for some examples. This is a realy good read, and I would strongly recommend you take a look at it. This shows how you can make this blueprint even better. The âBee In The Hiveâ sensor is the one I realy love , it will take your automatons to the next level.
Lights - Switches â Scenes - Scripts
The lights, switches, scenes, and scripts that will be activated by the trigger sensor/s.
More information on scenes and scripts please click here
The automation exclusively supports entities. To conveniently locate your entities, you have the option to also select areas, devices and labels, providing a quick and easy method. Simply click the expand button " < > " as shown below. This expands your area, device or labels, allowing for a swift identification of your entities. Ensure your final selection is all green, containing only lights, switches, scenes, or script entities.
Areas
Devices
Labels
Entities
Scenes & Scripts - Toggle Helper
Scenes and scripts lack a discernible state within Home Assistant, making it challenging for the automation to determine their activation status. To address this, itâs recommended to use a toggle helper alongside scenes or scripts. This enables the automation system to recognize when a scene or script has been activated, ensuring smooth operation. When entering scenes or scripts in âLights - Switches - Scenes - Scriptsâ or âNight Light,â itâs advisable to create a dedicated toggle helper for each input.
If you would like to know how to create a toggle helper then please click here.
Scenes - Scripts To Turn OFF
If you have selected a scene or a script to be turned ON above in âLights - Switches - Scenes - Scriptsâ or below in âNight Lights,â and you would like it to be turned OFF after the time delay, then you must create a scene or a script with everything OFF and enter it here. See below example.
More information on scenes and scripts please click here
Time Delay
The time delay setting dictates how long the lights, switches, scenes, and scripts will remain active after all triggers have returned to their inactive state, effectively initiating the countdown to turn them off. Additionally, the time delay also acts as a buffer zone between trigger events, preventing the lights, switches, scenes, and scripts from turning off immediately when the trigger is deactivated. If you find that your lights are turning off and then back on again too quickly, consider extending the time delay. In cases where multiple trigger sensors are used and adjustments to the time delay arenât effective, grouping the trigger sensors may be necessary. Click here to learn more about grouping trigger sensors.
Light Control Options
This allows you to select what option you would like to control in your light entity.
- Brightness â Your light must be able to support brightness control by being able to dim the light in Home Assistant.
- Transition â If your lights support brightness or colour temperature then this is the time it will take to transition to the next state. A state change can be from OFF to ON, from ON to OFF, from normal lights to night lights and from night lights to normal lights.
- RGB - Your light must be able to support RGB colour by being able to adjust the colour in Home Assistant. You can choose RGB, RGBW or RGBWW.
- Colour Temperature - Your light must be able to support colour temperature by being able to adjust the colour temperature in Home Assistant. Some LED lights that can change colour may also support colour temperature.
For each option you select you also have the ability to adjust the setting. More information is next to each setting.
If you have selected an option and your light doesnât support it then the light will simply just turn ON.
Dynamic Lighting
This option aims to make continual adjustments in your lighting setup by modulating brightness according to floating lux values or adapting colour temperature and brightness based on the sunâs changing elevation. Choose from eight preset options available in the dropdown menu.
1 - Lux Controlled Brightness
2 - Lux Controlled Brightness Inverted
3 - Sun Elevation Lighting - Colour Temp
4 - Sun Elevation Lighting - Brightness
5 - Sun Elevation Lighting - Brightness Inverted
6 - Sun Elevation Lighting - Colour Temp + Brightness
7 - Sun Elevation Lighting - Colour Temp + Brightness Inverted
8 - Sun Elevation Lighting - Colour Temp + Lux Controlled Brightness
If you would like more information on dynamic lighting then please click here.
Trigger Sensor By-pass
The by-pass allows you to regain manual control your lights, switches and scenes. When you turn ON the by-pass the automation will be paused. When you turn OFF your by-pass the automation goes OFF pause. For the automation to work correctly the by-pass entity cannot be included in, âLights - Switches - Scenes - Scriptsâ and or âNight Lightsâ selections.
If you donât have a physical switch to use as a by-pass you can create one in Home Assistant that will allow you to use the by-pass. If you would like to create a by-pass switch in Home Assistant then follow the steps below.
How to Create a Bypass Without Using a Physical Switch and Add It to a Dashboard:
- Navigate to Settings > Devices & Services > Helpers.
- Click on the âHelpersâ tab, then click â+ CREATE HELPERâ and select âToggle.â
- Enter a name for the helper, such as âSensor Light Bypass,â and click save.
- Return to the automation settings.
- In the âUse The Bypass Options (Optional)â section, select an option youâd like to use.
- In the corresponding âBypass Switchâ field, search for and select the name you created earlier (e.g., âSensor Light Bypassâ).
- Click save to apply the changes.
How to Add a Bypass Switch to a Dashboard:
- Open your dashboard and click âEdit dashboard.â
- Click â+ ADD CARD,â then choose âButtonâ or âEntities.â
- In the entity field, search for the name (entity) you created earlier, such as âSensor Light Bypass.â
- Click save to add the card.
- Click âDONEâ to finalize the changes.
You now have a âSensor Light By-passâ switch to disable the trigger sensor of your sensor light automation.
There are also a few extra by-pass settings to set when using this option. More information is next to each setting.
By-pass 101 - For more information on the by-pass then please click here.
By-pass Auto OFF
This is used when you turn the by-pass ON and you would like the by-pass to automatically turn OFF in a set time delay.
It can also be used as a timer to turn the lights ON and then OFF if you have chosen to use âEnable the By-pass - Turn lights ONâ. When you turn ON the by-pass it will turn ON your light. When the by-pass turns OFF in its set time delay and the trigger is OFF it will turn your light OFF.
Global Conditions
All the conditions are global and can work alongside with the other conditions. You can select one or all of them but if enabled each condition must pass for the lights, switches or scenes to turn ON. Example: If you enable all of them and one of them has not been met, then the automation will not run.
Sun, ambient & time can also trigger your automation. This will only happen when the âtrigger Sensorâ is ON at the time the sensor crosses over it setting. Example: If your motion sensor is ON (motion detected) and you are using the sun as a condition, if the sun is above the âSun Elevationâ setting the light will be OFF. If the sun then crosses from above to below the âSun Elevationâ setting then the light will be turned ON. The same theory applies for ambient and time and also works for turning your lights ON and OFF.
-
Sun - Can trigger the automation if the main trigger is ON*
This option is used to add a condition that only allows the automation to run when it is dark or below the âSun Elevationâ settings.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.
If you would like more information on this and how to set it up correctly then please click here.
-
Ambient - Can trigger the automation if the main trigger is ON*
This option is used to add a condition that only allows the automation to run when it is dark or below the âAmbientâ settings.If youâre seeking more detailed information on the ambient settings, feel free to click here.
If you would like to use 2 or more ambient light sensors and would like to know how to set this up correctly then please click here.
-
Time - Can trigger the automation if the main trigger is ON*
This option is used to add a condition that only allows the automation to run between the start time and end time settings on the selected weekdays.If youâre seeking more detailed information on the time settings then please click here.
-
Device Tracker
Home Assistant can track the location of your devices (such as mobile phones) within a designated zone via the mobile app device tracker.To utilize this option, you need to set up a zone and configure your devices for tracking in Home Assistant. There are two enable options available; âZoneâ tracks all devices within the zone, while âZone + Peopleâ allows you to track individuals within a zone.
This feature can be particularly useful if you have pets triggering the sensor, turning your lights ON and OFF when no one is home.
Night Lights
Night lights allow you to set different lights, switches, scenes or scripts by using a entity state, time or sun condition to choose when these lights will be active.
While some settings are similar to those of normal lights, night lights offer additional options tailored to nighttime lighting control. For further information on night light settings that resemble those of normal lights, please review the details provided above. However, for the unique settings exclusive to night lights, please see below.
-
Night Lights - Use The Light Control Options
- If lights are ON, adjust the lights when crossing over
Selecting âIf lights are ON, adjust the lights when crossing overâ option ensures that the light control settings will be applied to any lights that are already ON during the transition from normal lights to night lights and vice versa.
If the âIf lights are ON, adjust the lights when crossing overâ option is not selected, lights that are already ON when transitioning from normal lights to night lights will remain in their current state. This allows for situations where you may want the lights to stay on later at night or during gatherings without transitioning to night mode immediately. However, once these lights are turned OFF, the night mode settings will be applied the next time they are turned ON. While this option may suit some areas, it may not be preferred everywhere, providing you the flexibility to choose your desired scenario by simply ticking a box.
Regardless of whether this option is selected or not, if any lights are OFF during the transition from normal lights to night lights and their settings differ, they will either turn ON to the specified light control settings or turn OFF, depending on the configuration.
- Yes - Manage OFF script when crossing over
Selecting âYes - Manage OFF script when crossing overâ is beneficial for scripts containing if-then-else actions that toggle various functions on and off during the transition from normal lights to night lights and vice versa.
If youâre seeking more detailed information on scripts with a working example and would like to know how to set this up correctly then please click here.
-
Night Lights Conditions
If you choose to âEnable entity state optionâ the night lights will be active when the selected entity is ON. If you choose to âEnable time optionâ the night lights will be active during the set time period. If you choose to âEnable sun elevation optionâ the night lights will be active when the sun is below the âSun Elevationâ setting. You can enable both conditions if you like but they both must be met for the night lights to work.
Note: Night lights will still have to pass all the global conditions set for normal lights.
For more information on the entity state, then please click here.
For more information on the time settings, then please click here.
For more information on the sun settings, then please click here.Hereâs a helpful tip: If you prefer softer, dimmer lights when using the bathroom at night, you can utilize the âNight Lightsâ feature. Simply configure one or more of the night lights conditions to activate during your typical sleeping hours. Then customize your light settings to your preference. Now, whenever you get up during the specified time period at night, your lights will automatically adjust to provide the desired ambiance.
Hope this helps to explain some of the settings
Enjoy
Blacky
Back to FAQ: Click Here
Hi Nick, firstly welcome to the community .
As @geox19 reply, the previous post explains how to achieve this. The basic principle is by using scenes and creating a scene of what you would like at the end and put it into âScenes To Turn OFFâ.
If you are upgrading from version 2.8 and below please read the release notes of version 2.9 before upgrading as you will need to clean up a bit of code in the YAML. Click Here to see version 2.9 release notes. If you are updating from version 2.9 and above you good to go.
New Features
- Transitions will now work with scenes. Now it will transition a light entity with a brightness setting in a scene.
Bugs Fixes
- Fixed light flicker when crossing over from normal lights to night lights and from night lights to normal lights in a time trigger. Note: For the crossover to work only entities can be selected. Currently areas and or devices are not supported.
EDIT: If you updated in the first 35 min of this release, please update again, something (a bug) snuck back into the code. Sorry
Enjoy
Blacky
Thanks for the great blueprint! The new version seems to be working although I do get some warnings in the log:
2023-04-15 16:25:10.010 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'entity_id' when rendering '{% set a = light_switch.entity_id %} {% set b = night_lights.entity_id %} {% if a and b %}
{{ b | reject('in', a) | list }}
{% else %}
[]
{% endif %}'
2023-04-15 16:25:10.603 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.hue_play_1, light.hue_play_1_2, light.hue_play_2, light.hue_play_2_2, light.hue_play_4 or it is/they are currently not available
2023-04-15 16:25:10.611 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.hue_play_1, light.hue_play_1_2, light.hue_play_2, light.hue_play_2_2, light.hue_play_4 or it is/they are currently not available
Seems to happen each time the automation is triggered.
Hi @barcomoon
Firstly welcome to the community.
Could you post your YAML code. In automation, top 3 dots, edit in YAML, copy code and use the â</>â in this forum when pasting your code.
Thanks!
Sure, thanks for looking into this. To rule out other issues I made some changes to naming of lights but the message is the same:
2023-04-15 16:52:28.659 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'entity_id' when rendering '{% set a = light_switch.entity_id %} {% set b = night_lights.entity_id %} {% if a and b %}
{{ a | reject('in', b) | list }}
{% else %}
[]
{% endif %}'
2023-04-15 16:52:28.662 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'entity_id' when rendering '{% set a = light_switch.entity_id %} {% set b = night_lights.entity_id %} {% if a and b %}
{{ b | reject('in', a) | list }}
{% else %}
[]
{% endif %}'
2023-04-15 16:52:29.328 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.hue_play_servieskast_links, light.hue_play_servieskast_rechts, light.hue_play_tv_links, light.hue_play_tv_midden, light.hue_play_tv_rechts or it is/they are currently not available
2023-04-15 16:52:29.329 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.hue_play_servieskast_links, light.hue_play_servieskast_rechts, light.hue_play_tv_links, light.hue_play_tv_midden, light.hue_play_tv_rechts or it is/they are currently not available
This is my config for this particular automation:
alias: Verlichting - Woonkamer
description: ""
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
light_brightness: 95
time_delay: 4
motion_trigger:
- binary_sensor.woonkamer_light_trigger
include_ambient: ambient_enabled
ambient_light_options: ambient_light_option_enabled
ambient_light_value: 80
ambient_light_sensor: sensor.hue_motion_sensor_1_illuminance_5
include_light_control:
- use_brightness
- use_transition
light_transition_on: 2
light_transition_off: 10
light_switch:
entity_id:
- light.hue_play_tv_links
- light.hue_play_tv_midden
- light.hue_play_tv_rechts
- light.hue_play_servieskast_links
- light.hue_play_servieskast_rechts
The lights are all HUE lights. The light trigger is a helper with a few motion sensors.
The automation actually works but the warning messages are filing up the log.
Could you try and put any 2 lights used in âLights - Switches - Scenesâ into âNight Lightsâ but you dont have to âEnable the night lights optionsâ.
Let us know how you go.
Ok, that got rid of the first two warnings (template variable warning). The last two still persists (unable to find referenced entities):
2023-04-15 17:07:18.566 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.hue_play_servieskast_links, light.hue_play_servieskast_rechts, light.hue_play_tv_links, light.hue_play_tv_midden, light.hue_play_tv_rechts or it is/they are currently not available
2023-04-15 17:07:18.570 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.hue_play_servieskast_links, light.hue_play_servieskast_rechts, light.hue_play_tv_links, light.hue_play_tv_midden, light.hue_play_tv_rechts or it is/they are currently not available
I think it may have to do with the lights.
[homeassistant.helpers.service] Unable to find referenced entities
EDIT: When did you do the update⌠try updating again.
Iâm getting errors like this I upgraded just few days ago from 1.29 Iâm going to delete all my automations and install fresh with the updated blueprint
I think I have found it. I will try and fix this in the next update. I believe the logs are only stored for 10 days and then cleared so it shouldnât just keep building up you data base.
Edit: Fixed, will be in the next release.
Thanks Blacky, No worries I just need to keep my face out of the logs anyways. The great thing is, if you start fresh itâs really easy and fast to point and click your way to success with your blueprints.
HI Blacky, nice BP thanks a lot.
Is there a possibility to add more bypass switches?
include_bypass: bypass_enabled_stop
motion_bypass: sensor.hue_wall_switch_module_1_battery_2
I have in the one room two different HUE wall switch modules which should be used to bypass this automationâŚ
Hi Puce, firstly welcome to the community
Is there a possibility to add more bypass switches?
Currently you can only select one by-pass but that doesnât mean you cant have more than 1. In a new feature that is on the road map, that I am sure everyone will love, may require to have a selection to add more than 1 by-pass. But for now it is best to set up a group helper as you can have it now.
To do this it is similar to one of our FAQ but you would select âsensorâ rather than âBinary sensor groupâ and add that to your by-pass. To see the FAQ on how to do this click here.
Hope this helps.
Blacky
Loving the blueprint, thank you!
The only issue Iâm trying to get around is the transition to night lightsâŚ
Iâd like to stop that transition from happening while motion is detected. I.e. if weâre in the kitchen later than usual I donât want to be plunged into a dim room, Iâd rather it just keep the current scene until everybody leaves the room and no motion is detected. Then next time activate the night lights.
Hi, Great blueprint however Iâm having a couple of issues if you could help at all please?
Iâve set this up for my Hallway lights and Kitchen LEDâs to activate based on motion. However the hallway lights seem to Flash (sometimes once, othertimes twice) when motion is detected and then reduce to 40% brightness even though Iâve set it to 100%. My Kitchen LEDâs turn on fine, however they only activate at 40% brightness instead of 100%.
Iâve tried with Brightness On/Off and Transition On/Off.
Lights:
- Hallway = 2 x Hue white lamp (LWA001)
- LED = 1 x 10m Govee H615B
YAML:
alias: "Hallway: Motion-Activated Lights"
description: ""
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
motion_trigger:
- binary_sensor.hue_motion_sensor_2_motion
light_switch:
area_id:
- hallway
- kitchen
include_light_control:
- use_brightness
- use_transition
ambient_light_sensor: sensor.hue_motion_sensor_2_illuminance
ambient_light_options: ambient_light_option_enabled
ambient_light_value: 50
include_ambient: ambient_disabled
time_delay: 1
light_transition_on: 0.5
light_transition_off: 10
Hi Ross, firstly welcome to the community
Yea this is a new feature released in version 2.9. I get your point. I will have a look at it and possibly include an new option in night lights so you can select ether way depending what you would like.
Stay tuned
Blacky
Hi @beel , firstly welcome to the community
The target selection are complicated. So much so, that I have been pondering for over a week now to only allow for entities to be selected and not areas and or devices. I think having the option to be able to select and area and or device is nice as it is a quick easy way to find your entities but it is best if you just use entities.
Sorry for long answerâŚ
You have selected areas. Please expand down to entities by clicking on the â<>â, and if needed, delete any entities you dont need. It should be all green see below.
Let us know how you go.
Blacky