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

@andyblac

Regards to the bypass. If you turn one on and it is turn ON then the light turn ON. If you then turn the bypass for turn OFF then the lights turn OFF, if you then turn the bypass for turn ON then the light turn back ON etc, it reacts to the last one you did. If you have 2 ON then all af them have to be OFF for the automation to run again.

Can you explain in a easy step guide on what you are trying to achieve. Then provide your yaml with all the entites in there so I can edit it. Also make 2 helpers for your scenes, put one in Scenes & Scripts - Toggle Helper and one in Night Lights - Scenes & Scripts - Toggle Helper

Blacky :smiley:

ok, I’ll try to explain.

  • Main Kitchen Lights light.kitchen_lights
  • Scene Kitchen Cabinets On scene.kitchen_motion_light_on which includes light.kitchen_cabinets, light.kitchen_floor_led this TURNS ON the lights
  • Scene Kitchen Cabinets Off scene.kitchen_motion_light_off which includes light.kitchen_cabinets, light.kitchen_floor_led this TURNS OFF the lights
  • Motion sensor binary_sensor.kitchen_motion_sensor_occupancy

there are 2 scenarios Before Sun Set and After Sun Set

1: Before Sun Set

  • Turn ON light.kitchen_lights nothing else happens.
  • Turn OFF light.kitchen_lights nothing else happens.

In this Scenario the motion sensor has NO effect at all.

2A After Sun Set
NO LIGHTS ON, NO MOTION IN ROOM

  • TURN ON light.kitchen_lights and I want the scene scene.kitchen_motion_light_on to ACTIVATE (so it TURNS ON light.kitchen_cabinets, light.kitchen_floor_led). and have the motion sensor IGNORED while light.kitchen_lights are ON, so ALL lights stay ON.

  • TURN OFF light.kitchen_lights and I want the scene scene.kitchen_motion_light_off to ACTIVATE (so it TURNS OFF light.kitchen_cabinets, light.kitchen_floor_led).

2B After Sun Set
NO LIGHTS ON, NEW MOTION DETECTED IN ROOM

  • I want the scene scene.kitchen_motion_light_on to activate (so it TURNS ON light.kitchen_cabinets, light.kitchen_floor_led). and have a 1.5 minute timeout, so if after 1.5 mins of NO MOTION I want the scene scene.kitchen_motion_light_off to ACTIVATE, so it TURNS OFF light.kitchen_cabinets, light.kitchen_floor_led

2C After Sun Set
MOTION ALREADY DETECTED IN ROOM (scene.kitchen_motion_light_on ALREADY ACTIVATED)

  • TURN ON light.kitchen_lights, I want the motion timeout IGNORED, so ALL lights stay ON.

  • TURN OFF light.kitchen_lights I want the scene scene.kitchen_motion_light_off to ACTIVATE, so it TURNS OFF light.kitchen_cabinets, light.kitchen_floor_led

alias: Kitchen Motion Light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.kitchen_motion_sensor_occupancy
    include_sun: sun_enabled
    time_delay: 1.5
    end_scenes:
      - scene.kitchen_motion_light_off
    include_night_lights: night_lights_disabled
    light_switch:
      entity_id: scene.kitchen_motion_light_on
    sun_elevation: 0
    light_transition_on: 0.5
    motion_bypass_lights_off: []
    motion_bypass_lights_on:
      - light.kitchen_lights
    include_bypass:
      - bypass_enabled_stop
    motion_bypass_lights_stop:
      - light.kitchen_lights

this allows 1: Before Sun Set, 2B After Sun Set and 2C After Sun Set seem to be working fine, it is just 2A After Sun Set that does not work.

IF I use:

    include_bypass:
      - bypass_enabled_turn_on

then 2A After Sun Set, 2B After Sun Set and 2C After Sun Set works, but 1 Before Sun Set does not work correctly as it ACTIVATES scene.kitchen_motion_light_on BEFORE SUN SET. and it does not allow you to use

    include_bypass:
      - bypass_enabled_turn_on
      - bypass_enabled_stop

as only the first option is activated upon

Hi guys, I have a door and a motion sensor on my kitchen. The door is usually open, so the off trigger will count at the moment the sensor is closed?

Hello Community. And big thanks for this amazing BluePrint!
I have already dived into this project a little and implemented basic light control in one room. It is a pity that I had to redefine the standard behavior to make it match my color_temp with “mired” units. Because current slider support only kelvin. Anyway is okay.

I have two scenarios that cannot be implemented using this project:

  1. If the light is turned on via the input relay via mqtt(send single press or other events), which sent a signal to turn on the lamp, then the algorithm for turning off the light after delay without moving does not work, because there is no initial trigger. Now it is only a motion sensor.
  2. If the light is switched via any smart home interface(HA dashboard like example), then the algorithm for turning off also does not work.

The only thing that comes to mind without major changes to the project is implementation via a bypass. But with the addition of a separate timer only for turning on:

  1. Enable the Bypass - Turn lights ON
  2. Bypass Switch - Turn lights ON. Add light on state value.
  3. Bypass Auto OFF - Time Delay. Here I need add one more trigger only for “Enable the Bypass - Turn lights ON” case. Because common timer is needed for OFF light with big delay

Any other ideas or suggestion?

I have a similar scenario to you, where some lights are ordinarily controlled via a motion sensor however on occasion there is a manual switch that can be used to turn on the lights. The way I did it was to use blackys Manual Off blueprint along with this one.

1 Like

@andyblac

Please understand this is hard to do and get my head around it… but I think this is what you are after.

Setup:

  • Main Kitchen Lights: light.kitchen_lights
  • Scene to Turn On Cabinet and Floor Lights: scene.kitchen_motion_light_on
    • Includes: light.kitchen_cabinets and light.kitchen_floor_led
  • Scene to Turn Off Cabinet and Floor Lights: scene.kitchen_motion_light_off
    • Includes: light.kitchen_cabinets and light.kitchen_floor_led
  • Motion Sensor: binary_sensor.kitchen_motion_sensor_occupancy

Scenarios:

  1. Before Sunset:
  • Turning ON light.kitchen_lights: No other actions.
  • Turning OFF light.kitchen_lights: No other actions.
  • Motion sensor is disabled.
  1. After Sunset:
  • 2A: No Lights On, No Motion Detected:

    • Turning ON light.kitchen_lights: Activate scene.kitchen_motion_light_on (turns on light.kitchen_cabinets and light.kitchen_floor_led).
    • Turning OFF light.kitchen_lights: Activate scene.kitchen_motion_light_off (turns off light.kitchen_cabinets and light.kitchen_floor_led).
    • Motion sensor is disabled while light.kitchen_lights are ON.
  • 2B: No Lights On, Motion Detected: (This is normal Lights)

    • Motion detected: Activate scene.kitchen_motion_light_on (turns on light.kitchen_cabinets and light.kitchen_floor_led).
    • If no motion for 1.5 minutes: Activate scene.kitchen_motion_light_off (turns off light.kitchen_cabinets and light.kitchen_floor_led).
  • 2C: Motion Already Detected (scene.kitchen_motion_light_on already active):

    • Turning ON light.kitchen_lights: Motion timeout is disabled, all lights stay ON.
    • Turning OFF light.kitchen_lights: Activate scene.kitchen_motion_light_off (turns off light.kitchen_cabinets and light.kitchen_floor_led).

Option 1:

This is your YAML but NOTE you don’t have a toggle helper enter it into Scenes & Scripts - Toggle Helper

alias: Kitchen Motion Light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.kitchen_motion_sensor_occupancy
    include_sun: sun_enabled
    time_delay: 1.5
    end_scenes:
      - scene.kitchen_motion_light_off
    light_switch:
      entity_id: scene.kitchen_motion_light_on
    sun_elevation: 0
    light_transition_on: 0.5
    motion_bypass_lights_on:
      - light.kitchen_lights
    include_bypass:
      - bypass_enabled_turn_on

Option 2:

Or try it using just the entities only, no senes (see YAML code below). You will have to set up light control for your light.kitchen_cabinets and light.kitchen_floor_led lights. If this works and you still would like to use the scenes then in the autoamtion YAML above you will need to create a toggle helper and enter it into Scenes & Scripts - Toggle Helper

alias: Kitchen Motion Light
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.kitchen_motion_sensor_occupancy
    include_sun: sun_enabled
    time_delay: 1.5
    light_switch:
      entity_id:
        - light.kitchen_cabinets
        - light.kitchen_floor_led
    sun_elevation: 0
    light_transition_on: 0.5
    motion_bypass_lights_on:
      - light.kitchen_lights
    include_bypass:
      - bypass_enabled_turn_on

The problem I see if you turn ON light.kitchen_lights before sunset. You may have to do a script for this automation.

One More Option - Option 3

The other thing that I can also think of is I have another blueprint in beta that will turn your light.kitchen_lights into a toggle helper and you can enter it into Night Lights - Entity State then enter in your light.kitchen_lights, light.kitchen_cabinets and light.kitchen_floor_led lights into Night Lights. If the above not working I can set you up to try the beta blueprint. This may work a lot better I think but I have not tested this theory as it is just in my head so I could be wrong.

Hope this works for you :crossed_fingers:

Blacky :smiley:

thanks for taking the time to look at this, I’ll just stick with using

    include_bypass:
      - bypass_enabled_stop

and use a secondary automation to sync cabinet / floor led’s with main kitchen lights, it just a shame that

    include_bypass:
      - bypass_enabled_turn_on

can not be set too adhere to sun settings swell, that way the motion scene could be only be controlled after sunset for both motion and bypass on, which I thought would be what it should be doing if sunset option is used. I do not understand why you would want bypass controlled when the motion trigger is not being used at that time.

ie you say this:

  • By-pass Switch - Turn lights ON.
    Select the switches that will turn your lights ON, bypass the trigger sensor, and allow your lights to function as normal. Please note that the entity cannot be included in the ‘Lights - Switches - Scenes - Scripts’ or ‘Night Lights’ selections.

and my trigger is

    motion_trigger:
      - binary_sensor.kitchen_motion_sensor_occupancy
    include_sun: sun_enabled
    time_delay: 1.5

so why do you not let the bypass on trigger

    include_bypass:
      - bypass_enabled_turn_on
    motion_bypass_lights_on:
      - light.kitchen_lights

adhere to sun aswell, as the motion trigger is NOT active until AFTER sunset.

A bypass will bypass all the settings and do what is asked to do.

Blacky :smiley:

I had been having trouble with my automation after upgrading from V2 top V7. I do not use bypass, but after much debugging, I found that the bypass list was populated with bypass_disabled. It looked like this:

I removed it and made the list empty by editing the yaml:

include_bypass: []

This solved the issue. This may be too much of an edge case to matter, and I guess I could have remade the automation easily enough, since its a blueprint, but thought it would be good to let you know. It could probably be solved with an additional check in the bypass enabled check.

This is the trace where I found it. I can share the whole trace if it is helpful


@Blacky - are there any current problems known?
I have the most simplest of setups for testing purposes but it doesn’t work. I tested it with a manual automation and it works fine. Light works, sensor gets occupied.

The YAML looks as follows:

alias: Test
description: ""
action: []
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.motion_sensor_hall_occupancy
    light_switch:
      entity_id:
        - light.hall_ceiling
    time_delay: 2
    include_light_control: []
    light_brightness: 1

I’m not fully understanding the capabilities of this blueprint :frowning: Can somebody please let me know if it would be possible to use this using a grouped “outdoor lights” and grouped “average outside lux” sensors as well as a outdoor motion sensor to do the following:

  1. Lux Value 100 and below: Turn On the Lights in ‘Night Mode’ dimmed
  2. Motion is detected turn them to full brightness and go back to dimmed after no motion
  3. Lux Value 100 and above: Turn off the lights completely.

Ideally the Lux value should be after its been above/below for 15 minutes, But I can live without that.

Or is this (turn on dimmed at ‘dusk’, full brightness on motion and off at dawn) out of the scope for this blueprint and I should just write my own basic boring automation for it.

@alexbbt

Going from V2 to V7 there are many thing you had to do along the way. You can see them in the FAQ down the bottom. Best to just create a new automation fresh. Disable your existing one. Then create a new one. You can reference the old one as you to it. Then once your happy just delete the old automation.

Let us know how you go.

Blacky :smiley:

@Magix3D

Something happen to your YAML and looks like you moved things. Below is a clean YAML for you. Copy and replace your YAML.

alias: Test
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.motion_sensor_hall_occupancy
    light_switch:
      entity_id:
        - light.hall_ceiling
    time_delay: 2

Blacky :smiley:

1 Like

@Shad0wWulf

Your in luck I just updated another blueprint. Looks like you are doing outdoor lights. The blueprint below can work with lux but you may want to consider sun elevation as then it will only turn ON at night. Have a look at the trigger FAQ in the below blueprint for a stairwell as it is the same for what you are doing. If you need a delay then sometimes your motion sensor has a setting for it or you can create a template sensor that has a delay OFF for you motion sensor and then use that template sensor in your night lights state trigger rather than your motion sensor.

If you need help for the template sensor then just let us know but if you using the other blueprint post the question there.

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

Blacky :smiley:

@Blacky - thanks for the quick reply.

Then I think there is something wrong, either with the Blueprint or with my HA :smiley:

Your manual code works, but I tested again:

  • create automation with template
  • add motion sensor
  • add light entity

This is the YAML (unedited) it creates and it doesn’t work:

alias: Test
description: ""
action: []
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.motion_sensor_hall_occupancy
    light_switch:
      entity_id: light.hall_ceiling

@Magix3D

The blueprint is all good. I just created a basic one like yours and it worked perfectly.

For some reason you are getting this code added to your YAML.

action: []

It shold not be there. Try remove the blueprint (uninstall it, 3 dots next to the blueprint on left, then delete blueprint), restart your HA then reinstall the blueprint again and see if that cleans it up. Your code should look like this.

alias: Test
description: ""
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input:
    motion_trigger:
      - binary_sensor.motion_sensor_hall_occupancy
    light_switch:
      entity_id: light.hall_ceiling

with no

action: []

Blacky :smiley:

@Blacky - very strange. Did all that and now for testing purposes I just clicked on “Create new automation” and the line you mention already exists before changing anything.

description: ""
alias: Sensor Light
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input: {}
action: []

@Magix3D

Very strange, what version of HA are you on… maybe update if your not on the latest version. This is what you should have when it first opens the blueprint.

description: ""
alias: Sensor Light
use_blueprint:
  path: Blackshome/sensor-light.yaml
  input: {}

Blacky :smiley:

@Blacky - these are my versions, I got no updates open en.

  • Core: 2024.8.0b0
  • Supervisor: 2024.07.0
  • Operating System: 12.4
  • Frontend: 20240731.0

@Magix3D

That makes sense now. You are on the Beta version of Home Assistant. I would like to keep the 2024.8 update details for HA to announce but this is directly related to the beta and what they are doing. Please let Home Assistant know as they will bee keen to hear from you and my guess they will resolve this ASAP before the stable version comes out but you will need to let them know.

For now you know what is wrong so you can fix it and HA will resolve this for you. Please note it is not the blueprint but the beta of HA you are running.

Blacky :smiley: