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

Hi - This Blueprint would be the perfect one for me to use (thank you so much) but I cannot get it to work. My lights can be controlled by home asssitant only through REST API calls to an external system. Specifically, I have a service in home assistant that does this (for example: “rest_command.light23on”).

Is there any way I can make this “service” show up as an action / light / entity, which can be controlled by this blueprint / automation?`

I was hoping that this might be possible thourgh a “helper” but was so far unable to figure it out.

Thank you for any hints.

Hey @Sali you could try using a Template Light, and set the turn on and turn off to make rest calls.

To use Rest services in the template light you could use the Rest Command integration. Seems you already have this part.

After all these gymnastics goes well, you probably can use the template you created as a light and with this blueprint!

I would also spend some time to check online if anyone has made a custom component on HACs for your light, to reduce the number of loops.

Thank you – I will try this too. Wanted to share that I was in the meantime able to solve like this (below the answer that Chat GPT gave me including the code (!), which actually works:

Yes, it is possible to make your REST API service show up as an entity in Home Assistant so that it can be controlled by blueprints and automations. To achieve this, you can use the rest_command integration and create a template switch or light that is linked to your REST API service.

Here’s an example configuration that demonstrates how to set up a template switch that controls your REST API service:

  - platform: template
        value_template: "{{ is_state('switch.light23', 'on') }}"
          service: rest_command.light23on
          service: rest_command.light23off

In this configuration, we define a template switch named “light23” that uses the is_state function to determine its current state based on the state of the switch.light23 entity. The turn_on and turn_off actions are set to call your REST API service using the rest_command.light23on and rest_command.light23off services, respectively.

Once you have set up the template switch, it will appear as a controllable entity in Home Assistant, and you can use it in blueprints and automations like any other switch or light entity.

Remember to replace switch.light23, rest_command.light23on, and rest_command.light23off with the actual names of your entities and services.

1 Like

@Blacky Any person can have several trackers, such as an application, router data or a BLE device. Changing the tracking settings will not result in the need to reconfigure the automation.

@gamba69 I was thinking to use device tracking as it can be more customised if you would like to use one device tracker on the person that could have 2 or more. Maybe I should allow it to have both so the user can decide.

Edit: I have already done all the code so I am good there.


Blacky :smiley:

New update 3.8

:warning: Some work is required in this upgrade. Please see below on the steps required when upgrading. It is easy and not a breaking change.

New Feature :new:

Device Tracker - "People"

We have updated “Zone - Device Tracker” to include a new selection “People”. This will now allow you to select a zone and the people you would like to track in that zone. You still have the option to just select a zone if you prefer. Thanks to @gamba69 for the help with the code. See below the changes

What can this now do? :thinking:

If you use device tracker, you could track your cars, pets, people etc. In some cases you could all go out for the night in one car and leave the other car behind. You could go for a walk and leave your car behind. This will show one device in the zone (your car), and your lights would still turn ON when your pets run around the house. With the new option having the ability to also include people, you can now exclude the items you don’t want to track (the car) and include the people you would like to track. So now your lights can remain OFF until one person arrives home.

The title description has also changed to “Device Tracker”. Hopefully this will make it clearer in your selection.

:warning: :stethoscope: STEPS REQUIRED WHEN UPGRADING :white_check_mark:

If you have never selected to use device tracker then most likely you won’t need to do anything but you may want to check just encase you have selected device tracker in the past.

1 - Upgrade your blueprint.
2 - Then go into your automation (the ones using this blueprint) and click the 3 dots top right and “Edit in YAML”

3 - We are looking for the words or input called “include_zone: ???” If you don’t see this then you have never selected it and your all good to go, your done. If you see it then continue on.

4 - Delete this line,(“include_zone: ???”) then click save, click 3 dots and select “Edit in visual editor”

5 - Update your selection if you would like to use the device tracker.

6 - Click save, you’re done. Now just do the same in your other automations using this blueprint.

If you would like to easily find all the automation that are using this blueprint so you can check your YAML. Go into blueprints and click on the 3 dots next to the sensor light blueprint and select “show automations using this blueprint” You then can easily edit them all. See below.


Blacky :grinning:

Back to FAQ: Click Here


hey love the blueprints you make. very easy and precise. Only I’m having an issue that they are just not working.No matter what i do the automation is just not triggering or in the best case scenario the lights will flash on n off n done.am at my wits end any help is appreciated. Am a newbie to ha so my apologies in advanced if the solution is obvious


Hi, firstly welcome to the community :wave:

What I think may be happening is you are using Areas and or devices. Please expand them buy using the “<>” down to entities. It should all be green as shown below. You then will find that your automation triggers and your lights will turn on.

Areas :x:

Devices :x:

Entities :white_check_mark: :+1:

Let us know how you go.

Blacky :smiley:

Thanks for the quick reply. as for what im using its all as instructed by ur instructions. so i am using entities and still no luck. just to try out i created a basic automation with the same sensor and lights and it worked without an issue. Usually i would just keep it to the basics but the idea of the light changing temp depending on the time of day is so appealing i cant let it go. Plez help

I just had exactly this happen. Couldn’t figure out why it wasn’t triggering. It was a device (blue) that I had chosen not the Entity (green). I wasn’t even thinking that could be a problem because to me the trigger was what mattered. Still learning.



We will need to go through a few things. We know the blueprint works. There are a few things that can stop the automation running (conditions). In order for me to see what is happening I will need to see the YAML of your automation. This YAML is the code of your selections in the automation.

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.

Another thing you could try is to delete the automation (not the blueprint) and create a new automaton. The reason why I asked to delete the existing automation is we don’t want that automation stopping or doing anything. You could disable it if you like as this will do the same thing and then you can enable it latter, but we need to make sure the light we are controlling only has one automation controlling it.

When you create a new automation, only enter in, the trigger and a light entity, nothing else and test if the automation works.

For more information on this automation that may also help you is to read “The Settings & Best Practice Guidelines” Click Here.

Let us know how you go.

Blacky :smiley:

talias: Dinning Room Sensor Light
description: ""
  path: Blackshome/sensor-light.yaml
      - binary_sensor.dinning_room_sensor_occupancy
        - light.dinning_room_light_left
        - light.dinning_room_light_right
      - use_brightness
      - use_colour_temperature
    include_time: time_enabled
    after_time: "17:00:00"
    before_time: "08:00:00"
    include_night_lights: night_lights_enabled
        - light.dinning_room_light_right
        - light.dinning_room_light_left
      - use_brightness
      - use_colour_temperature
    night_light_colour_temperature: 3500
    night_lights_after_time: "22:30:00"
    night_lights_before_time: "08:00:00"


All your setting are good. The only thing that will stop the automation running is “Time”. This automation will run between 5 pm and 8 am. Could you “disable the time options” and test it please. I am thinking your HA could have the wrong time. When testing your binary_sensor.dinning_room_sensor_occupancy has to go from OFF, clear etc to ON, detected ect.

To check your time go into developer tools / templates and paste this code below. It will show you the time of HA.

{{ now() }}
{{ now().astimezone() }}
{{ utcnow().astimezone() }}
{{ now().now() }}
{{ now().today() }}
{{ now() }}
{{ now().tzinfo }}
{{ now().astimezone().tzinfo }}
{{ now().weekday() }}
{{ now().date() }}
{{ now().time() }}
{{ now().strftime('%d-%m-%Y') }}
{{ now().strftime('%d-%h-%Y') }}
{{ now().strftime('Your HA time is %H:%M:%S and the Date is %d-%h-%Y ') }}

If this is what I am thinking (HA has the wrong time) then you will have to set up your time in - settings / systems / general and set your time zone.

If still no luck please provide your trace line screen shot.

Let us know how you go.

Blacky :smiley:


Thanks you so much for your blueprint! Is the most reliable and customizable one that I have found. I would like to suggest only one additional option, the use of a blocker entity. I have a shower cabin in my bathroom, and it is impossible for the motion sensor to see somebody through the glass, so I have a door contact sensor on the shower doors and I would love to use this so when the cabin is closed, the lights would not go off. Please let me know if this is possible and if I can help in any way to make it happen.

Thanks in advance.

i did as told and yes when just having the night light option on it works but as soon as i add somewhere else it doesn’t work. Wonder Why PS my time is correct


Hi Daniel, firstly welcome to the community :+1:

Thank you for your kind words :smiling_face_with_three_hearts:

Yes it is possible in the current blueprint :+1:

What you would need to do is use the by-pass and select ether option 1 or 3. Because your door sensor will probably be OFF when the door is closed and ON when it is open we will need to reverse this sensor state. To do this you can create a template sensor in your “configuration.yaml” file. Below is the code you will need to use in your “configuration.yaml” file and you will need to replace the “binary_sensor.your_shower_door_sensor_here” to your actual entity name.

  - platform: template
        friendly_name: "Shower Doors"
        device_class: door
        icon_template: mdi:door
        value_template: >-
          {{ is_state('binary_sensor.your_shower_door_sensor_here', 'off') }}

The "friendly_name: “Shower Doors” change “Shower Doors” to your liking, the text “shower_door:” change the text to you liking and you can also change the icon if you like.

Once done you will then need to restart HA for the sensor to take affect. Then add your new sensor into the by-pass with enable option 1 or 3 :tada:

Hope this help, and if you have any question please ask.

Let us know how you go.

Blacky :smiley:

Ok, if your time is correct then it should work. We know the blueprint works so I must be something on your end. Please go into your automation and on the top right there is “Traces”. Trigger the sensor and then look at the traces. If you can, please do a screen shot of this and paste it into this post so we can see what is happening. Also note in the traces it will indicate the time to, so triple check this.

First of all, thanks for publishing this automation! It looks like it will do exactly what I want, if I can get it to work.

However, I am having problems just getting it to trigger in the simplest configuration (just adding a sensor and a switch). This is what I see when I edit it in yaml:

 alias: lights
 description: ""
   path: Blackshome/sensor-light.yaml
       - binary_sensor.garage_motion_sensor_occupancy
       device_id: 24a111edd2c57f37d3ed2cdaa01cddfe

In my dashboard I can see the sensor goes from “clear” to “detected” when I move, and can get other simpler light automations (that don’t have as many features as this one) to trigger off of it. Seems like I am missing something basic, but can’t figure out what.

I set homeassistant up a few years ago, but didn’t do anything beyond connect my thermostat till now. I just updated everything with an update button, but maybe there is something stale somewhere?

You can ignore my question. I found the answer by reading this post a few posts up:

I just had exactly this happen. Couldn’t figure out why it wasn’t triggering. It was a device (blue) that I had chosen not the Entity (green). I wasn’t even thinking that could be a problem because to me the trigger was what mattered. Still learning.

I did look through the FAQ and didn’t find this answer, so may be worth adding a note there or something.

firstly, awesome automation @Blacky !
I just started using this blueprint with 3 automations (for now) and I think there may be a bug. Note, I have not used a previous version and recently started on HAss - former Smartthings users for many years including using Edge drivers…

Seems like the transition object is mandatory, it needs to be checked and anything < 0. I started debugging my automation with 1 second for both on and off transistions, graduated to 0.1 for both on and off and transition enabled. If I uncheck the transition, the automation doesnt fire.
Here is the trace timeline (not sure what else would help you).

Triggered by the state of binary_sensor.motion_living_room_3 at June 28, 2023 at 9:52:36 PM

Test if any of 12 conditions matches

Test if any of 6 conditions matches

Test if any of 3 conditions matches

Test if any of 6 conditions matches

Test if any of 3 conditions matches

Test if any of 3 conditions matches

Choose: Default action executed

Stopped because an error was encountered at June 28, 2023 at 9:52:36 PM (runtime: 0.07 seconds)

Transition value 0 is not valid.

For now, as a workaround I have transitions enabled and 0.1 for on and off values.
Hope to hear back from you. This community seems to be great!