Turn on light, switch, scene, script or group based on motion, illuminance, sun (+ more conditions)

hi, how did you create wait_time_off entity?

you create an input number helper entity. It is described in the start topic:

Defining optional entities in the UI

If you want to create the optional entities in the UI instead of in YAML, you can do so in the following way:

  • To to Configuration
  • Go to Helpers
  • Click the ‘Add helper’ button
  • Select the entity type (in this case, number, toggle or date/time)
  • Enter required fields
  • Click on create

How can I miss that?!?, Thanks

Anyone have issues with this automation turning off the light, instantly once the motion sensor clears? I updated it from the gist today, have the time wait time off set to 60 [minutes], moment the motion sensor clears light shuts off?

Or I can literally read the posts above, saying it needs a helper…

Perhaps not so specific to this blueprint - please redirect me if there’s a better place to post.

I am having trouble with the blocking entity for turning off. It says “If this entity’s state is on, it will prevent the target entity from turning off after the set delay.” I have set up HASS.Agent on my windows PC and I want the blocking entity to be “on” if my user is logged into my PC (so my office lights don’t turn off when I’m logged in). I’ve got the sensor from HASS.Agent showing up in my entities, but it has a string value (my username). What’s the easiest way to have a new helper that is “on” if the value of another sensor is equal to a string I define?

After some googling, I figured it out. Added this to my configuration.yaml

  - binary_sensor:
      - name: "office_turnoff_blocking"
        state: "{{ states('sensor.cams_pc_loggeduser') == 'Cameron' }}"

thanks for this great working blueprint! As a HA newbie I wonder how I can add a second trigger for a normal light switch. So using same automation with auto shutoff after 30s or extended if motion is regonized (works good so far) but trigger should be 1) motion detected and illumination lower than predefined helper entity OR 2) light switched on manually (not button) with ShellyPlus 1 (independent of illumination level).

Thanks and best regards!

Easiest and probably best is to make a helper for that, a template boolean combining the two separate actions and feeding the helper to the blueprint. If you want to configure it via the GUI you can of course also create another automation turning on and off the helper by means of changes on the other two options.

1 Like

I’m discovering the blueprint thanks for it !
@freakshock I’ve the same question :).
With a scene it is not working in my case.
I’ve also another issue: i’m not setting timeout value so after motion is off the group of light go to off.
After that I’ve added a boolean to indicate that my switch turned on/off the light. It is working correctly in the dashboard.
This entity was then added as a blocker for timer but it is not working. The value is on and the light stop. Any ideas ?


I’m busy configuring a simple instruction to open a particular scene of a room using a Philips Hue Motion detector. This is my configuration but it doesn’t work…

alias: Turn on light, switch, scene, script or group based on motion and illuminance.
description: “”
path: freakshock88/motion_illuminance_activated_entity.yaml
target_entity: scene.woonkamer_gedimd
motion_sensor: switch.hal_sensor_1_motion

Must I maybe tell the Hue App not to use the Motion detector anymore before this could work?

Is there a hybrid method for defining a new helper entity from within the template UI? For example, a “new” item from the UI dropdown, that opens the helper and then returns the value of the new entity when you’re done? I’m not sure if HA has such a capability, but it would make the template much faster and easier.

I’ve added a helper with number as descibed. The min value is 10 and the max is 100. If I add this helper in the section “(OPTIONAL) Illuminance cutoff value
This input_number will be used to compare to the current illumination to determine if it is low.” nothing happens when I put my hand on the sensor it should be triggered under the value 10 and with my hand on the sensor the value is 2.

Who can show me how to edit this wonderful blueprint so I can set turn-off time in seconds instead of minutes?

Even if i am new to blue prints, that should be an easy task. First i would create a copy of the blue print. How to do that depends on your setup.

Then open the blueprint. I use the Studio Code Server plugin to access the files. You will find the blueprint in the blueprints folder and there in the subfolder Blackshome


Open the Yaml and look for turn off time like this example

As you can see there is an optin “unit_of_measurement”. Just change it to seconds

Save and thats it.

How does this blueprint react if a user manually turns on a light through the app or with a switch?

A little question: What if I want to set no_motion_wait to seconds or 1/2 minute? I set a helper to “minimum value” 0,5, “maximum value” 1, and blueprint doesn’t turn the light off.

The aquara motion detector I have also has an “occupancy” feature which shows if the room is occupied. As long as there has been movement in the last 10 minutes it is in an “on” state.

I’d like to add a second blocking entity using this so that if I go in the room but stay there, subsequent motion in the occupied room doesn’t turn the lights on. Is there a simple way to do this?

Note to self: the blueprint does not handle scenarios where the user turns on the light via the app or with a remote i.e. the lights will not turn off after the timeout period.

perhaps Blacky’s blueprint helps you for that scenario:

It’s also a blueprint that still receives support and updates

1 Like

Anychance of adding an update for handling lights with a dimmer? EG i want the light on but only 10%. I could solve this with a scene or something i suppose, but could also be baked in :grin:

I can’t remember now :grinning: but I do have it working with Ring motion sensors.