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

Thank you. In short, I only have one sensor; and here is the code:

alias: Master bathroom lights on Motion
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.multisensor_7_master_bath_motion_detection
    light_switch:
      entity_id: light.master_bathroom
1 Like

@chassio

Thanks for your YAML. This is the most basic setup you can have.

I have done a lot of testing here and it should work, so let’s assume the BP works.

I 100% believe you in what you are saying so lets try and resolve it.

Your motion sensor… in the wording it says multisensor so lets explore that.

Is this sensor a PIR and a mm-Wave sensor? or is it something that also works of LUX? We need to see if this entity is effected buy another sensor. The sensor in HA should go from OFF (clear) to ON (Detected). It can’t go from unavailable to ON. We also need to make sure it not effected by another sensor as I have had other community with the same problem. Look in the device and see what sensors you have. Add the entity into a dashboard and look at the state changes. Then let us know what you find even a screen shot will help.

Blacky :smiley:

(first post, go easy!)

This looks awesome, but I’m having a couple of issues trying to get it to setup how I would like.

Let me explain what I’m after, and then the issues I’m encountering.

I have two motion sensors (cameras) grouped together on my drive way that I would like to use as the sensors. I have a dimmer switch that controls the lightning on the drive way. I would like to use the “Night Lights” functionality to turn these lights on based on the sun elevation, essentially setting the dim level to 50% at dusk, and then off at dawn. I would like to use the “sensor” functionality to turn the dim level to 100% when motion is detected during “night time” (as defined by the sun elevation in night lights), and then back to 50% (the value set by night lights) when there is no motion.

I believe I have everything configured correctly, the lights come on/off based on the sun elevation, and the lights are triggered based on the motion sensors. I’m seeing two issues though:

  1. When the motion is cleared by the sensor group, the dimmer is turned off completely rather than reverting to the value specified by the “Night Lights” functionality.

  2. When the motion sensor is cleared, the lighting is turned off which seems to trigger another motion sensor event, repeating the process indefinitely. Is there a way to ignore motion changes for a couple of seconds (ideally the “Light Control: Transition - OFF” setting plus a second or two) while the lightning changes?

Here is a snippet from the Logbook last night:
Sensor Group turned off triggered by state of Camera Motion cleared (no motion detected)
10:19:29 PM

Dimmer turned on triggered by automation Sensor Light triggered by state of Sensor Group
10:19:26 PM

Sensor Group turned on triggered by state of Camera Motion detected motion
10:19:26 PM

Dimmer turned off triggered by automation Sensor Light triggered by state of Sensor Group
10:19:25 PM

Sensor Group turned off triggered by state of Camera Motion cleared (no motion detected)
10:14:25 PM

Dimmer turned on triggered by automation Sensor Light triggered by state of Sensor Group
10:14:22 PM

Sensor Group turned on triggered by state of Camera Motion detected motion
10:14:22 PM

(I have set the time delay for 5 minutes)
This went on and on until after the sun was above the value defined in “Sun Elevation”.

Any ideas on how to get this to work with this blueprint, or should I start tinkering on my own?

@Blacky - that’s an idea, but wouldn’t it be much easier and straight forward to have the option to use helpers as condition? Is that something you would maybe implement?

Hi! Blacky will likely have a better solution for you, but the way I think about it, you don’t need to use the night lights section. Here’s something you could try.

  1. Create two scenes - one for lights at 50% and one for lights at 100%
  2. Create a schedule helper for the duration you want the sensors to trigger lights (a few hours before sunset to a few hours after sunrise)
  3. Add the schedule helper as a trigger (along with your existing motion trigger)
  4. Choose your 100% scene in the Lights section and the 50% scene in the “Scenes - Scripts to turn OFF” (follow the faq to create a toggle helper that will be required when using scenes)
  5. Keep your sun elevation settings as is.

@JoshPearson

Hi Josh, welcome to the community.

Looks like you close but I will walk you through how to do this.
You have two options:

  1. Using this Blueprint (Sensor Light): This option doesn’t include a delay feature. In this case, the light will immediately dim from 100% to 50% as soon as the motion sensor clears, without any delay. If your motion sensor has a built-in delay, you can set that delay to wait before it sends a “clear” signal to Home Assistant. You can also create a template binary sensor that will have a delay for you motion sensor. If you need help just let us know.

  2. Using the Smart Light Blueprint: This option doesn’t include a delay feature, but it removes the need to create a schedule helper. In this case, the light will immediately dim from 100% to 50% as soon as the motion sensor clears, without any delay. If your motion sensor has a built-in delay, you can set that delay to wait before it sends a “clear” signal to Home Assistant. You can also create a template binary sensor that will have a delay for you motion sensor. If you need help just let us know.

Using this Sensor Light BP.

  1. Create a schedule and add it into the trigger. Set the time in the schedule to be well before sunset and well after sunrise. Example 4:00pm to 10am.

    How to create a schedule helper our a time of the day sensor helper.

    • Go to settings / Devices and Services / click on the helper tab at the top, then click create helper.
    • Then click “Schedule” or “Time of the day” and input your settings as required.
  2. Add your lights into Light. Use entities only. Then set up your Light Control for 50%.

  3. Use the Sun Elevation condition (Not in night light the main one). Set it up as required.

  4. Enable night lights in Night Lights Settings and use the state condition by Enable entity state option. Then enter in your motion sensor into Night Lights - Entity State

  5. Add your lights into Night Lights.

  6. In Night Light Control set your brightness to 100%. Set the Night Lights - Transition - OFF (this can help you on how long it takes to go from 100% to 50%). Make sure you select If lights are ON, adjust the lights when crossing over.

Your done.

Using this Smart Light BP.

:high_brightness: Smart Light - Entity - Sun Elevation - Ambient & Time Triggers

  1. Use the Sun Elevation trigger (Not in night light the main one). Set it up as required.
  2. Add your lights into Light. Use entities only. Then set up your Light Control for 50%.
  3. Enable night lights in Night Lights Settings and use the state condition by Enable entity state option. Then enter in your motion sensor into Night Lights - Entity State
  4. Add your lights into Night Lights.
  5. In Night Light Control set your brightness to 100%. Set the Night Lights - Transition - OFF (this can help you on how long it takes to go from 100% to 50%). Make sure you select If lights are ON, adjust the lights when crossing over.

Your done

Hope this helps you, let us know how you go.

Blacky :smiley:

1 Like

@Magix3D

Can you explain why would would like this feature? Your use case.

Blacky :smiley:

@Blacky - sure thing :slight_smile:

I have a few automations in which I activate the ceiling lights by motion.

At night I have light strips automatically turned on so I don’t want the ceiling lights to turn on when motion is detected since the lightstrips emit enough light.

Hi I have a playarea that I want to use this blueprint with but I only want the light to trigger only if there has been presence for 2 minutes. if I make a automation from scratch this can be done by using the “For” option after selection the motion entity

example
platform: state
entity_id:

  • binary_sensor.mmwave_21_251f7c_zone_1_presence
    for:
    hours: 0
    minutes: 2
    seconds: 0

Is this possable to add or is there a helper that I could setup for this?

When you turn ON your light strips also turn ON a toggle helper and then put it in bypass option 2.

Blacky :smiley:

@littlekools

Welcome to the community.

Have a look at this link on how to create a template Click Here. Look at CCTV Camera Motion Sensor. Once created add this to your trigger.

Blacky :smiley:

1 Like

Hi. First time I check out this blueprint. Looks very nice. However, I have a question. I want to use dynamic lighting only, do I still need a trigger? My plan is to enable the automation when the house “wakes” and disable it at “night time”. I have a really hard time getting the dynamic lighting to work. I set a flashlight to the sensor to trigger the lowest light settings, but nothing happens, the automation never gets triggered.

@vegard

In order for dynamic light to work the trigger must be ON.

Looks like you would like trigger points. A state change (ON) when your house wakes up and disable at night time. Have a look at this blueprint :high_brightness: Smart Light - Entity - Sun Elevation - Ambient & Time Triggers this triggers on state, sun, ambient and time. Then use dynamic lighting. I will be updating it so you can use the sun triggers for daytime.

Blacky :smiley:

@Blacky Hello. I am using “Sensor Light” + “Manual Light” for the same light in room.

Sensor Light:

  1. :white_check_mark: Enable the Bypass - Keep the lights current state
  2. :white_check_mark: Enable the auto OFF for the bypass switch - Keep The Lights Current State
  3. Bypass - Time Delay: 1 minute. If I set 0, then if there is no movement at the moment of switching the bypass, the light immediately turns off

Manual Light:

  1. :white_check_mark: Enable the motion sensor option
  2. :white_check_mark: Enable the timer helper option
  3. Timer delay: 10 minutes

I think the “Manual Light” script should add a timer pause using a bypass to synchronize automatic and manual light for the same lighting.

I added a simple integration.
Triggers:

  1. Timer changed state to active
  2. Bypass state changes (any)

Actions:
If bypass is on:

  • timer pause

Otherwise:

  • start timer

However, after some time, the logic of the light completely breaks down and it starts to turn off after just a few seconds (there is no strict constant)

Thanks for the quick reply. I think I’ve figured it out now :slight_smile: :+1:

1 Like

@Blacky - works like a charm. I guess I didn’t get the function of the bypass right - thanks for the help and the clarification :slight_smile:

1 Like

Thank you for the help. this is my first attempt at a yaml template but i beleave i did got it working. after standing in the middle of the zone for 2 minutes the sensor turned on

what i set up
template:

  • binary_sensor:
    • name: ‘playroom mmwave 2min delay’
      device_class: motion
      icon: mdi:motion-sensor
      state: >
      {{ is_state(‘binary_sensor.mmwave_21_251f7c_zone_1_presence’,‘on’)}}
      delay_on:
      seconds: 120

I’m too embarrassed to admit what was wrong. Just wanted to thank you for taking the time to respond with support.

1 Like

@SeRG1k17

Hi Sergey. thanks for the clear information. I haven’t thought about this link. I put it on the list.

Blacky :smiley:

@littlekools

Nice one looks good… you even updated the icon, nice work.

Tip: If you would like to use minuets you can do it like this.

template:
  - binary_sensor:
      - name: ‘playroom mmwave 2min delay’
        device_class: motion
        icon: mdi:cctv
          {{ is_state(‘binary_sensor.mmwave_21_251f7c_zone_1_presence’,‘on’)}}
        delay_on:
          minutes: 2

Tip: If you would like to use minuets and seconds you can do it like this.

template:
  - binary_sensor:
      - name: ‘playroom mmwave 2min delay’
        device_class: motion
        icon: mdi:cctv
          {{ is_state(‘binary_sensor.mmwave_21_251f7c_zone_1_presence’,‘on’)}}
        delay_on:
          seconds: 30
          minutes: 2

Blacky :smiley:

1 Like