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

@kermit20

I believe Z2M changed the sensor ID’s. You’ll have to delete the old sensor ID’s and enable the new one, in each device, then change all the automations that used the old sensor ID’s.

Blacky :smiley:

@Ltek

Yes.

If it get re-triggered then the time delay starts again once the trigger is clear.

Look at this blueprint. :magic_wand: Manual light control with auto OFF and Enable the motion sensor option

I have a few blueprints for different things so make sure you check them out. You will find links to them all in the first post at the top.

Blacky :smiley:

1 Like

@MangoMC

Have a look at the bypass section. You will probably use option 2 - Enable the Bypass - Turn lights OFF and use the entity for alarmo that is ON when you set it to night.

Blacky :smiley:

@Blacky question… how can I tell the automation to only fire when the light is = OFF ? For example, if the light is already on 50%, I dont want it this automation to fire (when it senses motion) because it would set the light to 100%.

Thank you, your Blueprints are fantastic! I sent you a direct message about a few ideas.

Hi there,

I have been using the automation with a hue bridge. When I trigger the automation after the sun has set (such as to revert from scene I have set), it will adjust the brightness as expected it will not change the light temp. When the sun is above the set elevation, the correct temp will be set. Perhaps there is a config error in the automation? I have toggles set up for all settings. What am I doing wrong?

Many thanks.

@Ltek

The automaton can be triggered on many things and it needs to be trigger for it to work correctly. So it will need to fire when it senses motion again as this is how it will keep the lights ON. I written it so it will not effect your lights once they are ON. If you are using a scene or script then you will need to make sure you add the Scenes & Scripts - Toggle Helper as this is why it is there only when using a scene or script. Lights and switches don’t need this helper.

Try it out, trigger the automation so the lights turn ON, adjust the light % or colour, then let you motion go to clear and re-trigger the motion sensor. Your lights should stay the same.

Blacky :smiley:

1 Like

@otymm

Welcome to the community.

Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. 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.

Blacky :smiley:

Thank you. I didnt see it documented that the light would not change but yeah, been playing with it today, works nicely.
Would love for this same BP to be able to be triggered by any Entity change, not just a Sensor.

@Ltek

You can, as long as the entity has an On / OFF state. Just copy the entity ID and paste it in. If the entity does not have an ON / OFF state then you can create a template sensor to handle it for you.

Blacky :smiley:

Many thanks for helping, please see below. I should note that if I remove all triggers and manually run the automation, it will first turn off the lights, then on the second, it will turn them back on with the correct temp. If any trigger is used, it will only ever change the brightness, not the temp.

alias: Study Dynamic Lights
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.study_dynamic_lighting_binary_sensor
    light_switch:
      entity_id: light.study_2
    include_light_control:
      - use_transition
      - use_brightness
    light_transition_on: 3
    light_transition_off: 3
    include_light_colour_control: use_colour_temperature
    light_colour_temperature: 3500
    include_dynamic_lighting: enable_sun_elevation_colour_lux_brightness
    dynamic_lighting_lux_sensor: sensor.illuminance
    dynamic_lighting_max_lux: 10000
    dynamic_lighting_min_colour_temp: 2200
    dynamic_lighting_time_start_morning: "06:00:00"
    include_device_tracker: zone_people_enabled
    include_night_lights: night_lights_disabled
    night_lights_conditions:
      - time_enabled
    include_night_glow: night_glow_disabled
    night_glow_lights:
      device_id: 31f39a37abb58369224cdf4eccb9b273
    night_glow_light_brightness: 1
    dynamic_lighting_min_lux: 500
    dynamic_lighting_max_colour_temp: 6500
    dynamic_lighting_step_value: 100
    dynamic_lighting_time_end_morning: "09:00:00"
    dynamic_lighting_time_end_evening: "21:00:00"
    include_time: time_enabled
    after_time: "06:00:00"
    before_time: "21:00:00"
    night_lights_after_time: "21:00:00"
    night_lights_before_time: "06:00:00"
    include_night_light_control:
      - use_brightness
      - use_transition
      - if_lights_are_on_adjust_when_crossing_over
    night_light_brightness: 20
    night_light_transition_on: 5
    night_light_transition_off: 5
    include_night_light_colour_control: use_colour_temperature
    night_light_colour_temperature: 2200
    ambient_light_options: ambient_light_option_enabled
    dynamic_lighting_min_brightness: 20
    night_lights_entity_state: []
    zone: zone.home
    people:
      - person.oliver
    time_delay: 0
    end_scenes: []
    motion_bypass_lights_stop:
      - input_boolean.bypass_keep_state_study
    include_bypass_auto_off: []
    bypass_auto_off_delay: 240
    include_bypass: []
    bypass_time_delay: 5
    motion_bypass_lights_off: []
    light_brightness: 52
    boolean_scenes_scripts: input_boolean.study_scene_toggle_helper
    dynamic_lighting_boolean: input_boolean.study_dynamic_toggle_helper
    night_lights:
      entity_id: light.study_2
    night_time_delay: 0
    night_boolean_scenes_scripts: input_boolean.study_night_toggle_helper
    dynamic_lighting_state_control_entity: light.study_2
    dynamic_lighting_state_control: disable_state_control

Thank you, I didn’t know that would work since the drop-down list automatically filters to only show the user Sensor devices, not dimmers or switches. Your BPs have so much functionality (which is awesome) and of course, I need functionality that isn’t documented :wink:

THANK YOU for responding quickly to help guide us! Using your Sensor and Manual BPs have allowed me to replicate my old Homeseer based “core” lighting automation (stuff that is in nearly every room: light timers, motion lighting, etc) with more ease and additional functionality too!

now if I can only convince you to combine both BPs into one (Manual and Sensor) :stuck_out_tongue:

I looks like the main difference is Sensor doesnt ‘sync’ the devices? If that was in Sensor, I could remove all the Manual BPs, reducing my Automations by 50%.

@Blacky Its not working as I’d expect…

I have 2 Automations… one Sensor and one Manual

ON works : Turning on Master or Slave dimmer correctly turns on the Group and other dimmer .

OFF does not work : turning off either device Entity; neither the other entity nor the group turn off.

Are you sure the Sync function in Sensor works with groups?

@otymm

Thanks for your YAML.

I see you have tried a few things… what I have done is cleaned up all your YAML and enabled what I think your trying to do. Now you can just disable the night lights and night glow if you don’t want it.

Things I changed.

  1. Removed the toggle helpers for Scenes & Scripts - Toggle Helper as your using a light entity and don’t need it.
  2. Set the Time Delay to 5 and set the Night Lights - Time Delay to 2. They were on 0 so as soon as the trigger cleared the light would go OFF and you wouldn’t have a buffer (light could of gone ON and OFF all the time)
  3. In light control disabled Use Brightness and Use Colour Temperature because dynamic lighting will do this for you. It wont matter if it is enabled but when using dynamic lighting option 8 they wont be used anyway.
  4. Removed the Dynamic Lighting - Toggle Helper as your min brightness is 20%. You only need this if your min brightness is set to 0%.
  5. Set the Dynamic Lighting - Step Value from 100% back to 4%. Your heart beat is 1 min so having 4% will be better on your eyes and it will work better.
  6. Removed your light from Dynamic Lighting - State Control Entity. You shouldn’t use your light in this option. It should be another entity like a toggle helper if you would like to toggle between using dynamic lighting and normal lights. It is an option so you don’t need to use this for dynamic lighting to work… the option was disabled anyway but I just cleaned this up.
  7. Removed the time option. Looks like you were trying to get this to work with night lights. Only use this if you would like to restrict the automation to only work between the time frame. This is global and will stop night lights working they way you set it up. See the link in the blueprint for more information on time.
  8. Enabled night lights. This is were the time condition option will run night lights.
  9. Enabled night glow, removed the device you enter in to Night Glow - Lights as you can ONLY use entities, then I added your light entity in an set up the brightness option.
  10. In the bypass I also selected 3 - Enable the Bypass - Keep the lights current state. Remember if this input_boolean.bypass_keep_state_study is ON then the automation will be paused and will not run / work. Make sure this is OFF when testing.

From all of the changes you will see how the whole blueprint will work now. If you don’t want night lights or night glow you can disable them but I thought I would just set it all up for you so you can see everything set up correctly. Copy and paste your YAML in and test it out using your motion sensor.

alias: Study Dynamic Lights
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.study_dynamic_lighting_binary_sensor
    light_switch:
      entity_id: light.study_2
    include_light_control:
      - use_transition
    light_transition_on: 3
    light_transition_off: 3
    include_dynamic_lighting: enable_sun_elevation_colour_lux_brightness
    dynamic_lighting_lux_sensor: sensor.illuminance
    dynamic_lighting_max_lux: 10000
    dynamic_lighting_min_colour_temp: 2200
    include_device_tracker: zone_people_enabled
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - time_enabled
    include_night_glow: night_glow_enabled
    night_glow_lights:
      entity_id: light.study_2
    night_glow_light_brightness: 1
    dynamic_lighting_min_lux: 500
    dynamic_lighting_max_colour_temp: 6500
    dynamic_lighting_step_value: 4
    night_lights_after_time: "21:00:00"
    night_lights_before_time: "06:00:00"
    include_night_light_control:
      - use_brightness
      - use_transition
      - if_lights_are_on_adjust_when_crossing_over
    night_light_brightness: 20
    night_light_transition_on: 5
    night_light_transition_off: 5
    include_night_light_colour_control: use_colour_temperature
    night_light_colour_temperature: 2200
    dynamic_lighting_min_brightness: 20
    zone: zone.home
    people:
      - person.oliver
    time_delay: 5
    motion_bypass_lights_stop:
      - input_boolean.bypass_keep_state_study
    include_bypass_auto_off:
      - bypass_auto_off_enabled_stop
    bypass_auto_off_delay: 240
    include_bypass:
      - bypass_enabled_stop
    bypass_time_delay: 5
    light_brightness: 52
    night_lights:
      entity_id: light.study_2
    night_time_delay: 2
    include_night_glow_light_control:
      - use_brightness
      - use_transition
    include_night_glow_light_colour_control: use_colour_temperature
    night_glow_light_colour_temperature: 2200

Let us know how you go.

Blacky :smiley:

@Ltek

Syncing Lights in Home Assistant (HA)

In Home Assistant, syncing all your lights is commonly achieved using a light group. A light group entity allows you to control all included lights as a single unit, ensuring they turn ON and OFF together while staying synchronized, including attributes like effects, brightness, colour, or colour temperature.

However, if you turn ON or OFF, or change the effects, brightness, colour, or colour temperature of one of the individual entities within the group, the group will no longer remain synchronized. To maintain synchronization, you must control the group entity itself.

Sync Option in Manual Light Blueprint

The sync option in the manual light blueprint ensures that your lights (entities) turn ON and OFF together. However, it does not sync other attributes like brightness, colour, or colour temperature.

In the manual light blueprint, the lights themselves act as triggers. This differs from the sensor light blueprint, where the motion sensor is the trigger. These differences mean the two blueprints cannot be combined seamlessly.

Sensor Light Blueprint Behaviour

The sensor light blueprint uses a motion sensor to turn all your lights (entities) ON and OFF. If you manually turn OFF one light, the others will remain unaffected because the lights are not the triggers. Additionally, if you manually turn OFF a light but the motion sensor triggers again before the rest of the lights turn OFF, the blueprint will turn the light back ON.

Manual Light Blueprint Use Cases

The manual light blueprint is ideal for situations where you want to manually control a light while incorporating additional features such as time delays or motion-based interactions. Here are some practical examples:

  1. Reading Lamp in a Motion-Sensor Room
    Use a sensor light blueprint to control the room’s main lighting with motion, while a manual light blueprint handles a reading lamp that you might turn ON manually. When you leave the room, both blueprints can work together to turn OFF all the lights, ensuring nothing stays ON unnecessarily. Of course, you can manually turn OFF the reading lamp anytime, but if you forget, the blueprint will handle it for you.

  2. Manual Control with Motion-Based Continuity
    Enter a room and manually turn ON a light. The motion sensor keeps it ON while you’re present, and the manual light blueprint ensures it turns OFF when you leave after a set time delay. You can still manually turn OFF the light if needed, but if you forget, all lights will turn OFF automatically.

  3. Time-Delayed Lighting Without a Motion Sensor
    In spaces like a garbage room, toilet, or any area where a motion sensor isn’t necessary, the manual light blueprint lets you manually turn ON a light (or even a fan) and automatically turns it OFF after a set delay. You can manually turn OFF the entity at any time, but if you forget, the blueprint ensures nothing is left ON.

Conclusion

Both blueprints have unique purposes and cannot be combined due to their differences in trigger behaviour. Understanding these distinctions allows you to use each blueprint effectively for different scenarios.

Blacky :smiley:

First of all, many thanks for the great support. You always do a lot of work here for each individual case. Respect for that.

I had configured motion_bypass_lights_on and motion_bypass_lights_stop separately just a few days ago, because I suddenly read in the blueprint that you can’t configure both values with the same entity. I didn’t even know that before. But it doesn’t really matter here.

I think your suggestion of using motion_bypass_lights_off with “Auto off” is a good one. However, I also had to switch off the light via a light.turn_off action, because otherwise I would have to wait for the “Auto Off Delay” before anything happened at all.

Unfortunately, everything is a little awkward with the bypass. But at least this way it works.

Did you change anything here with regard to retriggering? That wasn’t the case a few versions ago.

Thanks again for your blueprints and the excellent support.

“Just wanted to say ‘Thank you’! This is exactly what I was looking for in my workspace. Now I am no longer sitting in the dark because I am too lazy to change the brightness.
I trigger the dynamic lighting with a sensor ‘ping’ and look for my laptop. If it is available, your blueprint will take action. If the laptop is offline, I take manual control of the lights again. :+1:”

@Herr.Vorragend

I made some changes for crossing over and so it will work using automation link in my other blueprints. I have tested it here again through many options and I cant fault it.

You could try going back to Version 7.3 and see if that resolves it.

Blacky :smiley:

1 Like

@BastiKA84

Thanks for sharing your experience… it is really nice to get these ones. Glad you like it and it helped you :smiling_face_with_three_hearts:

Blacky :smiley:

Continuing the discussion from :bulb: Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights:

Hello Blacky,

Got an issue and not sure what the problem is. I have a light attached to Tapo P135 which is a plug with dimmer and remote switch. I’m using to automation; 1. Third reality motion sensor set to work from 5pm to 5:25am Blueprint Light Sensor, 2. Timed light on/off Blueprint Turn Light, Switch, Entity or Scene On & Off with Trigger Conditions.

Problem is motion sensor keeps turning on light after 5:25am.

Blueprint Light Sensor, YAML

alias: Motion Sensor - Office Light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.third_reality_inc_3rms16bz_motion
    light_switch:
      entity_id: light.office_light
    include_light_control:
      - use_brightness
      - use_transition
    light_brightness: 70
    light_transition_on: 3
    light_transition_off: 5
    include_time: time_enabled
    after_time: "17:00:00"
    before_time: "05:25:00"
    weekday_options:
      - mon
      - tue
      - wed
      - thu
      - fri

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

alias: Office Light
description: ""
use_blueprint:
  path: Blackshome/entities-on-off-trigger-conditions.yaml
  input:
    entity_switch:
      entity_id: switch.office_light
    include_time: time_enabled
    after_time: "05:30:00"
    before_time: "06:15:00"
    weekday_options:
      - mon
      - tue
      - wed
      - thu
      - fri
    include_weekdays: weekday_enabled

Very good Blueprint, so many options :slight_smile: But i wounder how to use conditions in this Blueprint?

I like to use this Blueprint for a “Nightlight”, when someone go up to the toilet, but it should only start the light if other lights are turned off.