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

@Blacky

Hello,
can you tell me pls, how to you make the
Ambient Light Sensor - Site Conditions

In some cases when your lights turn ON, your ambient light sensor is affected, increasing its LUX value. This can cause the lights to go OFF prematurely. Please select an option that best suits your installation.
THX

OMG I forgot to reply to this to say thank you, this is working perfectly!!! :slight_smile:

thanks for the blueprint

for the bypass option 3 (if I just pick the tv “media player tv”) will the system know that if the tv is on that means bypass?

what if I need a complicated bypass

such as

if the light is on and the shutter opens turn off the light if it is at the morning

for bedrooms: I used sleep sensor from whitings to bypass the automation any cheaper and more invotive options to use?

thanks again

Hi, I have a non-smart light that is connected to an Aqara E1 smart switch. I use this blueprint to trigger the light to come on when motion is detected, however if the light is manually turned off with the switch after use, the lights will turn on and off a few times. Is there a way to prevent this?

@DaAliG

Nice one, glad you got it working :+1:

Blacky :smiley:

@aelsharawi

You can create a binary sensor to handle it.

Consider just using a LUX sensor for this.

If you are looking for a bed sensors @tom_l a moderator of this forum has shared one of his projects. It is very detailed how to make one, cost effective and defiantly worth a read. I also sure if you have any questions Tom will help you with good advice. I use do not disturb on my phone but one day I will tackle this project. Below is a link to Tom’s project.

Hope this helps you.

Blacky :smiley:

@kiwi3007

Yes you can… the only thing is once the automation is cleared finishes it will turn you light back ON if the trigger is triggered. Follow the steps below on how to do it.

  1. Create a scene with your light ON and enter it into ‘Lights - Switches - Scenes - Scripts’.
  2. Create another scene with your light OFF and enter it into ‘Scenes - Scripts To Turn OFF’.
  3. Create a toggle helper and enter it into ‘Scenes & Scripts - Toggle Helper’.
  4. Set up the rest of the automation to your liking.
  5. Click save and your done :tada:

Now you will be able to turn the light OFF once the automation turns it ON as the automation is now looking at the toggle helper.

If that not what you would like then you can use the bypass options.

Blacky :smiley:

Hi @Blacky, I’ve run into an issue with automations that have zigbee PIR sensor as the “Trigger Sensor”. If these sensors become “unavailable” due to zigbee2mqtt crash/reboots/unavailable, the automation is triggered. Is this expected behaviour? One would think that the trigger should only be for when these sensors report as “true” not just “unavailable”?

@B3N3

Yes the trigger to turn ON the light must go from OFF to ON. Have a good look at it and if you are finding that is not the case please let us know.

Blacky :smiley:

Not sure I understood. The PIR sensor changed from “false” to “unavailable” which triggered the automaton. Should it only trigger when it changes from “false” to “true”?

Yes from OFF (Clear) to ON (Detected)

Blacky :smiley:

Thanks for your fast reply, I understand and it seems to be working !
Awesome !

1 Like

Right. Sounds like this is a bug that I found then: when trigger binary sensor becomes unavailable, the automation incorrectly starts.

@variamus

Nice one thanks for letting us know :+1:

Blacky :smiley:

@b3nn

Hi Ben, I have tested it here 3 times. Tests were

clear to unavailable = light stays OFF
unavailable to clear = light stays OFF
unavailable to detected = light stays OFF

Then from unavailable to clear to detected = light comes ON

For there to be a bug in this HA action would be very strange as it would be one of the top actions used by many automation.

It must be something with your zigbee PIR sensor. If the light is coming ON then it must be going from OFF to ON and remember it can be a millisecond.

Blacky :smiley:

Thanks for this. I just did another test and traced it out. It appears the culprit is the “Bypass to turn lights OFF” using a switch zigbee mmwave sensor (Powder is Empty)

config of the switch:

The trace of the automation shows the switch trigger the automation

Is this a bug within the “Bypass - Turn lights OFF”?

@b3nn

Your switch is not complete. What are you trying to do here?

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:

So I have 2 sensors for this room. One PIR to instantly turn on the light upon detection, and an mmWave sensor to detect “No occupancy” to turn off the light using the Bypass option. Everything works exactly as expected until zigbee2mqtt restarts or become unavailable, then the Bypass trigger but then turn On the light instead.

How is my switch not complete? What am I missing in the config?

Here’s the automation yaml.

alias: "motion_detected: powder"
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.pir_powder_occupancy
    light_switch:
      entity_id: light.relay_light_powder_switch_0_2
    include_light_control: []
    include_ambient: ambient_disabled
    include_night_lights: night_lights_disabled
    night_light_brightness: 10
    night_light_transition_on: 0.5
    night_time_delay: 10
    night_lights_conditions: []
    night_lights_after_time: "23:30:00"
    night_lights_before_time: "06:00:00"
    light_transition_on: 0
    ambient_light_value: 40
    light_transition_off: 1
    include_sun: sun_disabled
    sun_elevation: 14
    ambient_light_options: ambient_light_option_enabled
    include_bypass:
      - bypass_enabled_turn_off
    motion_bypass_lights_off:
      - switch.powder_is_empty
    include_bypass_auto_off: []
    time_delay: 30

@b3nn

Okay, you don’t need to use the bypass to turn OFF your light. Once the PIR sensor clears is will start the time delay and turn you light OFF. Please remove this from the bypass.

What you can do is use your PIR and your mmWave sensor as the trigger but you will need to group them. Please follow these steps Click Here. The add just the group into the trigger.

Try that and see how you go… hope this is what you are after.

Here is a link to HA website but a much simpler way is to use a template binary sensor for doing this. I have a lot of examples here.

how to do this is

Go to Settings / Devices & Services / Helpers Tab at the top / Create Helper / Template / Binary Sensor / State template paste this code. But again I would not recommend this as your are making the blueprint fight itself.

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

Let us know how you go

Blacky :smiley:

Thanks for this.

The problem I have is the mmWave sensor is very sensitive, it will detect movement outside of the wall of this room when someone walks past it. Therefore I do not want it as a trigger to turn on the light. The PIR sensor only works in the room so it will give me higher accuracy of detecting if someone entered the room.

I’m aware of the binary group sensor but I don’t think it’ll do what I need: PIR to turn on upon detection and mmWave to turn off upon no occupancy.