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

Hey @Blacky

thanks for the blueprint, it is quite detailed.

i am just starting to configure my lights to use motion but i am noticing some weirdness that i cant quite put my finger on what is the true cause, i figured id ask incase you know if its happend before basically this is happening to various lights switches in the house i am using mostly TS110E 1 channel/2channel dimmers.

basically my issue is i find that sometimes when the blueprint tells the light to turn on, z2m (rather HA) marks the input as "ON" but no lights actually come on. if i use the physical switch it comes on and does not change the device switch state (even though everything thinks its on, the physical switch will then change the state as expected for following state changes when this happens), if i change the brightness in z2m or home assistant it comes on, if i turn it off and then on it will come on in z2m or home assistant.

its weird if i "Reset" the state via the above then the motion works for a while until eventually getting back in this state of being "On" without being on

below is the blueprint config of one

alias: office motion light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.office_motion_occupancy
    light_switch:
      entity_id: light.office_and_stove_lights_l1_2
    night_lights:
      entity_id:
        - light.office_and_stove_lights_l1_2
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - time_enabled
    night_lights_after_time: "22:00:00"
    night_lights_before_time: "06:00:00"
    include_night_light_control:
      - if_lights_are_on_adjust_when_crossing_over
      - use_brightness
    include_light_control:
      - use_brightness

have you ever seen this?

thanks!

@phyzical

No but it looks like a communication problem or a bug within you lights.

Are you using a group? I only say this because I see "Office & Stove Lights" as your selected entity input. If your using a group then try and select the entities instead of the group to see if that helps/works.

All your settings look good and the blueprint wont be causing this.

Blacky :grinning_face:

i am 100% using the entity for the specific input on the switch

what i have actually found is if i turn off "use brightness" it works as expected.

i had a quick look and your blueprint is just using turn_on with brightness_pct as data so nothing fancy..

i also found that if i change the brightness to say 253 where the 100% is 255 it works maybe 3 times before this happens again.

so im wondering if its something todo with "turn on" + an already set value for brightness?

Edit: okay so i replicated with another blueprint.. so yeah time to workout what these devices quirks are

edit 2: looks like these simply do not like when the brightness is set to the same value

Are there any best practices for using a combination of a PIR and mmWave for the trigger?

Ideally I would like the PIR to be the trigger but then mmWave to maintain. I’ve found when using the mmWave as the trigger there are too many false positives but when the PIR is used then it’s not as effective at maintaining.

as a quick update incase its ever raised again, im working around the issue with the switches by using the dimming feature of the blueprint, this means that aslong as its turned off via the timeout then the brightness is never the same.

sadly if its turned off at the switch it acts as an override if you will as the brightness will be the same meaning it wont auto turn on :laughing:

i will need to play with lux adjustments as i think this is cause more brightness variance reducing the liklyhood of this happening even further

@phyzical

Looks like your finding out things about your hardware. Hope you find the problem.

Blacky :grinning_face:

@AndyMUK

You can do this but it gets into really advance trigger template binary sensors. You need to know how to create a trigger template binary sensor and in the FAQ you will find more information on this.

PIR Trigger + mmWave Maintain Occupancy Sensor

This trigger-based template binary sensor combines a PIR motion sensor and an mmWave presence sensor to create a more reliable occupancy sensor.

How it works

  • PIR motion sensor > Triggers occupancy ON.
  • mmWave presence sensor > Maintains occupancy while presence is detected.
  • mmWave alone cannot trigger occupancy ON, helping to reduce false positives.
  • Occupancy turns OFF only when:
    • The PIR sensor is OFF, and
    • The mmWave sensor is OFF

You need to update the binary_sensor.pir_sensor with your PIR sensor entity ID and the binary_sensor.mmwave_sensor with your mmWave sensor entity ID. The Advance Room Occupancy Sensor change to what you would like to call this binary sensor.

template:
  - triggers:
      # PIR turns occupancy ON
      - trigger: state
        entity_id: binary_sensor.pir_sensor
        to: "on"
        id: pir_on
      # PIR turns occupancy OFF
      - trigger: state
        entity_id: binary_sensor.pir_sensor
        to: "off"
        id: pir_off
      # mmWave turns occupancy OFF
      - trigger: state
        entity_id: binary_sensor.mmwave_sensor
        to: "off"
        id: mmwave_off

    binary_sensor:
      - name: Advance Room Occupancy Sensor
        state: >
          {% if trigger.id == 'pir_on' %}
            true
          {% elif trigger.id in ['pir_off', 'mmwave_off']
                  and is_state('binary_sensor.pir_sensor', 'off')
                  and is_state('binary_sensor.mmwave_sensor', 'off') %}
            false
          {% else %}
            true
          {% endif %}

Once you create this trigger template binary sensor you would use it in the trigger input only.

Hope this helps you.

Let us know how you go and if it all works then I will add it to the FAQ sensors.

Blacky :grinning_face:

1 Like

still debugging with the z2m gang, getting close.

one thing i have just noticed i think is a bug with the blueprint

when i use the (night lights or just day lights) + dimming it increases the brightness by the brightness value every trigger o.0

i.e i see it increase by ~15% every trigger i.e 48/255 to 54/255

if use night_light_include_dim_before_off: dim_before_off_disabled then i dont see it increase

i.e

alias: office motion light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.office_motion_occupancy
    light_switch:
      entity_id: light.office_and_stove_lights_l1
    night_lights:
      entity_id:
        - light.office_and_stove_lights_l1
    include_night_lights: night_lights_enabled
    night_lights_conditions:
      - time_enabled
    night_lights_after_time: "22:00:00"
    night_lights_before_time: "06:00:00"
    include_night_light_control:
      - use_brightness
      - if_lights_are_on_adjust_when_crossing_over
    include_light_control:
      - use_brightness
    dim_before_off_time_delay: 10
    dim_before_off_pct: 75
    include_dim_before_off: dim_before_off_enabled
    night_light_brightness: 15
    night_light_include_dim_before_off: dim_before_off_enabled
    night_light_dim_before_off_time_delay: 5
    night_time_delay: 3
    time_delay: 5
    night_light_dim_before_off_pct: 10

Incredible, thanks so much for this. Exactly what I was hoping for.

@phyzical

No, it doesn't do this but you have some settings that are not correct. Thanks for your YAML as it helps me help you.

In both Dim Before OFF (normal lights and night lights) your missing the Dim Before OFF - Toggle Helper you need 2 toggle helpers and they can only be used in the one input. Add them in and you see it works.

Blacky :grinning_face:

@AndyMUK

Your welcome.

Blacky :grinning_face:

thanks @Blacky adding the helper looks to have stopped that (durr)

i know conditional required fields are not supported yet, but maybe some red text, something to force me(or other haha) to notice it is required

i kind of took it as optional and just skipped over it

@phyzical

@phyzical

Your welcome, glad you got it all working now.

I'm limited to what Home Assistant provides. There is currently no way to make inputs become required based on a selected option. Even if I mark an input as required, the entire section won't collapse. It's not how I would design it, but this is the way Home Assistant handles it.

Blacky :grinning_face:

Hello @Blacky,

Thanks a lot for your very usefull blueprint!!

I have some lights controlled by a motion detector and it works great.
But when we have some guest, I would like to use the bypass functionnality but I don't find my desired switch.

I have installed a physical switch (Aqara wireless H1) connected using z2mqtt and all I find when I search this device is :

I don't find the actions when I press a button on the switch like I can select them on a standard automation.

I'm not sure if I understood how the bypass works.

Thanks for your help

@Charles26

Hi Charles, thanks for your kind words... your welcome.

You should be able to see all your HA entities... as there are no restriction (filters) on your selection. Have a look at what your switch is called and then search for this as currently your searching for cuisine interrupteur and it may be filtered out.

The bypass entity must be a switch with an ON and OFF state. The automation checks these states to determine whether the bypass is active. A button cannot be used because buttons do not maintain an ON or OFF state; they only generate an event, so the automation cannot determine whether the bypass should remain enabled or disabled.

All bypass options disable the automation when the bypass is turned ON. You can choose what happens to the light when the bypass is enabled by selecting option 1, 2, or 3.

Hope this helps you.

Blacky :grinning_face:

1 Like

(@Blacky one small note: the URL deeplink in the top post for v8.6 has a typo; it should be πŸ’‘ Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights - #4318 by Blacky but the number at the end is transposed (is 4381, should be 4318)

p.s. thanks for the great blueprint!)

@cbowns

Thanks for the heads up... nice find. This has been fixed now.

Blacky :grinning_face:

Ok thanks so that's why I do not see it.
So I guess I need to create a new toggle and another automation to switcj the new toggle when I press on my switch.

In my case I want to be able to turn the light ON (or keep it ON if it was already the case) until I press on another switch to disable the bypass (so another toggle I suppose).
But I not sure if I can do that, it seems it only a delay can disable the bypass.
Do you confirm ?

EDIT : I'm dumb :sweat_smile:
After testing, I just need the first toggle and when I switch OFF, it automaticaly disable the bypass....
Thanks :slight_smile:

1 Like

Hi, so I am using this for my garage.

I have two zigbee smart relays, named Garage 1 and 2, in a light group named Garage Lights.

I have a zigbee tilt sensor on the garage door, when it's off, the main door is closed. I do not yet have a sensor on the "people" door. (My garage is a fully separate building from my house)

I have several occupancy sensors inside the garage, both motion and mmwave radar detectors.

I have those detectors all grouped into a binary group named Occupancy, and when it is on, it has detected some form of occupancy.

Now. I have the group for the lights set as the Light to be affected, the sensor is the occupancy group, with a 3 minute delay there, and I have the bypass set for the garage door, with a 30 minute delay, as I want the lights on if the garage is open, but if it stays open for more than 30 minutes without occupancy detected then turn off.

Now, I just looked, and one of my garage lights is on, the other is off, it's been on for 29 minutes and the garage door is closed.

What gives here?

Edit to add: I had it working better, but without the 30 minute delay (just left it on no matter how long the door was open) when I had it set up using several different automations, but switched to this blueprint to add that final bit and to consolidate some automations.

It did finally turn off after 30 minutes, but 30 minutes after the door was -closed-

Might be just a miss with the light command. I have one light, Tuya interface I think, that will occasionally miss a command. I just added two commands to turn the light on in the automation, and two to turn it off. With a small delay between each. Not an elegant solution but it works.

1 Like