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

@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.

@b3nn

The template binary sensor will what you are askingā€¦ but what happens is when it detects movement outside of the wall of this room when someone walks past it, it will turn the bypass OFF. When this happens the automation checks to see if the PIR is ON and if so the light turns ON and you see the bypass as the trigger as shown above. That is what you will see. So you could just use the PIR and not the bypass. Also note unavailable is not OFF so this will tun OFF the bypass.

Maybe consider relocating it so when movement outside of the wall of this room when someone walks past it doesnā€™t effect it.

Blacky :smiley:

Thanks for your help so far. I appreciate it. I know my use case is probably not for everyone.

What still bothers me is that it works 100% as I expect it to when the sensors are reporting true/false; until zigbee2mqtt dies, then an unoccupied room with both PIR and mmWave sensors showing unavailable turns on the light.

@b3nn

Try the template sensor I suggested. But remember unavailable is not OFF.

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

or 

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

or

{{ is_state('binary_sensor.oc_powder_presence', ['off', 'unavailable']) }}

What do I use this for? Bypass or Trigger?

My understanding what you are trying to do is use the PIR as the trigger but then use the mmWave as the bypass. So when the mmWave is off then the bypass will be ON. If this is the case then use your PIR as the trigger and the mmWave template sensor as the bypass.

Makes no sense to me as you could just use the mmWave as the trigger but maybe I canā€™t see what you see.

I included ā€˜unavailableā€™ in the examples so when it is ā€˜unavailableā€™ the bypass will still be ON but again I would not do it like this but it your system. I would relocate the sensor and then group them, but again I cant see what you see and your limitations so I am just giving examples for you to use or not. Example, you could be in there and then they go ā€˜unavailableā€™ and your light turns OFF, not good. Really what I would also do is bin it and use another one that doesnā€™t go ā€˜unavailableā€™.

Blacky :smiley:

1 Like

Ah yes! Including the ā€˜unavailableā€™ as part of the check does work. Light will not come on, however it will turn OFF if it was currently on. I can live with this for now. Thanks again for not giving up on me :rofl:!

There might be a more elegant way of doing what I want, perhaps 2 automations per room (1 to turn on and 1 to turn off).

BTW, these mmWave sensors are on the ceiling of each room. Trust me Iā€™ve tried to adjust the sensitivity, distance and all other parameters but did not find a working combination.

Nice one, glad you got it working.

Yea this is why it is hard for me to see it and I just gave options to do what you would like to do. I will have to keep that in mind for ceiling mounted sensors, thanks for the info.

Enjoy

Blacky :smiley:

@b3nn

Just another thoughtā€¦ you could make the ā€˜unavailableā€™ + light OFF to = ON like this, then the light wont go OFF if it is ON :wink:

{% if is_state('binary_sensor.oc_powder_presence', 'off') %}
  on
{% elif is_state('binary_sensor.oc_powder_presence', 'unavailable') and
  (is_state('light.Your_light_or_switch_here', 'off')) %}
  on
{% else %}
  off
{% endif %}

Blacky :grinning:

Hi @Blacky - first of all congrats on an excellent blueprint - I now use it with all of the new Ikea motion sensors. I have a question about the Time Options - End Time setting though: around release 5.0/5.1 it looks like the logic was updated so that if an End Time is specified, then as soon as that time arrives, the lights will turn off.

Given that this blueprint is primarily for automating lights based on motion sensors, I had assumed that the End Time meant ā€œafter this time stop automatically controlling lights based on the (motion) trigger sensorsā€. i.e. I had expected the End Time to serve more as a condition rather than a trigger.

Imagine a scenario such as a bedroom - I want the lights to be motion-controlled throughout the day, but after a certain time at night, I want the motion-control disabled (obviously donā€™t want small movements turning the lights on in the middle of the night), and will manually turn the lights off. In this scenario, is the Time Options - End Time the wrong setting to use for this?

What happens now is that the lights will abruptly turn off at a set time each night. Thanks.

@Valdorama

Thanks for you kind words and reaching out.

The time options are for when we would like the automation to run. So when the time ends then that is what we are asking the automation to do and it will turn the light OFF. It will also use the start time so if motion (trigger) is ON, light is OFF and the start time crosses over then the light will come ON.

Time, sun, ambient and device tracker are all conditions but (big but) in order to make these conditions work they also have triggers attached to them. It is pretty full on this automation with just so many options with so many different scenarios.

What you could do here is rather than use time you can use the bypass as we normally change when we go to bed and not really a fixed time. You can choose what suits you best and some examples could be.

  1. A night light you turn ON
  2. Do not disturb on your phone (This is what I use)
  3. A switch near the bed
  4. Bed pressure mat (a lot of people like this)
  5. etc

You can also use nigh lights that tun on different lights. You could have a main motion sensor for the normal lights and use a different motion sensor for night lights but you would use a script for this. Have the motion sensor low under bed or where it canā€™t detect you in the bed but when you get up it detects your legs / feet and turns ON some glow lights. The script would be a if-then action.

Rather than give you heaps of ways to do it maybe you can share what you would like to do / happen and I can help you more. It may even give me some ideas for new features and as always I willing to help where I can.

Blacky :smiley:

Amazing Blueprint, did you consider a ā€œliteā€ version maybe that has (for example) just ambient and motion senors?

Iā€™m a bit overwhelmed with the Options for setting it up properly, even after reading all FAQs and Guides :disappointed_relieved:
We have a FP2 mmWave Sensor that we use in the Bedroom/Office and would like the lights to slowly fade in when it gets darker in the room and a person is present in the room.

  • I created a Helper that groups all ā€œzonesā€ from the mmWave Sensor
  • added the Ambient Light Sensor from the same FP2
  • activated Sun Elevation

But I seemingly canā€™t dial in the numbers correct for the Lux values I think? Not sure, the lights kind of just turned on full blast.

Yeah I thought about combining the light status as well but it would get messy in rooms with multiple lights. Iā€™ll have a rethink about how I might approach this but for now this will do :slight_smile:

1 Like

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

It is a bit complicated and this post is not a how to make the blueprint just support for the blueprint.

Thanks for your understanding.

Blacky :smiley:

1 Like

@saeris

Thanks for your kind wordsā€¦ it started of as a lite version and it just kept growing. I been looking at it for a long time so I can understand it can be overwhelming.

Nice

So for this you would use Dynamic Lighting and select ā€˜Lux Controlled Brightness - Invertedā€™. Bear in mind you are using Sun elevation and unless you are setting it with a hire value it could be dark already. Your Ambient Light Sensor will go into Dynamic Lighting.

Have a look at the link in this setting.

If you are still having problems or if I didnā€™t get it right what you are doing then just let us know. You can also 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:

Hi old chap,

Iā€™ll give it a goā€¦

Iā€™m sure itā€™ll work the Sun 1.5 turned on my test light.

Magic thanks for the blueprint and helpā€¦

Robert Cooperā€¦

1 Like