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

Hi @geox19

Try and expand your devices and use entities. It is always better if you can use entities. I find having “area” and “devices” is a quick way to find your entities.

The expand button is here

1 Like

I don´t think thats what i search for. Here a bit more in detail:

  1. I have an automation that active a bulb at 8PM.
  2. As soon the motion sensor is detecting motion the bulb should be active a scene.
  3. After a period of time the bulb should go to the level of brightness from 1.
  4. At 11pm the light will be off.
  5. same behavior like 2.
  6. After a period of time the bulb should go to the stat of off (4.)

So it would be great to store the state of the bulb before the activation and set this after the time after motion.

Hi @Mar1us

This is a custom automation but you still can do it with this blueprint and another one of my blueprint. It is simpler to AndrĂŠ question above.

Below example is if your using the same light/s in everything.

First you will need to download another one of my blueprints called :gear: Turn Light, Switch or Scene On & Off with Trigger Conditions. This will be used for your (1) ON at 8pm and (4) OFF at 11pm. Set it up for this time. Then set up a scene for your ON (1) and put that in “Lights - Switches - Entities - Scenes”. We will call that scene “scene 1” for this example but you can name it anything you like. Then create an identical scene with everything OFF and put that into “Scenes To Turn OFF”

Once that is done Use this blueprint (sensor Light) for (2) and (3). So for (2) you would create a scene and set the brightness level you like and put that in “Lights - Switches - Scenes”. Then enter “Scene 1” used in the other automation and put that into “Scenes To Turn OFF”. Set the time under “Use The Time Options” to only run between 8pm and 11pm.

Now use this blueprint (sensor light) again and create another automation for (5) and (6) this time you can use a scene or not and set up the light to come ON and OFF as you like. Set the time under “Use The Time Options” to only run between 11pm and 8pm (note the reverse time).

With the 2 automations using the blueprint (sensor light) you can also set the other options if you like. Example “Use The Sun Option (Optional)”.

Hope this helps you.

Let us know how you go.

Blacky :smiley:

1 Like

Very nice blueprint here! The only thing i’m missing here is to make the lamps go to there previous state. Or am i looking over this?

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

1 Like

FAQ - The Settings & Best Practice Guidelines

:zap: Trigger Sensor - Binary Sensors

This is the trigger sensor that will turn ON “Lights - Switches – Scenes” and “Night Lights”. The trigger can be any Binary Sensor you like and you can add as many trigger sensors as you like.

You can also add a schedule as the trigger. This will add a trigger based on time of day. For more information + Pro Tips Click Here

:spiral_notepad: 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. 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 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 :heart:, it will take your automatons to the next level.

:bulb: Lights - Switches – Scenes

This is where you select what lights, switches or scenes you would like to turn ON. The automation only supports entities. Having the ability to select areas and devices is a nice quick easy way to find your entities. When selecting areas or devices, click the expand button “<>” as shown below. This will expand out your area or device so you can quickly find your entities. Your final selection should look all green and only have lights, switches or scenes entities.

Areas :x:

Devices :x:

Entities :white_check_mark: :+1:

:film_strip: Scenes To Turn OFF

If you have selected a scene to be turned ON above in “Lights - Switches - Scenes” or below in “Night Lights” and you would like it to be turned OFF after the time delay, you must create another identical scene with everything OFF and select it here. See below example.

:hourglass_flowing_sand: Time Delay

Once the trigger no longer detects any motion or it returns to its OFF state the automation will start the time delay before turning OFF the lights. This allows for a buffer zone where you may need time to exit the area before the lights will turn OFF. The buffer zone can also be used to wait and see if the trigger, triggers again within a time period before turning OFF the lights. It helps to smooth out your lights by keep the lights ON so you don’t have your lights turning ON and OFF every time the trigger is triggered. If your lights keep turning OFF while you’re still in the room consider extending the time delay to give the buffer zone more time to wait for the trigger to be triggered again. Sometimes if this doesn’t work and your using 2 or more trigger sensors you may need to group the trigger sensors. See trigger sensor above for more information.

:white_check_mark: 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.
  • 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.
  • 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.

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.

:pause_button: 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” 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 By-pass switch

  • First go to Settings / Devices & Services / click on the “Helpers” tab / click “+ CREATE HELPER” and select “Toggle”.

  • In the name area, enter a name that best suits you. For this example we will put “Sensor Light By-pass”. Then click save.

  • Go back into the automation and in the “Trigger Sensor By-pass Options (Optional)” select an option you would like to use and then in “Trigger Sensor By-pass - Switch” search for the name you created, in our case “Sensor Light By-pass”. Then click save.

    Note: You can also set the “Trigger Sensor By-pass - Time Delay” to your liking.

How to add by-pass switch to a dashboard

  • In a “Dashboard” click “Edit dashboard” then click “+ ADD CARD” click on “Button” or “Entities” and in the entity field again search for the name (entity) you created in our case “Sensor Light By-pass”. Then click save.
  • Then click “DONE”.

You now have a “Sensor Light By-pass” switch to pause your sensor light automation :tada:

There are also a few extra by-pass settings to set when using this option. More information is next to each setting.

:infinity: 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.

:scroll: 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
    This is used for adding a condition to only work when it is dark or below the “Sun Elevation” setting.
    I thought about “Sunset” and “Sunrise” but HA recommend using sun elevation as it works better throughout the year. So I took their advice and used the sun elevation.
    If you would like more information on this and how to set it up correctly see or FAQ Click Here

  • Ambient
    This is used for adding a condition to only work when it is dark or below the “Ambient Light LUX Value”. There are some extra settings to select when setting this up so it will function correctly. More information is next to each setting.
    If you would like to use 2 or more ambient light sensors see our FAQ on how to set this up Click Here
    If you are having a problem with site condition setting and your just using scenes then Click Here

  • Time
    This is used for adding time conditions. You have a start time, end time and weekdays.
    For more information on the time settings see our FAQ Click Here

  • Device Tracker
    Home Assistant can track your devices (mobile phones) location to a set zone via the mobile app device tracker. Enabling this option will only allow the automation to run if a device is in the zone. This can be useful if you have pets triggering the trigger sensor turning your lights ON and OFF when no one is home.

:first_quarter_moon_with_face: Night Lights

Night lights allow you to set different lights, switches and scenes by using a time or sun condition to choose when these lights will be active. It has a few settings that are the same as normal lights but you will notice it has “Night Lights Conditions”. 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.

TIP: If you would like to have lower softer lights come ON when going to the bathroom at night, you can use “Night Lights - Time Condition” and set a time period when you are normally sleeping. Then set up your lights to your liking. Now when you get up between the set time period at night to go to the bathroom your lights will come ON to your liking.

Night lights will still have to pass all the conditions set for normal lights.

For more information on the time settings see our FAQ Click Here

For more information on the other night light settings that are the same as normal lights please refer to the above.

Hope this helps to explain some of the settings :face_with_monocle:

Enjoy

Blacky :smiley:

Back to FAQ: Click Here

1 Like

@NickM

Hi Nick, firstly welcome to the community :+1:.

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”.

New update 3.1

:warning: 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 :new:

  • Transitions will now work with scenes. Now it will transition a light entity with a brightness setting in a scene.

Bugs Fixes :bug:

  • 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 :grinning:

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. :thinking:

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

@barcomoon @geox19

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.

2 Likes

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.

2 Likes

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…

@PuceZhodosha

Hi Puce, firstly welcome to the community :wave:

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 :smiley:

1 Like