⚙ Turn Light, Switch, Entity or Scene On & Off with Trigger Conditions

It’s all working perfectly. Thanks for your help!

1 Like



Sorry its taken time to get back to you. I have 7 RPi’s connected via the remote RPi integration which in turn support about 60 push buttons, they are mostly for Hue lights of different flavors, but some fans and a couple of heaters.

They are working via simple automations and basically just turn on/off.

I saw you great blueprint that could control a whole range of different functions.

I’m interested in turning some lights on/off at specific times and also some with reference to the sun.
Like: sunset + 1 hour → turn light on

Turn light on/off according to the current ambient light level (i have a number of hue motion sensors that also include ambient light sensors)

I would also in the future like to dim lights using the button (which i can do using the app)

this is why i was drawn to your blueprint



If you would like this then you will need this blueprint :bulb: Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time

For this use a schedule in the linked blueprint above (Sensor Light)

We use sun elevation as HA recommend this. You can read up more on this in the FAQ of the sensor light blueprint.

No problem in the sensor light blueprint.

You can do this i the sensor light blueprint and the light will stay that way until it is turn OFF then it will rest back to your settings in the blueprint next time it is turned ON.

Hope this helps you.

Blacky :smiley:

thanks Blacky for your considered response, I shall work my way through it

kind regards.

I’m loving the versatility of this blueprint! I’m using it to control the lighting in my reptile room, with a motion sensor. However, I want the lights to COME ON during the day, based on sun elevation, to provide a more natural seasonal cycle. As near as I can tell, this will only turn the lights on when the sun is moving high → low. Is there a way to invert the sun logic?

If you are using a motion sensor then you should check out my :bulb: Sensor Light Blueprint.

Blacky :smiley:

Of course I posted in the wrong thread :slight_smile: I am using the Sensor Light blueprint, I’ll move the discussion there

1 Like

Hi Blacky, and Happy New Year.

I’m trying to figure out if this is the right Blueprint for what I’m trying to do. I have a bathroom with two separate light circuits. One is dim and soft that turns on and off with Sensor Light whenever motion is triggered. The second one, bright for shaving primarily, I turn on manually at the light switch box.

I’d like to have a situation where the bright manual-on light turns off concurrent with the Sensor Light timing out of the main soft light.

Basically I don’t want to have to remember to turn the bright shaving off manually at the wall switch. Is this the correct blueprint? Or perhaps it is the Trigger Run-On Timer?

Thank you

Probably the easiest way to do this it trough a custom automation.

I will PM you the how to so you can ask questions if needed.

Blacky :smiley:

Where in this blueprint can I define that my motion sensor triggers the light to be switch on? Am I overlooking something?


The best way to do this is to use my :bulb: Sensor Light blueprint.

Blacky :smiley:

I was looking to turn a light On and Off in one automation and this blueprint works great! Thanks for your effort!


No problem, glad you like it.

Blacky :smiley:

Has this stopped working for anyone? Since upgrading to 2020.4 it doesn’t seem to trigger for me for some reason.


All still working here. If you would like to provide your automation YAML I can look at it for you. 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.

I would first try a reboot of your system first, not a restart but a reboot.

Blacky :smiley:

Hi, How can I use this blueprint so the automation work between sun rise and sunset?.

At the moment the moment the automation is working for me fine but from sunset to sunrise :frowning:


You could use time but that is not really what you would like. For a simple automation like this you can always do a simple custom automation. If you are unsure how to do this just let us know and I will help you out.

Blacky :smiley:


It had started working now on 2024.5, but is a bit flakey at the moment.

Here’s the yaml:

alias: Lights - Sunset Presence
description: Lights at Sunset based on Presence
  path: Blackshome/entities-on-off-trigger-conditions.yaml
      entity_id: light.room_lamp
    include_light_control: use_brightness
      - condition: device
        device_id: 98393bc4da40412851193f03a3bea28e
        domain: device_tracker
        entity_id: 0a111dbbe28c9c5332fb45df6563b3b3
        type: is_home
    include_sun: sun_enabled
    include_entity_input: entity_disabled
    sun_elevation: -1.5

Just wondering, could you implement some sort of transition effect like the Hue app? So, it gradually lights up using brightness between 0-100 during select intervals, instead of abruptly turning on?



Sure, looks like I need to give this blueprint some love.

Blacky :smiley:

1 Like

That would be great, thanks!

Also if it’s not too much to ask, maybe an option to set offset?
eg. Turn lights on or off {duration 5/10/15min} before Sunset/Sunrise. :smile: