đź’ˇ Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

GitHub Link Click Here

Version: 2.6

The most common automation used for a sensor light. The good thing is, with this automation you can turn ON as many lights as you like by selecting an Area, a Device, an Entity or just any combination you like using just one sensor to do it. BE CAREFUL when selecting an Area or a Device as it will turn On and OFF everything attached, lights, switches, etc.

The Automation Process:

  • In this example we will use a Motion sensor as the trigger but you can use one or multiple Binary Sensors as the trigger/s.
  • Triggers on a motion sensor and turns the lights ON.
  • When no motion is detected, a time delay is activated and turns the lights OFF Automatically.
  • The lights will stay ON if the motion sensor detects motion before the time delay turns the lights OFF. It will then reset the time delay after last motion is detected.
  • You have the option to select scenes. This allows you to turn ON a scene when motion is detected and turn OFF a scene when the time delay has ended.
  • You have the option to use the “Light Control”. This allows you to set a brightness level for your lights.
  • You have the option to use the “Trigger Sensor By-pass”. This allows you to add a switch to manually By-pass the trigger sensor so you can use the lights as normal by turning them ON and OFF manually.
  • You have the option to use the “Sun Elevation”. This is used for adding a condition to only work when it is dark by setting the suns position to the horizon.
  • You have the option to set an Ambient Light Sensor and set the LUX value. This is used for adding a condition to only work when it is dark or below the Ambient Light LUX Value.
  • You have the option to set a start time, an end time and select weekdays. This will only allow the automation to run between the time periods.
  • You have the option to use the “Zone - Device Tracker”. This can be useful if you have pets triggering the trigger sensor turning your lights ON and OFF when no one is home.
  • You have the option to use “Night Lights”. It is normally used for having lower softer lights come ON when going to the bathroom at night.

Note: If you turn the light on manually and the motion sensor detects motion the light will turn off automatically. It is recommended to use the “Trigger Sensor By-pass” option if you would like to keep the lights ON or OFF for extended time periods.

Need help? See our FAQ: Click Here

blueprint:
  name: Sensor Light
  description: >
    # Sensor Light
    
    **Version: 2.6**
    
    
    The most common automation used for a sensor light. The good thing is, with this automation you can turn ON as many lights as you like by selecting an Area, a Device, an Entity or just any combination you like using just one sensor to do it. BE CAREFUL when selecting an Area or a Device as it will turn On and OFF everything attached, lights, switches, etc.
    
    
    Let us know what you think of this blueprint and for community support including updates: [Click Here](https://community.home-assistant.io/t/sensor-light/481048)
    
    
    **The Automation Process:**
     - In this example we will use a Motion sensor as the trigger but you can use one or multiple [Binary Sensors](https://www.home-assistant.io/integrations/binary_sensor/) as the trigger/s.
     - Triggers on a motion sensor and turns the lights ON. 
     - When no motion is detected, a time delay is activated and turns the lights OFF Automatically.
     - The lights will stay ON if the motion sensor detects motion before the time delay turns the lights OFF. It will then reset the time delay after last motion is detected.
     - You have the option to select scenes. This allows you to turn ON a scene when motion is detected and turn OFF a scene when the time delay has ended.
     - You have the option to use the "Light Control". This allows you to set a brightness level for your lights.
     - You have the option to use the "Trigger Sensor By-pass". This allows you to add a switch to manually By-pass the trigger sensor so you can use the lights as normal by turning them ON and OFF manually.
     - You have the option to use the "Sun Elevation". This is used for adding a condition to only work when it is dark by setting the suns position to the horizon.
     - You have the option to set an Ambient Light Sensor and set the LUX value. This is used for adding a condition to only work when it is dark or below the Ambient Light LUX Value.
     - You have the option to set a start time, an end time and select weekdays. This will only allow the automation to run between the time periods.
     - You have the option to use the "Zone - Device Tracker". This can be useful if you have pets triggering the trigger sensor turning your lights ON and OFF when no one is home.
     - You have the option to use "Night Lights". It is normally used for having lower softer lights come ON when going to the bathroom at night.
     
     Note: If you turn the light on manually and the motion sensor detects motion the light will turn off automatically. It is recommended to use the "Trigger Sensor By-pass" option if you would like to keep the lights ON or OFF for extended time periods.
     
     Required = *
     
     **Need help?** See our FAQ: [Click Here](https://community.home-assistant.io/t/sensor-light-motion-sensor-sun-elevation-lux-value-scenes-time/481048/6)
  domain: automation
  input:
    motion_trigger:
      name: Trigger Sensor - Binary Sensors *
      description: The Sensor/s that turns the lights ON and OFF. The trigger can be any 
        [Binary Sensors](https://www.home-assistant.io/integrations/binary_sensor/) you like.
      selector:
        entity:
          domain: binary_sensor
          multiple: true
    light_switch:
      name: Lights - Switches - Scenes *
      description: The lights that get turned on by the trigger sensor/s. You can also add switches and scenes.
        If adding a scene please read "Scenes To Turn OFF" below.
      selector:
        target:
          entity:
            domain: 
              - light
              - switch
              - scene
    end_scenes:
      name: Scenes To Turn OFF
      description: If you have selected a scene to be turned ON above in "Lights - Switches - Scenes" or below in "Night Lights" and you would like it to be turned OFF after the time delay,
        you must create another identical scene with everything OFF and select it here.
      default: []
      selector:
        entity:
          multiple: true
          domain: 
            - scene
    time_delay:
      name: Time Delay
      description: The delay time to leave the lights on after the last trigger from ON to OFF state is detected.
      default: 5
      selector:
        number:
          min: 0
          max: 30
          step: 0.5
          unit_of_measurement: minutes
    include_light_control:
      name: Light Control
      description: Select the options you would like to use. It will only control a "light" entity that has a brightness setting.
      default: dont_use_brightness
      selector:
        select:
          options:
            - label: Use brightness
              value: "use_brightness"
            - label: Dont use brightness
              value: "dont_use_brightness"
    light_brightness:
      name: Brightness
      description: Brightness of the lights when they are turned ON.
      default: 100
      selector:
        number:
          min: 1
          max: 100
          mode: slider
          step: 1
          unit_of_measurement: '%'
    include_bypass:
      name: Use The Trigger Sensor By-pass Option (Optional)
      description: Select enable or disable. Both of the enable options will allow manual control of your lights.
        The enable options are only for selecting what should happen when you turn the by-pass ON and the lights are already ON. 
      default: bypass_disabled
      selector:
        select:
          options:
            - label: Enable the By-pass - If lights are ON, turn lights OFF
              value: "bypass_enabled"
            - label: Enable the By-pass - If lights are ON, leave lights ON
              value: "bypass_enabled_stop"
            - label: Disable the By-pass option
              value: "bypass_disabled"
    motion_bypass:
      name: Trigger Sensor By-pass
      description: Select a switch that will By-pass the trigger sensor and make your lights function as normal. 
        The entity cannot be included in, "Lights - Switches - Scenes" and or "Night Lights" selections.
      default: []
      selector:
        entity:
    include_sun:
      name: Use The Sun Option (Optional)
      description: Select enable or disable. 
      default: sun_disabled
      selector:
        select:
          options:
            - label: Enable the sun option
              value: "sun_enabled"
            - label: Disable the sun option
              value: "sun_disabled"
    sun_elevation:
      name: Sun Elevation
      description: This is the angle between the sun and the horizon. Negative values mean the sun is BELOW the horizon. Guide is -1.5 (dusk) and -4.0 (dawn).
      default: -1.5
      selector:
        number:
          min: -10
          max: 5
          step: 0.5
          unit_of_measurement: degrees
    include_ambient:
      name: Use The Ambient Options (Optional)
      description: Select enable or disable. 
      default: ambient_disabled
      selector:
        select:
          options:
            - label: Enable the ambient options
              value: "ambient_enabled"
            - label: Disable the ambient options
              value: "ambient_disabled"
    ambient_light_sensor:
      name: Ambient Light Sensor
      description: This is used for adding a condition to only work when it is dark or below the Ambient Light LUX Value.
      default: []
      selector:
        entity:
          domain: sensor
          device_class: illuminance
    ambient_light_options:
      name: Ambient Light Sensor - Site Conditions
      description: 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.
      default: ambient_light_option_disabled
      selector:
        select:
          options:
            - label: YES - My Ambient Light Sensor is affected by the Lights
              value: "ambient_light_option_enabled"
            - label: NO - My Ambient Light Sensor is not affected by the Lights
              value: "ambient_light_option_disabled"
    ambient_light_value:
      name: Ambient Light LUX Value
      description: Set the Ambient Light LUX Value. Guide is 20 lux (dusk) and 80 lux (dawn).
      default: 20
      selector:
        number:
          min: 0
          max: 500
          step: 10
          unit_of_measurement: LUX
    include_time:
      name: Use The Time Options (Optional)
      description: Use the "Start Time", "End Time" and the "Weekdays" values to only run the automation between the time periods.
        This applies for "Lights - Switches - Scenes" & "Night Lights".
      default: time_disabled
      selector:
        select:
          options:
            - label: Enable the time options
              value: "time_enabled"
            - label: Disable the time options
              value: "time_disabled"
    after_time:
      name: Start Time
      description: Set the start time.
      default: 00:00:00
      selector:
        time:
    before_time:
      name: End Time
      description: Set the end time.
      default: 00:00:00
      selector:
        time:
    weekday_options:
      name: Weekdays
      description: Select the days of the week you would like the automation to run. You must select "Enable the time options" above for the weekdays selections to work.
      default:
        - mon
        - tue
        - wed
        - thu
        - fri
        - sat
        - sun
      selector:
        select:
          multiple: true
          mode: list
          options:
            - label: Monday
              value: "mon"
            - label: Tuesday
              value: "tue"
            - label: Wednesday
              value: "wed"
            - label: Thursday
              value: "thu"
            - label: Friday
              value: "fri"
            - label: Saturday
              value: "sat"
            - label: Sunday
              value: "sun"
    include_zone:
      name: Use The Zone Option (Optional)
      description: Home Assistant can track your devices (mobile phones) location to a set zone via the mobile app device tracker.
        Enabling this option will only allow the automation to run if a device is in the zone.
        This can be useful if you have pets triggering the trigger sensor turning your lights ON and OFF when no one is home.
      default: zone_disabled
      selector:
        select:
          options:
            - label: Enable the zone option
              value: "zone_enabled"
            - label: Disable the zone option
              value: "zone_disabled"
    zone:
      name: Zone - Device Tracker
      description: Select the zone to track devices in. You must set up a zone and your devices (mobile phones, etc)
        to be tracked in Home Assistant for this option to work.
      default: []
      selector:
        entity:
          domain: zone
    include_night_lights:
      name: Use The Night Lights Options (Optional)
      description: Use the night lights to only run between the night lights time periods.
        This is useful for turning on different lights later in the night and / or setting a lower brightness level, 
        changing the colour setting or selecting a different scene. It is normally used for having lower softer 
        lights come ON when going to the bathroom at night.
      default: night_lights_disabled
      selector:
        select:
          options:
            - label: Enable the night lights options
              value: "night_lights_enabled"
            - label: Disable the night lights options
              value: "night_lights_disabled"
    night_lights:
      name: Night Lights
      description: The night lights that get turned on by the trigger sensor/s. You can also add switches and scenes.
        If you have selected a scene and you would like it to be turned OFF after the time delay,
        you must create another identical scene with everything OFF and enter it above in the "Scenes To Turn OFF".
      default: {}
      selector:
        target:
          entity:
            domain: 
              - light
              - switch
              - scene
    night_time_delay:
      name: Night Lights - Time Delay
      description: The delay time to leave the night lights on after the last trigger from ON to OFF state is detected.
      default: 5
      selector:
        number:
          min: 0
          max: 30
          step: 0.5
          unit_of_measurement: minutes
    include_night_light_control:
      name: Night Lights - Control
      description: Select the options you would like to use. It will only control a "light" entity that has a brightness setting.
      default: dont_use_night_brightness
      selector:
        select:
          options:
            - label: Use night brightness
              value: "use_night_brightness"
            - label: Dont use night brightness
              value: "dont_use_night_brightness"
    night_light_brightness:
      name: Night Lights - Brightness
      description: Brightness of the night lights when they are turned ON.
      default: 20
      selector:
        number:
          min: 1
          max: 100
          mode: slider
          step: 1
          unit_of_measurement: '%'
    night_lights_after_time:
      name: Night Lights - Start Time
      description: Set the start time.
      default: 00:00:00
      selector:
        time:
    night_lights_before_time:
      name: Night Lights - End Time
      description: Set the end time.
      default: 00:00:00
      selector:
        time:

# If motion sensor turns ON again within the time delay, it will restart the script.
mode: restart
max_exceeded: silent

variables:
  motion_trigger: !input motion_trigger
  light_switch: !input light_switch
  end_scenes: !input end_scenes
  time_delay: !input time_delay
  include_light_control: !input include_light_control
  light_brightness: !input light_brightness
  include_bypass: !input include_bypass
  motion_bypass: !input motion_bypass
  include_sun: !input include_sun
  sun_elevation: !input sun_elevation
  include_ambient: !input include_ambient
  ambient_light_sensor: !input ambient_light_sensor
  ambient_light_options: !input ambient_light_options
  ambient_light_value: !input ambient_light_value
  include_time: !input include_time
  after_time: !input after_time
  before_time: !input before_time
  weekday_options: !input weekday_options
  include_zone: !input include_zone
  zone: !input zone
  include_night_lights: !input include_night_lights
  night_lights: !input night_lights
  night_time_delay: !input night_time_delay
  include_night_light_control: !input include_night_light_control
  night_light_brightness: !input night_light_brightness
  night_lights_after_time: !input night_lights_after_time
  night_lights_before_time: !input night_lights_before_time
  

trigger:
  - platform: state
    id: "t1"
    entity_id: !input motion_trigger
    from: "off"
    to: "on"
  - platform: numeric_state
    id: "t2"
    entity_id: sun.sun
    attribute: elevation
    below: !input sun_elevation
  - platform: numeric_state
    id: "t3"
    entity_id: !input ambient_light_sensor
    below: !input ambient_light_value
  - platform: time
    id: "t4"
    at: !input after_time
  - platform: time
    id: "t5"
    at: !input night_lights_after_time

# All Conditions
condition:
#Trigger conditions
  - condition: or
    conditions:
      - condition: and # trigger from off to on
        conditions:
          - condition: state
            entity_id: !input motion_trigger
            match: any
            state: 'on'
      - condition: and # trigger by sun & check motion trigger is on
        conditions:
          - condition: state
            entity_id: !input motion_trigger
            state: 'on'
          - condition: trigger
            id: 't2'
      - condition: and # trigger by ambient & check motion trigger is on
        conditions:
          - condition: state
            entity_id: !input motion_trigger
            state: 'on'
          - condition: trigger
            id: 't3'    
      - condition: and # trigger by time & check motion trigger is on
        conditions:
          - condition: state
            entity_id: !input motion_trigger
            state: 'on'
          - condition: trigger
            id: 't4'
      - condition: and # trigger by night time & check motion trigger is on
        conditions:
          - condition: state
            entity_id: !input motion_trigger
            state: 'on'
          - condition: trigger
            id: 't5'

# Check Motion Sensor Manual By-pass
  - condition: or
    conditions:
      - "{{ include_bypass == 'bypass_disabled' }}"
      - "{{ motion_bypass == [] }}"
      - "{{ (include_bypass == 'bypass_enabled') and (states[motion_bypass].state == 'off') }}"
      - "{{ (include_bypass == 'bypass_enabled_stop') and (states[motion_bypass].state == 'off') }}"

# Check Sun Elevation
  - condition: or
    conditions:
      - "{{ include_sun == 'sun_disabled' }}"
      - "{{ (include_sun == 'sun_enabled') and (state_attr('sun.sun','elevation') <= sun_elevation | float(90)) }}"

# Check Ambient Light Sensor
  - condition: or
    conditions:
      - "{{ include_ambient == 'ambient_disabled' }}"
      - "{{ ambient_light_sensor == [] }}"
      - "{{ (include_ambient == 'ambient_enabled') and (states[ambient_light_sensor].state | int < ambient_light_value | int) }}"
      - "{{ (ambient_light_options == 'ambient_light_option_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}"
      - "{{ (ambient_light_options == 'ambient_light_option_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}"

# Check The Time Options
  - condition: or
    conditions:
      - "{{ include_time == 'time_disabled' }}"
      - condition: and
        conditions:      
        - condition: time
          after: !input after_time
          before: !input before_time
          weekday: !input weekday_options
        -  "{{ include_time == 'time_enabled' }}"

# Check if people are in the zone
  - condition: or
    conditions:
      - "{{ include_zone == 'zone_disabled' }}"
      - condition: and
        conditions:
        - condition: numeric_state
          entity_id: !input zone
          above: 0
        -  "{{ include_zone == 'zone_enabled' }}"

action:
  - choose:
      - alias: "Check night lights options"
        conditions:
          - condition: time
            after: !input night_lights_after_time
            before: !input night_lights_before_time
          -  "{{ include_night_lights == 'night_lights_enabled' }}"
        sequence:
          - choose:
            - alias: "Reset lights when trigger by night time"
              conditions:
                - condition: trigger
                  id: 't5'
              sequence:
                - service: homeassistant.turn_off
                  target: !input light_switch
                - service: scene.turn_on
                  entity_id: !input end_scenes
          - alias: "Turn on the night lights"
            service: homeassistant.turn_on
            target: !input night_lights
          - choose:
            - alias: "Set the brightness for the night light switch"
              conditions:
                - condition: template
                  value_template: "{{ include_night_light_control == 'use_night_brightness' }}"
              sequence:
                - service: light.turn_on
                  target: !input night_lights
                  data:
                    brightness_pct: !input night_light_brightness
          - alias: "Wait until motion sensor is off"
            wait_for_trigger:
              platform: state
              entity_id: !input motion_trigger
              from: "on"
              to: "off"
          - alias: "Wait the number of minutes set in the night light time delay"
            delay: 
              minutes: !input night_time_delay
          - choose:
            - alias: "Check by-pass stop option"
              conditions:
                - condition: template
                  value_template: "{{ (include_bypass == 'bypass_enabled_stop') and (states[motion_bypass].state == 'on') }}"
              sequence:
                - stop: "Stop the automation because of the by-pass option"
          - alias: "Turn off the night lights"
            service: homeassistant.turn_off
            target: !input night_lights
          - alias: "Turn off the scenes"
            service: scene.turn_on
            entity_id: !input end_scenes
    default:
      - alias: "Turn on the lights"
        service: homeassistant.turn_on
        target: !input light_switch
      - choose:
        - alias: "Set the brightness for the light switch"
          conditions:
            - condition: template
              value_template: "{{ include_light_control == 'use_brightness' }}"
          sequence:
            - service: light.turn_on
              target: !input light_switch
              data:
                brightness_pct: !input light_brightness
      - alias: "Wait until motion sensor is off"
        wait_for_trigger:
          platform: state
          entity_id: !input motion_trigger
          from: "on"
          to: "off"
      - alias: "Wait the number of minutes set in the light time delay"
        delay: 
          minutes: !input time_delay
      - choose:
        - alias: "Check by-pass stop option"
          conditions:
            - condition: template
              value_template: "{{ (include_bypass == 'bypass_enabled_stop') and (states[motion_bypass].state == 'on') }}"
          sequence:
            - stop: "Stop the automation because of the by-pass option"
      - alias: "Turn off the lights"
        service: homeassistant.turn_off
        target: !input light_switch
      - alias: "Turn off the scenes"
        service: scene.turn_on
        entity_id: !input end_scenes

CHANGELOG

  • Version: 2.6: - 5 Feb-23 - Added a new option to the by-pass.
  • Version: 2.5: - 25 Jan-23 - Cleaned up by-pass selection.
  • Version: 2.4: - 16 Jan-23 - Added weekday selection.
  • Version: 2.3: - 15 Jan-23 - Removed wording description for clearing 2 entities selections.
  • Version: 2.2: - 6 Jan-23 - Fixed bug in night lights flickering on trigger.
  • Version: 2.1: - 5 Jan-23 - Added brightness control, Zone - Device Tracker & Night Lights options.
  • Version: 2.0: - 15 Dec-22 - Upgrade option for the LUX sensor.
  • Version: 1.9: - 29 Nov-22 - Bug fix thanks to @Momo. When using multiple entities in “Trigger Sensor - Binary Sensors”
  • Version: 1.8: - 20 Nov-22 - More user friendly selection for enabling and disabling options and Bug Fix
  • Version: 1.7: - 15 Nov-22 - You can add any Binary Sensors you like as the trigger.
  • Version: 1.6: - 14 Nov-22 - You can add scenes.
  • Version: 1.5: - 9 Nov-22 - You can add a start time and an end time (Optional).
  • Version: 1.4: - 5 Nov-22 - You can add as many motion sensors as you like.
  • Version: 1.3: - 3 Nov-22 - Ambient Light Sensor and set the LUX value (Optional).
  • Version: 1.2: - 2 Nov-22 - Motion Sensor By-pass (Optional).
  • Version: 1.1: - 28 Oct-22 - Initial release

MY OTHER BLUEPRINTS
Smart Relay - Contactor
Push Button Relay - Contactor
Toilet Exhaust Fan with time delay
Timer Relay - Run ON Timer
Entity - Run ON Timer
Bathroom Humidity Exhaust Fan
Temperature Control Exhaust Fan
Temperature Control Exhaust Fan - Inverted
Turn Light, Switch or Scene On & Off with Trigger Conditions

19 Likes

New update 1.2

We added a Motion Sensor By-pass option. This allows you to add a switch entity so you can disable the motion sensor and operate the lights as normal. This can be a physical switch on the wall or just one in HA. Must be ON and OFF and can’t be a light you are switching with the motion sensor.

Use case
You can use this option for the following and more.

  • Sometimes you need to disable the motion sensor to keep the lights on when you are having friends over.
  • Sometimes it is a windy night and your lights keep going ON and OFF and you need to disable them.
  • Sometimes your just working out side and you need them to stay ON.

Enjoy

Blacky :grinning:

You know what would be amazing? Somehow adding schedules and scenes to this, and this would be an absolute monster of a Blueprint.

Used it so far and enjoying it a lot. Good job man.

2 Likes

Hi @MARTWIN thanks for the kind words. I have on my list to add schedules to control the time but I am patiently waiting on HA to add a weekday selector that makes it easy for the users to use. I have asked for it so let see but be assured it is on the list. I will also put your idea for scenes on the list :+1:

New update 1.3

You have the option to set a Ambient Light Sensor and set the LUX value. This is used for adding a condition to only work when it is dark or below the Ambient Light LUX Value.

Enjoy

Blacky :grinning:

1 Like

FAQ

Q: How do you update the blueprint and not delete / recreate existing automations?

A Please follow these steps Click Here

Q: How to use the “Trigger Sensor By-pass” without having a physical switch?

A: Go to Settings / Devices & Services / click on the “Helpers” tab / click “+ CREATE HELPER” and select “Toggle”. In the name put “Sensor Light By-pass” and click save. Then go back into the automation and in the “Trigger Sensor By-pass (Optional)” search for the name you created in this case “Sensor Light By-pass” and click save. Now in a “Dashboard” click “Edit dashboard” then click “+ ADD CARD” click on “Button” or “Entities” in the entity field again search for the name you created in this case “Sensor Light By-pass” and click save. Then click “DONE”. You now have a “Sensor Light By-pass” switch to disable the trigger sensor.

Q: Why did you choose sun elevation as the sun option and not sunrise and sunset, I don’t really understand the degrees and elevation, I assume zero is the sun just on the horizon with a + being day time and a - night time.

A Please read our explanation and how to set it up, it’s easy :slightly_smiling_face: Click Here

Q: When I add a scene to “Lights - Switches - Scenes” or in “Night Lights” it doesn’t turn OFF?

A: If you have selected a scene to be turned ON and you would like it to be turned OFF after the time delay, you must create another identical scene with everything OFF and enter it into the “Scenes To Turn OFF”. See below examples.

Q: I have more than one trigger sensor / binary sensor and my light will come ON then it will turn OFF and stay OFF? - or - The automation is not working correctly with 2 or more trigger sensor / binary sensor and is driving you crazy?

A: Please follow these steps Click Here

Q: I have set the “Ambient Light Sensor - Site Conditions” to “YES” and the lights keep turning OFF. I have only selected scenes in the “Lights - Switches - Scenes”. Am I doing something wrong?

A Please follow these steps Click Here

Q: I would like to set a different value but the slider is not letting me?

A Just simply type the number value you would like in the field and click save. This is for “Time Delay”, “Sun Elevation” and “Ambient Light LUX Value”. A red line will appear under the number you have entered but once you click save, exit the automation and go back into it the red line will not be there.

Q: How do I clear my Ambient Light Sensor?

A: This is if your using HA 2023.1.2 and below. Consider upgrading and then click X and save. Or follow this. Click on the three dots on the top right / select Edit in YAML / look for your ambient_light_sensor and put [] removing the sensor name. Below is the code.

    ambient_light_sensor: []

Then click save.

Q: When I updated from Version 1.1, 1.2 or 1.3 to 1.4 and above I can’t see my motion sensor selection?

A: Please follow these steps Click Here

Highly appreciate your attention and you time. You rock!
I’m following this thread all the time to see what’s new :smiley:

Hey loving this blueprint! Great work

Solved this… with below.
I’m having one issue with the bypass as I do have a switch but I have it toggle a smart light on and off. So the switch doesn’t have a on or off state. Only the light does.

How can I use this option?

I have made a helper switch which works but then requires me to use the app to change it on or off. Which I’d like to use the switch as intended.

Solved.
Added toggle of the helper Boolean with the switch. So it turns light and Boolean on. And then both off when clicked again. Fixing my original issue.

I would now light to some how add light brightness as this is my garden light. Security light. So when motion triggered I want it as 100% but if I turn the light on dim and then off. Next time motion just resumes that state.
I’m guessing this would be an easy add for me but also a great option for this blueprint.
Brightness or scene

Thanks for your help. And I’m looking forward to the progress with this

Thanks for your feedback. Yep a scene will do this. I have this on the list to add. :+1:

1 Like

New update 1.4

You have the option to add multiple motion sensors. :+1:

Use case
You could have two or more motion sensors that turn the lights on.

  • Your driveway and your front door are apart from one another. So you have two motion sensors, one that picks up your car and the other your front door. Someone visits, light come on and when you get home from work in your car lights come on.
  • Two doors into a factory (or a large room). Two motion sensors at each door.

I think this will be useful to fix this now moving forward, but this update will hide your selection of your motion sensor from any existing sensor light automations you have. If you are starting from new then your all good and this will not affect you. But if you are upgrading from Versions 1.1, 1.2 & 1.3 you can fix it easily. You have 2 options.

  • Delete your existing sensor light automation (not the blueprint), update the blueprint and then add your automation back again. Should be easy enough.
  • Update the blueprint, go into your “sensor light automation” and edit the YAML code. I will walk you through the steps, its not hard but you must follow the steps or it will disappear from your automations. So if your not sure or confident maybe do the first option.

1 - This is how your sensor light automation normally looks like. Versions 1.1, 1.2 & 1.3 only. See below.

2 - This is what it looks like after you update from versions 1.1, 1.2 & 1.3 to 1.4. No selection available.

3 - Click on the 3 dots and select “Edit in YAML”

4 - This is how your “motion_trigger” will look like. We need to edit this line only.
4

5 - This is how you will need to edit the YAML. Make sure you put the “-” with a space then the name of your sensor. Code example also below. Then Click Save.
5
code below

    motion_trigger:
      - binary_sensor.your_sensor_here

6 - Click on the 3 dots and “Edit in visual editor”

7 - You should now see your motion sensor with a option to add another one. If you don’t see it go back to step 3 and check your code is correct. If you do then your done.

Enjoy

Blacky :grinning:

Back to FAQ: Click Here

1 Like

Hello Blacky and Community,

First of all thank you for your grait job!

I would like to ask one question which seems to be at first sight an offtopic, but actually is related to this one :slight_smile: May be my ideas could be also implemented here in the future. Or even I can help (but this is not the near future :slight_smile: )

I am new to home assistant and currently evaluating which product to take for my home. So far I do really like HA, but still curious if there is no showstopper. One automation I want to implement is a light control based on motion, light intensity and/or sun position and door contact. The algorithm should be like this:

If I open the door, lights immediately goes on even before motion sensor trigger an event. In this case, light has relative short timeout and if no motion detected in that period of time, the light goes off. This is useful if one just opened the door to check something and left it not fully closed.

Next every motion event will re-schedule long delay or mid-long one. This depends on if the door stays opened or closed. If opened we can run mid-long, but if closed long.

Finally, if door closes (also case open/ close), then light period re-scheduled to the short one again. Means if a person left the room we will turn off the light fast, but if a motion trigger event after the door is closed, then we again re-schedule long period.

Plus some nice to have feature (for bath for example) - flash slightly light with color temperature, color, or intensity every N minutes, so you have time sense.

Now, my question - is it possible to implement this in HA without real hacks? I already saw some “hardcore” with lambdas and plain script, but would like to know if it is possible to make it pretty simple and standard.

With best regards,
Mike

Hi @minko

Look no further with HA you really can do anything you like.

You have got a lot of options with door open, door closed.

Most people just put a motion sensor in the room. They trigger really fast and if the door opens in then it will pick up the doors motion. You then get rid of all your other door open / door closed options. Then just set a time delay long enough to keep the lights on when you are in the room. You can use the by-pass option and then have another automation for your bath. Probably a scene would work here.

You can use the sun elevation if you don’t have a LUX sensor. If you have a LUX sensor put it in a place outside where a light will not affect it then you can use that for all your automations.

That should look after most of it.

So this blueprint will work perfectly!! :+1: :grinning: :facepunch:

Option for your bath. What look nice is to have some strip LED addressable lighting under your vanity and in a niche if possible. Then use WLED to control them. I have a few of these they work. You will have so many options for your bath. He has heaps of information on his site and a YouTube channel. WLED will be auto discovered into HA and is fully integrated.

1 Like

New update 1.5

You have the option to set a start time and an end time. This will only allow it to run between the time periods.

Enjoy

Blacky :grinning:

2 Likes

Thank you for the clarification! In meantime I have already got some insides of HA Power :slight_smile: Will continue to learn in a free time.

Trying to use this with 2 motion sensors in the same room, one a Philips hue the other a Aqara FP01 they don’t seem to want to play nicely together. It would seem the Aqara although showing in the automation isn’t actually registering. Any idea’s

Using the Philips as motion and illuminance and the Aqara as motion, the light comes on when I go into the room which the philips motion pick up but the Aqara isnt keeping the light on even though it still detects me in the room. What I was hoping would happen was they would both detect motion and when the Philips showed no movement with me sitting down the Aqara would keep the light on as it still senses me in the room. Hope that makes sense.

Hi @Fontie, thanks for your question and it does make sense.

I have just tested the blueprint with 2 motion sensors simulating what you are doing and it works perfectly here. So the Blueprint should work as your intent use case.

Lets try and work this out :grinning:. Could you check your Aqara sensor for us as we know your Philips is working fine by doing the following.

Remove your Philips motion sensor from the blueprint and just use your Aqara motion sensor, It should turn the light on and say on if motion keeps being detected.

If it works then see if the light says on with your time delay setting. If it keeps turning OFF then increasing the time delay slowly until the light stays ON. Once you have that working add back your Philips motion sensor.

If it doesn’t work there could be something going on with your Aqara sensor. Check in “Developer Tools” / States and select your Aqara motion sensor. See what state it is reporting. You will need to trigger it and refresh it to see the state change. It should be a ON / OFF state. Then check your Philips motion sensor, again it should be a ON/OFF state.

Let us know how you go :grinning: :+1:

This was resolved through PM. Solution Click Here

Hi,
Great blueprint,bthanks!
As it seems you are actively developing it further, here are some feature requests:

  • option to dim the lights for an interval before Turing them off
  • option to select a different light based on a night entitz
  • accept others sensors than luminance ones for lux (might need to explain this more: aqara motion sensors report lux very infrequently. They mostly sync when they detect motion. This makes measurements wrong, as it registers high lux levels while the lights are still on. If I go out of the room, the lights will turn off. But as the motion sensor didn’t update the lux measurement is still high. If I come back after a short time the lights won’t turn on. I made a template sensor only updating if the lights are currently out. It reflects the real luminance way better than the original one. But the blueprint doesn’t accept this sensor.

Just let me know, what you think!

@capstan1 thanks for your kind words :blush: Glad your liking the blueprint. It is nice to hear feature requests so thank you.

  • Option to dim the lights… I will look into this… if I was to do this it would have the option for turning OFF and turning ON… user can choose. Not promising but has me thinking as I can see a use case for this.

  • Option to select different light base on a night entitz… not fully understanding this. :pensive:

  • Accept other sensors than luminance. Assuming you are using the LUX option and motion. It looks like as you describe that the blueprint is working as it was intended. If the LUX is higher than the set point then it will not run. It seams that the Aqara sensor is not being used as the developers intent.

I would recommend when using a LUX sensor that you have a separate LUX sensor outside that only reads the natural light and is not effected by any artificial light source. You then can use it for any automation, like this blueprint. Maybe don’t use LUX option and use the Sun Elevation option.

The Aqara sensor you have that has motion and LUX will not function correctly with this blueprint if the light that turns ON can influence the LUX sensor. Sensors that have motion and LUX in one do have a use case though. Example: If motion is detected the light comes on and the light brightness is automaticity adjusted depending on the LUX readings. So natural light and artificial light are combined to deliver a required LUX value. This is good for office spaces where artificial light is required to add to natural light to meet a required LUX setting thus being comfortable for workers and also saves on electricity cost. Having it report the LUX values slowly is good as it keeps the lights stable and is not adjusting the brightness up and down fast causing a nuance.

Thanks for your feedback :+1:

Option to select different light base on a night entitz… not fully understanding this. :pensive:

Sorry, wasn’t clear enough. I have a helper “it’s night/we are sleeping” which controls various things. For example it controls Adaptive Lightning night mode and mutes my phone. I’d like to use this helper to determine which light to turn on. At day control normal ceiling light, at night control ambiant light. It’s an edge use case so I really understand if you don’t want to implement it.

Accept other sensors than luminance. Assuming you are using the LUX option and motion. It looks like as you describe that the blueprint is working as it was intended.

I’d just need the option to use a template sensor as alternative to a real lux sensor. I can circumvent my issue with this template sensor perfectly. Sadly, some of my rooms have quite small windows, so an outdoor sensor won’t reflect the situation inside.

Thanks for your answer! Got another question: how does your blueprint handle no motion with various sensors? Only turn off if both detected no motion? Or as soon as one of the does?

Let me ponder on this…

Maybe I develop a different blueprint that will work.

It work of last motion detected then it start the time delay. So if any detector detects motion it will reset. Once all detectors have no motion then the time delay starts.