šŸ’” Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

@dmob69

Import this blueprint Sensor Light and remove or disable the smart light automation you created.

This will be your YAML for this sensor light blueprint.

description: ""
use_blueprint:
  path: Blackshome/smart-light.yaml
  input:
    motion_trigger:
      - binary_sensor.epl_kitchen_zone_1_occupancy
    light_switch:
      entity_id:
        - light.kitchen_cabinets
        - light.kitchen_island
    include_light_control:
      - use_brightness
    light_brightness: 69
    include_light_colour_control: use_colour_temperature
    include_sun: sun_enabled
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - time_enabled
    night_lights_after_time: "06:45:00"
    night_lights_before_time: "08:00:00"
    night_lights:
      entity_id: light.kitchen_cabinets
    include_night_light_control:
      - use_brightness
      - if_lights_are_on_adjust_when_crossing_over
    include_night_light_colour_control: use_rgb_colour
    night_light_rgb_colour:
      - 217
      - 211
      - 48

Blacky :grinning:

@mattbsea

What’s likely happening is that when User 1 exits and turns the light OFF, the motion sensor is still active. Then, when User 2 enters, the sensor remains active, so the automation doesn’t trigger again to turn the lights ON.

This isn’t caused by the time delay, as the delay only starts when the motion sensor is clear. If motion is detected again before the delay completes, the timer resets and waits for the sensor to go clear again before starting the delay.

Hope I am on the right track here.

Blacky :grinning:

@DariusM73

I changed 2 things.

  1. Enabled ambient condition
  2. Deleted your input for bypass 2. You have selected the wrong entity… it must be your Template Binary Sensor you created and not zone.home. Please select the correct entity here.
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.bm_esszimmer_1_occupancy
    light_switch:
      entity_id: light.couchtisch
    time_delay: 1
    include_light_control:
      - use_brightness
      - use_transition
    light_brightness: 10
    include_light_colour_control: use_colour_temperature
    include_dynamic_lighting: disable_dynamic_lighting
    include_bypass:
      - bypass_enabled_turn_off
    motion_bypass_lights_off: []
    bypass_time_delay: 1
    include_night_glow: night_glow_enabled
    night_glow_lights:
      entity_id: light.couchtisch
    include_night_glow_light_control:
      - use_brightness
      - use_transition
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - entity_state_enabled
    night_lights_entity_state:
      - input_boolean.hass_iobwach
    night_lights:
      entity_id: light.couchtisch
    include_night_light_control:
      - if_lights_are_on_adjust_when_crossing_over
      - use_transition
      - use_brightness
    night_light_brightness: 100
    include_night_glow_light_colour_control: use_colour_temperature
    include_night_light_colour_control: use_colour_temperature
    night_time_delay: 1
    light_colour_temperature: 2100
    night_light_colour_temperature: 2200
    night_glow_light_colour_temperature: 2200
    night_glow_light_transition_off: 3
    night_glow_light_transition_on: 2
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.lichtsensor_beleuchtungsstarke

Blacky :grinning:

@Blacky

I’ve created a schedule helper with all day on because the lights should allways turn on and off.

But on works fine, off dont work. The lux value is 1000+ so that should not be a problem:

description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    light_switch:
      entity_id: scene.ik_ben_thuis
    motion_trigger:
      - schedule.verlichting
    end_scenes:
      - scene.alle_lampen_uit
    include_ambient: ambient_enabled
    ambient_light_sensor: sensor.bh1750_illuminance
    time_delay: 0

Any idea?

I’m getting ā€˜Message malformed: extra keys not allowed @ data[ā€˜triggers’]’ erro when I save my automation.

How to fix it?

@EvertJob

I have tested it again here and it works perfectly. You ambient must go from below 80 to above 80 for it to trigger the OFF as you are using the default values.

Blacky :grinning:

@BroLegend

This is because you are on an older version of Home Assistant. Update Home Assistant if you can and it will work.

Blacky :grinning:

Hello @Blacky

I have a strange error since a couple of seconds and my lights won’t turn on
Edit : but they do turn off when I manually turned them on before


Gestion lumiĆØres bar: Choose at step 1: default: Parallel actions for dynamic lighting and normal lights: parallel 1: Choose at step 10: 8 - Dynamic Lighting - Sun Elevation Lighting - Colour Temp + Lux Controlled Brightness: Parallel actions for dynamic lighting: parallel 1: Dynamic Lighting Control: Error executing script. Error rendering template for variables at pos 1: ZeroDivisionError: float division by zero

I didn’t change a thing in the Blueprint or maybe I did an update of HA Core and Supervisor.
I already update to version 8.0 but didn’t change anything.

Thanks in advance for your help !

Hi @Blacky,

Thanks for this great automation. It works great. I do have one issue that appears every now and then:

  • My motion sensor triggers
  • You automation switches my zigbee lights on
  • Then I use the zigbee remote control that is link to the light, to switch the light of.
  • The next time the motion sensors triggers, the light switches on and instantly off again.

Any suggestions what I might be not seeing?

Relatively new to HA (3 months) and spent today figuring out how to move forward with what (to me) seems like rather complex but realistic lighting automations.

(background - hardware design with some coding experience)

I debated various approaches - a) Pure HA automation using UI; b) NodeRed; c) Blueprints; d) Python; and settled on using what seems to me the best documented, most thorough lighting blueprint possible. Kudos @Blacky for such comprehensive info!

(current setup) HAOS, about 8 lutron dimmers, Eyezon alarm system with door sensors, Ratgdo for garage door. I have some mmwave sensors (EP1 and EPlight) waiting for use, not yet installed, and remember I’m very new at HA thinking.

Kitchen Lights (recessed and pendants either treated as a group or not)

  • home unoccupied - lights stay off, or go off after delay
  • home occupied but ā€˜sleep’ enabled (tbd) - lights go off after delay
  • A. kitchen without motion
    Morning - light brightness starts low (5%) and as sun rises keeps increasing to 20% max (for morning time period) then eventually turn off (10am)
    Evening - light brightness starts low (5%) and as sun sets keeps increasing to 20% max then eventually turn off at midnight (failsafe time)
  • B. kitchen motion - increase brightness above A, then follow path A after delay (if lights off midday, lights should turn on with motion to some value, maybe 100%, then go off after delay
  • C. Door Triggers - increase brightness same as B
  • D. TV Pause Triggers - increase brightness same as B

The overriding theme is that I am hoping to find a tunable solution that addresses all of the various control types, while maximizing the ā€˜cool’ factor such as:

  • baseline keeps the room lighted without motion during periods we commonly walk in and out (avoids constantly going from lights off to lights on due to motion)
  • motion triggers will hopefully increase the cool factor and show that the automation knows something is happening
  • door and TV triggers are useful when someone is in a nearby room (open floorplan) and will signal that something special is happening (arrival of someone from a door, or bathroom break)

I found snippets in reading the past 2 years of posts here, but nothing that totally applies. For a bit I thought I could combine schedule with binary sensor in a group, but that won’t handle case B.

I maybe need to just dive in and experiment (blueprint is already installed) but as I’ve gone through the many different sections of controls I’m finding it hard to understand whether my goals are doable.

ā€œBee in The Hiveā€: This is so brilliant! Thank you so much @Blacky , I haven’t been so happy about an automation like the one with this sensor for a long time!
It works fantastically well! I will definitely use this idea for a few more automations as well.

related question that possibly simplifies my scenario

Q - Can the setting for ā€˜Bypass Switch - Keep The Lights Current State’ be used with a sensor group such that a 2nd automation could override Sensor Light?

Is there a better way to allow for splitting the desired function into more than one automation?

Hi, probably already discussed.

Does the blueprint kind of ignore the Time Delay set to 0? In my case it takes at least 20 seconds for the automation to turn the lights off after the presence sensor reports clear.

Hello! I’m using this blueprint to handle my night glow lights of my house external walls. Since i have some pedestrian gates in my garden, i’d like to trigger the lights when the gate contact switch status changes. If i add that entity to the Triggers parameter the 1 status of the binary sensor is handled as ā€œpresence detectedā€ but the presence itself should be when such binary switch changes (someone open/closed it). How could i do it? Is there a way to achieve that?

Is there an easy way to add a HA binary helper that disables the automation?

For example I (and i assume most people) have binary helpers/sensors like ā€œEnable Kitchen Light Automationā€ etc. Is there an easy way to incorporate something like that to this out of the box? Ive had a look through the docs but seems like i cant find any obvious option, but i feel like i maybe reading some of the docs wrong =/

Hello,
It seems that the error occurs when the sun is set but it works fine during the day. Well, that’s unfortunate because I need my lights during the night :sweat_smile:

@Zeroth25

Could you share the YAML code for your automation settings? This will allow me to better understand your settings and help troubleshoot the issue.

To do this:

  1. Open your automation.
  2. Click the three dots (ā‹®) in the top right corner.
  3. Select Edit in YAML.
  4. Copy the entire YAML code.
  5. Return to the forum and, in your reply, click the </> button in the toolbar.
  6. Paste your YAML inside the code block.

This ensures the formatting stays correct and makes it easier to analyze.

Blacky :grinning:

1 Like

@basje

If you switch your light OFF and motion is triggered again it will turn your light back ON as this is what we are asking the automation to do.

Blacky :grinning:

@SoccerTX

Device Tracker

Bypass option 2

Schedule with dynamic lighting and maybe opt for Dynamic Lighting - State Control Option

Maybe try using night lights with your motion sensor as the state trigger. You will also need to use your motion sensor in the normal trigger. So you will have to group it with your schedule (A option) but your schedule will have to be a template binary sensor so you can group them. Not sure if you know how to do this… if not just let us know and I will show you. Just a note if A is active and then you walk into the room then B will be active… when will you use A :thinking:

Hope this helps you

Blacky :grinning:

1 Like

@knuti1960

Yeah, the :honeybee: Bee In The Hive Sensor blueprint or template binary sensor works so well and not a lot of people know about it. When used with this blueprint you get all the features as well and you can use it for so many other things to.

Glad you like it and thanks for posting this letting us know.

Enjoy

Blacky