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

All right, there is something I am messing up here.
The night lights sorta worked as expected in my foyer. When the sleep helper was on, the lights came up when motion detected for the night settings (low intensity red), and when the sleep option was off, they came on with motion at high intensity white.

I tried to copy it in my closet, where there are 3 small lights, one of them an RGBW light strip. I want them to come up, the latter on blue, on daylight. When the bedroom is in sleep mode, the sleep helper should switch this in a way that only the RGBW comes on (since its the only one dimmable) to a low intensity red, at motion detected (!).

what happens is, with the motion sensor off, as soon as I activate sleep, the red light comes on. As soon as I deactivate the sleep helper, all the lights come on, even without motion in both cases, and the RGBW stays red.

I could somewhat understand the ‘night light’ coming up without motion, but I want it to be with motion, and somehow I got it in the other room. But why does it trigger when the night state comes off?

I’ve noticed this blueprint seems to turn off all the lights at the scheduled end time, even if there is still motion. If lights are on at the end time, I’d prefer to keep them on and rely on manually turning the lights off. Is there any way to configure the blueprint for this behavior? Thanks!

okay, so I figured if I set ‘night_lights_entity_state’ to the motion sensor instead of the sleep helper, and set ‘night_boolean_scenes_scripts’ to the sleep helper, then the day light works okay, and the night light only comes up when motion is detected.

However, the sleep helper is turned ON every time when the automation runs. I dont get why this happens, and cannot really figure out how.

@HopsPopsAl

Hi Alan.

Yes you just create a template binary sensor that looks at other toggle so when it is OFF the helper will be ON. Follow the steps below.

To create a Template binary sensor, follow these steps:

  1. Navigate to Settings > Device & Services > Helpers tab at the top.
  2. Click the Create helper button.
  3. Select Template and then choose Template a binary sensor.

Next, provide a Name and Device class of your choice. If applicable, you can link this template to an existing device so it appears under that device’s details.

In the State template field, add the code below, replacing binary_sensor.your_toggle_helper_here with your entity ID.

{{ is_state('binary_sensor.your_toggle_helper_here', 'off') }}

Once created then add it to the bypass option you like.

Blacky :smiley:

@rbhun

Post 1

  1. Can’t do it you need to have multiple automations.

  2. Once the motion is cleared then your time delay is applied.

  3. The sensor works. In your trace you can see what is applied to the lights. The data is sent as kelvin, some lights can translate it.

Post 2

Looks like it is working.

Motion is ON I can see it in your trace.

Post 3

Not sure why you are doing this and not really sure what you are doing.

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.

Then just explain what you would like to happen.

Blacky :smiley:

@davenaum

Yes this is correct as it is what you are asking the automation to do. Turn light ON and OFF as per the scheduled time. Once the lights turn OFF then you can manually turn them ON again.

You can write a script for the Scenes - Scripts To Turn OFF input that checks if the light was on half a second ago. If it was, the script should turn the light back on. The brief delay (half a second or even a millisecond) is necessary because lights and switches are turned off slightly before scenes and scripts in the automation process.

It makes no sense to me as the lights will always be ON. Maybe you are after the light to be turned ON at X time and then manually turn it OFF always. If so look at my :high_brightness: Smart Light - Entity - Sun Elevation - Ambient & Time Triggers blueprint and just use the ON time. Then you have to manually turn it OFF every night… maybe that is what you are after :thinking:

Blacky :smiley:

Sorry in advance if this has already been asked/answered (I didn’t see it when I searched)… Is there a way I can set separate trigger entities for “on” and “off”? Here’s the scenario I’m thinking:
-Light turns “on” if either of two binary sensor entities (one PIR and another mmwave) turn on. I’ve already created a combined entity.
-Light turns “off” only if the mmwave sensor changes from “on” (occupancy - detected) to “off” (occupancy - clear).

Thanks!

JCG

Hy @Blacky thank yu for your answer.

This is my closet lights

What I want:
1,use it as a motion light with a motion sensor
2, when we are awake (sleep=off), turn on 3 lights (one RGBW led, one ceiling light, and a power plug that has some ikea furniture lights plugged in. Th eRGBW lights come up in a cool blue
(-ideally I’d love some dynamic lighting, but thats later)
3, when I turn sleep=on, nothing happens to the lights themselves
4, when motion is detected while sleep=on, only the RGBW light come up red.

right now, I either have a night light all the time when sleep=on, or I have a motion detected light which is always red.

alias: gardrob konnektor led
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.gardob_mozgas_motion_detection
    light_switch:
      entity_id:
        - switch.gardrob_led_konnektor
        - light.g_v
        - light.gardrob_lampa
    time_delay: 1
    include_dynamic_lighting: disable_dynamic_lighting
    dynamic_lighting_lux_sensor: sensor.gardob_mozgas_illuminance
    dynamic_lighting_min_lux: 30
    dynamic_lighting_max_lux: 200
    dynamic_lighting_min_brightness: 15
    dynamic_lighting_max_brightness: 100
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - entity_state_enabled
    night_boolean_scenes_scripts: input_boolean.halo_i_sleep
    night_lights_entity_state:
      - input_boolean.halo_i_sleep
    include_night_light_control:
      - use_brightness
    night_lights:
      entity_id: light.g_v
    include_light_control:
      - use_brightness
    include_light_colour_control: use_rgb_colour
    light_rgb_colour:
      - 0
      - 97
      - 255
    night_time_delay: 1
    include_night_light_colour_control: use_rgbw_colour
    night_light_rgbw_colour:
      - 255
      - 0
      - 0
      - 0

@jayceegee

Welcome to the community.

Normally you would set up a group helper and add your PIR and your mmwave into the group. This is the link on how to do that click here. This will turn On when ether are ON and turn OFF when both are OFF. It should work well this way.

If you would like to do it your way you would have to set up a trigger template binary sensor. You mmwave as one trigger and it to be any state and your PIR to be another trigger with only ON state. If you would like this and unsure just provide your entity ID for your PIR and your mmwave and I can guide you but you will need to set this up in your config file.

I would recomend your try the group helper first and if you are unhappy with that and you are unsure how to do the trigger template binary sensor just let us know.

Blacky :smiley:

1 Like

@rbhun

I removed the input_boolean.halo_i_sleep from Night Lights - Scenes & Scripts - Toggle Helper. This only if you are using a scene or script in night lights and you also used the same entity for night lights state condition.

night_boolean_scenes_scripts: input_boolean.halo_i_sleep

Try the below YAML and see how you go.

alias: gardrob konnektor led
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.gardob_mozgas_motion_detection
    light_switch:
      entity_id:
        - switch.gardrob_led_konnektor
        - light.g_v
        - light.gardrob_lampa
    time_delay: 1
    include_dynamic_lighting: disable_dynamic_lighting
    dynamic_lighting_lux_sensor: sensor.gardob_mozgas_illuminance
    dynamic_lighting_min_lux: 30
    dynamic_lighting_max_lux: 200
    dynamic_lighting_min_brightness: 15
    dynamic_lighting_max_brightness: 100
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - entity_state_enabled
    night_lights_entity_state:
      - input_boolean.halo_i_sleep
    include_night_light_control:
      - use_brightness
    night_lights:
      entity_id: light.g_v
    include_light_control:
      - use_brightness
    include_light_colour_control: use_rgb_colour
    light_rgb_colour:
      - 0
      - 97
      - 255
    night_time_delay: 1
    include_night_light_colour_control: use_rgbw_colour
    night_light_rgbw_colour:
      - 255
      - 0
      - 0
      - 0

Blacky :smiley:

I have Everything Presence One. The Sensor Occupancy goes from Detected to Clear. It does not use On and Off. Is there best way to make it work with this blueprint?

Thanks for the warm welcome and quick reply, @Blacky!

I didn’t realize that the automation was already configured such that it was an “OR” function for on and an “AND” function for off. That’s great! I’ll give it a try and see how well it performs.

I think the only concern I have is that the PIR sensor I’m using is an Aqara P2 that tries to moonlight as an occupancy sensor, and has a 1-minute cooldown after it detects “presence” (though it’s really just motion). I was hoping for something a bit shorter than that, but I’ll keep things simple to start.

Cheers,

JCG

thank you very much. That did it.
If I may say the description on these two items could be a little longer, I had trouble understanding it.
Thanks
Balazs

1 Like

Dear All,

Thanks for the author for this blueprint, very helpful.

Is it somehow possible to restore light state after the automation turns off the lights?

@skynetAI

Hi Rob, welcome to the community.

Nice one… I don’t have one (It would be nice to have one).

It is a bit tricky to get your head around it at the start but all binary sensors have an ON / OFF state. They may display it as Detected (ON) and Clear (OFF) but it will all work the same.

Below is a image from the HA website that shows you what binary sensors will display in HA when they are ON and OFF. This is the link directly to HA website if you would like more information on binary sensors. You can use these sensors in your trigger. In the Presence One you will have a PIR sensor and a mmwave sensor. The best way to get the most out of this device is to group these 2 sensors and add the group into the trigger. Click Here on how to group sensors.

Hope this is what you are looking for and it helps you.

Blacky :smiley:

@jayceegee

This is all done by HA in the group sensor and they developed it for these types of situations.

Yeah, you will have to adjust the time delay in the BP to suit your needs and your sensor. Example if you have a cool down of 1 min, and your time delay would normally be set on 3 min then you may consider using 2 min in your time delay to cater for your cool down. It is something that only you will know what suits you best. The BP gives you full control.

Blacky :smiley:

@rbhun

That is good news, glad you got it working.

Thanks for your input… I understand there is just so many options and there is a lot to take in. I try not to make it too long but I am always open to feedback and will take it onboard.

Blacky :smiley:

@radokristof

Normally, lights are designed to restore their previous state automatically after being turned off by automation. This behavior is typically managed by the light device itself and doesn’t usually require any additional configuration within the blueprint or automation.

Can you explain what is happening in the blueprint?

Blacky :smiley:

Thanks for the reply. I was trying to troubleshoot why the blueprint was not working. The EP1 has an Occupancy sensor is a combination of the mmWave and PIR sensor. If either the mmWave or PIR sensor detects motion, Occupancy will be “On” or “Detected”. Both the mmWave and PIR sensors must be clear before Occupancy changes to the “Off” or “Clear” state.

Here is what I’m seeing in the trace.

{
  "trace": {
    "last_step": null,
    "run_id": "ee1ea2492d0d84c9130d273f7eec87ae",
    "state": "stopped",
    "script_execution": null,
    "timestamp": {
      "start": "2024-08-27T14:26:02.879568+00:00",
      "finish": "2024-08-27T14:26:02.881328+00:00"
    },
    "domain": "automation",
    "item_id": "1724644793748",
    "error": "UndefinedError: 'dict object' has no attribute 'entity_id'",
    "trigger": null,
    "trace": {},
    "config": {
      "mode": "restart",
      "max_exceeded": "silent",
      "variables": {
        "motion_trigger": [
          "binary_sensor.living_room_ep1_sensor_occupancy"
        ],
        "light_switch": {
          "device_id": "8bb0f514c8fcd150398845b32e31def7"
        },

Good morning, I love your plans. Do you have something I can use for Tapo plugs that would allow me to easily set a timer for XX minutes and then turn off the plug? Thank you very much.