Motion-activated Light-brightness

Turn the light on to brightness when motion is detected, depending on the selected time period, different brightness and turn-on time.

This bluprint is designed to turn on the light by the motion sensor, and takes into account that at night you need a dimmer light than during the day, so I created the opportunity to choose the period in which you want to have a different brightness of light other than daytime, as well as the time after which the light should turn off also divided into two periods

This is my first bluprint, so do not judge strictly, and perhaps there is a better option to create this

Motion-activated Light-brightness:

Get started

Click the badge to import this Blueprint:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Or import this Blueprint by using the forum topic URL:

blueprint:
  name: Motion-activated Light-brightness
  description: Turn the light on to brightness when motion is detected, depending on the selected time period, different brightness and turn-on time.
  domain: automation
  input:
    motion_entity:
      name: Motion Sensor
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
    light_target:
      name: Light
      selector:
        target:
          entity:
            domain: light
    on_night_time:
      name: (Required) On Time Night
      description: The time when the night mode starts.
      selector:
        time: {}
    off_night_time:
      name: (Required) Off Time Night
      description: The time when the night mode ends.
      selector:
        time: {}
    day_brightness:
      name: Day brightness
      description: Brightness, in daytime mode
      default: 1
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    night_brightness:
      name: Night brightness
      description: Brightness, in night mode mode
      default: 1
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    no_motion_wait_day:
      name: Wait time day
      description: Time to leave the light on after detecting the last movement for daytime mode.
      default: 120
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds
    no_motion_wait_night:
      name: Wait time night
      description: Time to leave the light on after detecting the last movement in night mode
      default: 120
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds

# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent

trigger:
  platform: state
  entity_id: !input motion_entity
  from: "off"
  to: "on"

action:
  - choose:
      - conditions:
          - condition: time
            after: !input on_night_time
            before: !input off_night_time
        sequence:
          - alias: "Turn on the light"
            service: light.turn_on
            data:
              brightness_pct: !input night_brightness
            target: !input light_target
          - alias: "Wait until there is no motion from device"
            wait_for_trigger:
              platform: state
              entity_id: !input motion_entity
              from: "on"
              to: "off"
          - alias: "Wait the number of seconds that has been set"
            delay: !input no_motion_wait_night
          - alias: "Turn off the light"
            service: light.turn_off
            target: !input light_target
    default:
      - alias: "Turn on the light"
        service: light.turn_on
        data:
          brightness_pct: !input day_brightness
        target: !input light_target
      - alias: "Wait until there is no motion from device"
        wait_for_trigger:
          platform: state
          entity_id: !input motion_entity
          from: "on"
          to: "off"
      - alias: "Wait the number of seconds that has been set"
        delay: !input no_motion_wait_day
      - alias: "Turn off the light"
        service: light.turn_off
        target: !input light_target

At the request of people who liked my blueprint, I created a version with the ability to also choose the color temperature, unfortunately I do not have enough knowledge to do all this in one blueprint.

Motion-activated Light-brightness and temp:

Get started

Click the badge to import this Blueprint:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Or import this Blueprint by using the forum topic URL:

blueprint:
  name: Motion-activated Light-brightness and temp
  description: Turn the light on to brightness and temperature when motion is detected, depending on the selected time period, different brightness and turn-on time.
  domain: automation
  input:
    motion_entity:
      name: Motion Sensor
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
    light_target:
      name: Light
      selector:
        target:
          entity:
            domain: light
    on_night_time:
      name: (Required) On Time Night
      description: The time when the night mode starts.
      selector:
        time: {}
    off_night_time:
      name: (Required) Off Time Night
      description: The time when the night mode ends.
      selector:
        time: {}
    day_brightness:
      name: (Required) Day brightness
      description: Brightness, in daytime mode
      default: 100
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    night_brightness:
      name: (Required) Night brightness
      description: Brightness, in night mode
      default: 20
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    day_temp:
      name: (Required) Day temp
      description: Temp, in daytime mode
      default: 1
      selector: 
        color_temp:
    night_temp:
      name: (Required) Night temp
      description: Temp, in night mode
      default: 1
      selector: 
        color_temp:
    no_motion_wait_day:
      name: Wait time day
      description: Time to leave the light on after detecting the last movement for daytime mode.
      default: 120
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds
    no_motion_wait_night:
      name: Wait time night
      description: Time to leave the light on after detecting the last movement in night mode
      default: 120
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds

# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent

trigger:
  platform: state
  entity_id: !input motion_entity
  from: "off"
  to: "on"

action:
  - choose:
      - conditions:
          - condition: time
            after: !input on_night_time
            before: !input off_night_time
        sequence:
          - alias: "Turn on the light"
            service: light.turn_on
            data:
              brightness_pct: !input night_brightness
              color_temp: !input night_temp
            target: !input light_target
          - alias: "Wait until there is no motion from device"
            wait_for_trigger:
              platform: state
              entity_id: !input motion_entity
              from: "on"
              to: "off"
          - alias: "Wait the number of seconds that has been set"
            delay: !input no_motion_wait_night
          - alias: "Turn off the light"
            service: light.turn_off
            target: !input light_target
    default:
      - alias: "Turn on the light"
        service: light.turn_on
        data:
          brightness_pct: !input day_brightness
          color_temp: !input day_temp
        target: !input light_target
      - alias: "Wait until there is no motion from device"
        wait_for_trigger:
          platform: state
          entity_id: !input motion_entity
          from: "on"
          to: "off"
      - alias: "Wait the number of seconds that has been set"
        delay: !input no_motion_wait_day
      - alias: "Turn off the light"
        service: light.turn_off
        target: !input light_target

Motion-activated Light-brightness and color:

Get started

Click the badge to import this Blueprint:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Or import this Blueprint by using the forum topic URL:

blueprint:
  name: Motion-activated Light-brightness and color
  description: Turn the light on to brightness and color when motion is detected,
    depending on the selected time period, different brightness and turn-on time.
  domain: automation
  input:
    motion_entity:
      name: Motion Sensor
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
          multiple: false
    light_target:
      name: Light
      selector:
        target:
          entity:
            domain: light
    on_night_time:
      name: (Required) On Time Night
      description: The time when the night mode starts.
      default: "23:00:00"
      selector:
        time: {}
    off_night_time:
      name: (Required) Off Time Night
      description: The time when the night mode ends.
      default: "8:00:00"
      selector:
        time: {}
    day_brightness:
      name: (Required) Day brightness
      description: Brightness, in daytime mode
      default: 100
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    night_brightness:
      name: (Required) Night brightness
      description: Brightness, in night mode
      default: 20
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    day_color:
      name: (Required) Day color
      description: Color, in daytime mode
      default: [255, 255, 255]
      selector:
        color_rgb:
    night_color:
      name: (Required) Night color
      description: Color, in night mode
      default: [255, 255, 255]
      selector:
        color_rgb:
    no_motion_wait_day:
      name: Wait time day
      description: Time to leave the light on after detecting the last movement for
        daytime mode.
      default: 120
      selector:
        number:
          min: 0.0
          max: 3600.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
    no_motion_wait_night:
      name: Wait time night
      description: Time to leave the light on after detecting the last movement in
        night mode
      default: 120
      selector:
        number:
          min: 0.0
          max: 3600.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0

mode: restart
max_exceeded: silent
trigger:
  platform: state
  entity_id: !input 'motion_entity'
  from: 'off'
  to: 'on'
action:
- choose:
  - conditions:
    - condition: time
      after: !input 'on_night_time'
      before: !input 'off_night_time'
    sequence:
    - alias: Turn on the light
      service: light.turn_on
      data:
        brightness_pct: !input 'night_brightness'
        rgb_color: !input 'night_color'
      target: !input 'light_target'
    - alias: Wait until there is no motion from device
      wait_for_trigger:
        platform: state
        entity_id: !input 'motion_entity'
        from: 'on'
        to: 'off'
    - alias: Wait the number of seconds that has been set
      delay: !input 'no_motion_wait_night'
    - alias: Turn off the light
      service: light.turn_off
      target: !input 'light_target'
  default:
  - alias: Turn on the light
    service: light.turn_on
    data:
      brightness_pct: !input 'day_brightness'
      rgb_color: !input 'day_color'
    target: !input 'light_target'
  - alias: Wait until there is no motion from device
    wait_for_trigger:
      platform: state
      entity_id: !input 'motion_entity'
      from: 'on'
      to: 'off'
  - alias: Wait the number of seconds that has been set
    delay: !input 'no_motion_wait_day'
  - alias: Turn off the light
    service: light.turn_off
    target: !input 'light_target'

Motion-activated Light-brightness and color or temp and dimmed:

In this blueprint, all the previous functions are combined and the ability to select the transition time is added, the code turned out to be quite voluminous, unfortunately, I could not shorten it, because the variables have a local area of action, if anyone knows how to do this, please prompt

Get started

Click the badge to import this Blueprint:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.
Or import this Blueprint by using the forum topic URL:

blueprint:
  name: Motion-activated Light-brightness and color or temp and dimmed
  description: Turn the light on to brightness and color or temp when motion is detected,
    depending on the selected time period, different brightness and turn-on time.
  domain: automation
  input:
    motion_entity:
      name: Motion Sensor
      selector:
        entity:
          domain:
          - binary_sensor
          multiple: true
    light_target:
      name: Light
      selector:
        target:
          entity:
          - domain:
            - light
    on_night_time:
      name: (Required) On Time Night
      description: The time when the night mode starts.
      default: '23:00:00'
      selector:
        time: {}
    off_night_time:
      name: (Required) Off Time Night
      description: The time when the night mode ends.
      default: '8:00:00'
      selector:
        time: {}
    day_brightness:
      name: (Required) Day brightness
      description: Brightness, in daytime mode
      default: 100
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    night_brightness:
      name: (Required) Night brightness
      description: Brightness, in night mode
      default: 20
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    transition_on:
      name: Transition on
      description: Duration it takes to get to on state.
      default: 1
      selector:
        number:
          min: 0.0
          max: 60.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
    transition_off:
      name: Transition off
      description: Duration it takes to get to off state.
      default: 1
      selector:
        number:
          min: 0.0
          max: 60.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
    mode_light_control_day:
      name: Light Control Day
      description: Select the options you would like to use. It will only control
        a "light" entity that has a brightness setting.
      default: use_brightness
      selector:
        select:
          options:
          - label: Only brightness
            value: use_brightness
          - label: Use_temp
            value: use_temp
          - label: Use_color
            value: use_color
          multiple: false
          custom_value: false
    mode_light_control_night:
      name: Light Control Night
      description: Select the options you would like to use. It will only control
        a "light" entity that has a brightness setting.
      default: use_brightness
      selector:
        select:
          options:
          - label: Only brightness
            value: use_brightness
          - label: Use_temp
            value: use_temp
          - label: Use_color
            value: use_color
          multiple: false
          custom_value: false
    day_color:
      name: (Required) Day color
      description: Color, in daytime mode
      default:
      - 255
      - 255
      - 255
      selector:
        color_rgb: {}
    night_color:
      name: (Required) Night color
      description: Color, in night mode
      default:
      - 255
      - 255
      - 255
      selector:
        color_rgb: {}
    day_temp:
      name: (Required) Day temp
      description: Temp, in daytime mode
      default: 1
      selector:
        color_temp: {}
    night_temp:
      name: (Required) Night temp
      description: Temp, in night mode
      default: 1
      selector:
        color_temp: {}
    no_motion_wait_day:
      name: Wait time day
      description: Time to leave the light on after detecting the last movement for
        daytime mode.
      default: 120
      selector:
        number:
          min: 0.0
          max: 3600.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
    no_motion_wait_night:
      name: Wait time night
      description: Time to leave the light on after detecting the last movement in
        night mode
      default: 120
      selector:
        number:
          min: 0.0
          max: 3600.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
    mode_dimmed_light_day:
      name: Light Dimmed Day
      description: Select the options you would like to use.
      default: use_off
      selector:
        select:
          options:
          - label: Only Turn Off
            value: use_off
          - label: Dimmed then Turn Off
            value: use_dimmed_off
          - label: Dimmed
            value: use_dimmed
          multiple: false
          custom_value: false
    mode_dimmed_light_night:
      name: Light Dimmed Night
      description: Select the options you would like to use.
      default: use_off
      selector:
        select:
          options:
          - label: Only Turn Off
            value: use_off
          - label: Dimmed then Turn Off
            value: use_dimmed_off
          - label: Dimmed
            value: use_dimmed
          multiple: false
          custom_value: false
    day_dimmed:
      name: Day dimmed
      description: Brightness, in daytime mode
      default: 50
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    night_dimmed:
      name: Night dimmed
      description: Brightness, in night mode
      default: 10
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    delay_off_day:
      name: Delay before complete off day
      description: The time that the light will be dimmed before a complete off
      default: 30
      selector:
        number:
          min: 0.0
          max: 3600.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
    delay_off_night:
      name: Delay before complete off night
      description: The time that the light will be dimmed before a complete off
      default: 30
      selector:
        number:
          min: 0.0
          max: 3600.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
  source_url: https://gist.github.com/Aleks130699/1c8b5e04628f106702b4db392711b7a9
mode: restart
max_exceeded: silent
variables:
  mode_light_control_day: !input mode_light_control_day
  mode_light_control_night: !input mode_light_control_night
  mode_dimmed_light_day: !input mode_dimmed_light_day
  mode_dimmed_light_night: !input mode_dimmed_light_night
trigger:
  platform: state
  entity_id: !input motion_entity
  from: 'off'
  to: 'on'
action:
- choose:
  - conditions:
    - condition: time
      after: !input on_night_time
      before: !input off_night_time
    sequence:
    - parallel:
      - choose:
        - conditions:
          - condition: template
            value_template: '{{ mode_light_control_night == ''use_brightness'' }}'
          sequence:
          - alias: Turn on the light
            service: light.turn_on
            data:
              transition: !input transition_on
              brightness_pct: !input night_brightness
            target: !input light_target
        - conditions:
          - condition: template
            value_template: '{{ mode_light_control_night == ''use_temp'' }}'
          sequence:
          - alias: Turn on the light
            service: light.turn_on
            data:
              transition: !input transition_on
              brightness_pct: !input night_brightness
              color_temp: !input night_temp
            target: !input light_target
        - conditions:
          - condition: template
            value_template: '{{ mode_light_control_night == ''use_color'' }}'
          sequence:
          - alias: Turn on the light
            service: light.turn_on
            data:
              transition: !input transition_on
              brightness_pct: !input night_brightness
              rgb_color: !input night_color
            target: !input light_target
      - sequence:
        - alias: Wait until there is no motion from device
          wait_for_trigger:
            platform: state
            entity_id: !input motion_entity
            from: 'on'
            to: 'off'
        - alias: Wait the number of seconds that has been set
          delay: !input no_motion_wait_night
        - choose:
          - conditions:
            - condition: template
              value_template: '{{ mode_dimmed_light_night == ''use_dimmed'' or mode_dimmed_light_night  == ''use_dimmed_off'' }}'
            sequence:
            - parallel:
              - alias: Turn on the light
                service: light.turn_on
                data:
                  transition: !input transition_on
                  brightness_pct: !input night_dimmed
                target: !input light_target
              - if:
                - condition: template
                  value_template: '{{ mode_dimmed_light_night == ''use_dimmed_off'' }}'
                then:
                - alias: Wait the number of seconds that has been set
                  delay: !input delay_off_night
                - alias: Turn off the light
                  service: light.turn_off
                  data:
                    transition: !input transition_off
                  target: !input light_target
          - conditions:
            - condition: template
              value_template: '{{ mode_dimmed_light_night == ''use_off'' }}'
            sequence:
            - alias: Turn off the light
              service: light.turn_off
              data:
                transition: !input transition_off
              target: !input light_target
  default:
  - parallel:
    - choose:
      - conditions:
        - condition: template
          value_template: '{{ mode_light_control_day == ''use_brightness'' }}'
        sequence:
        - alias: Turn on the light
          service: light.turn_on
          data:
            transition: !input transition_on
            brightness_pct: !input day_brightness
          target: !input light_target
      - conditions:
        - condition: template
          value_template: '{{ mode_light_control_day == ''use_temp'' }}'
        sequence:
        - alias: Turn on the light
          service: light.turn_on
          data:
            transition: !input transition_on
            brightness_pct: !input day_brightness
            color_temp: !input day_temp
          target: !input light_target
      - conditions:
        - condition: template
          value_template: '{{ mode_light_control_day == ''use_color'' }}'
        sequence:
        - alias: Turn on the light
          service: light.turn_on
          data:
            transition: !input transition_on
            brightness_pct: !input day_brightness
            rgb_color: !input day_color
          target: !input light_target
    - sequence:
      - alias: Wait until there is no motion from device
        wait_for_trigger:
          platform: state
          entity_id: !input motion_entity
          from: 'on'
          to: 'off'
      - alias: Wait the number of seconds that has been set
        delay: !input no_motion_wait_day
      - choose:
        - conditions:
          - condition: template
            value_template: '{{ mode_dimmed_light_day == ''use_dimmed'' or mode_dimmed_light_day == ''use_dimmed_off'' }}'
          sequence:
          - parallel:
            - alias: Turn on the light
              service: light.turn_on
              data:
                transition: !input transition_on
                brightness_pct: !input day_dimmed
              target: !input light_target
            - if:
              - condition: template
                value_template: '{{ mode_dimmed_light_day == ''use_dimmed_off'' }}'
              then:
              - alias: Wait the number of seconds that has been set
                delay: !input delay_off_day
              - alias: Turn off the light
                service: light.turn_off
                data:
                  transition: !input transition_off
                target: !input light_target
        - conditions:
          - condition: template
            value_template: '{{ mode_dimmed_light_day == ''use_off'' }}'
          sequence:
          - alias: Turn off the light
            service: light.turn_off
            data:
              transition: !input transition_off
            target: !input light_target
14 Likes

Hi, thanks for creating this blueprint. I am using it and it is working very well.

This is great and works well!! Could you add the option please to select what colour temperature on Night and on Day. As during the day, I want a daylight and at night I’d like a warm white. Would this be possible?

4 Likes

Just saw this blueprint today, very nice. I’m able to use it at a few locations in our house. I have a few locations which the light only needs to be turned on if lux is above a certain value. Could this be incorporated too? If not; no worries, tnx anyhow!

1 Like

I can do this, but most likely a separate blueprint, I will consider adding this function to this blueprint, if it does not work, then a separate one

2 Likes

Thanks mate, that would be great. Please let me know the outcome either way :slight_smile:

I have already supplemented the theme with a color temperature selection option

1 Like

Thank for you blueprint! Can you add separate blueprint with brightness and rgb color, instead color temperature?

1 Like

Thanks for the blueprints, they work really well!
I have updated your blueprint to use lux data, like this when we specify a threshold the light will only turn on if lux level is bellow the threshold:

Click the badge to import this Blueprint:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Motion-activated Light (Brightness, Temperature, Lux)
  description: "Turn the light on to a given brightness and temperature when motion is detected, depending on the selected time period,\
    \ different brightness and temperature can be set.\n\
    \ Optionally you can set a lux treshold which will not turn on the light if lux sensor reports more light than the threshold."
  domain: automation
  input:
    motion_entity:
      name: Motion Sensor
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
    light_target:
      name: Light
      selector:
        target:
          entity:
            domain: light
    on_night_time:
      name: (Required) On Time Night
      description: The time when the night mode starts.
      selector:
        time: {}
    off_night_time:
      name: (Required) Off Time Night
      description: The time when the night mode ends.
      selector:
        time: {}
    day_brightness:
      name: (Required) Day brightness
      description: Brightness, in daytime mode
      default: 100
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    night_brightness:
      name: (Required) Night brightness
      description: Brightness, in night mode
      default: 20
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    day_temp:
      name: (Required) Day temp
      description: Temp, in daytime mode
      default: 1
      selector: 
        color_temp:
    night_temp:
      name: (Required) Night temp
      description: Temp, in night mode
      default: 1
      selector: 
        color_temp:
    illuminance_sensor:
      name: (Optional) Illuminance sensor
      description: The illuminance sensor to get lux data.
      default:
      selector:
        entity:
          domain: sensor
          device_class: illuminance
    illuminance_cutoff:
      name: (Optional) Illuminance threshold
      description: The threshold to compare to the current illumination (lux above this value will NOT turn on the light).
      default:
      selector:
        number:
          min: 0
          max: 100
          unit_of_measurement: lx
    no_motion_wait_day:
      name: Wait time day
      description: Time to leave the light on after detecting the last movement for daytime mode.
      default: 120
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds
    no_motion_wait_night:
      name: Wait time night
      description: Time to leave the light on after detecting the last movement in night mode
      default: 120
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds

# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent

trigger:
  platform: state
  entity_id: !input motion_entity
  from: "off"
  to: "on"

action:
  - choose:
      # IF light above threshold (cass dummy service to do nothing)
      - conditions: 
          - condition: numeric_state
            entity_id: !input illuminance_sensor
            above: !input illuminance_cutoff
        sequence:
          - alias: "Wait until there is no motion from device"
            wait_for_trigger:
              platform: state
              entity_id: !input motion_entity
              from: "on"
              to: "off"
          - alias: "Wait the number of seconds that has been set"
            delay: !input no_motion_wait_night
          - alias: "Turn off the light"
            service: light.turn_off
            target: !input light_target
      # ELIF light bellow threshold (turn on night light)
      - conditions:
          - condition: time
            after: !input on_night_time
            before: !input off_night_time
        sequence:
          - alias: "Turn on the light"
            service: light.turn_on
            data:
              brightness_pct: !input night_brightness
              color_temp: !input night_temp
            target: !input light_target
          - alias: "Wait until there is no motion from device"
            wait_for_trigger:
              platform: state
              entity_id: !input motion_entity
              from: "on"
              to: "off"
          - alias: "Wait the number of seconds that has been set"
            delay: !input no_motion_wait_night
          - alias: "Turn off the light"
            service: light.turn_off
            target: !input light_target
    # ELSE (Turn on day light)
    default:
      - alias: "Turn on the light"
        service: light.turn_on
        data:
          brightness_pct: !input day_brightness
          color_temp: !input day_temp
        target: !input light_target
      - alias: "Wait until there is no motion from device"
        wait_for_trigger:
          platform: state
          entity_id: !input motion_entity
          from: "on"
          to: "off"
      - alias: "Wait the number of seconds that has been set"
        delay: !input no_motion_wait_day
      - alias: "Turn off the light"
        service: light.turn_off
        target: !input light_target
6 Likes

Hmm…
what about dusk/dawn/night/day & sun set/rise

Time is nice, but it really depends on the season….

Elevation would be working as well :thinking:

4 Likes

Thank so much for this! It works perfectly with my Hue lights - when the stock options for Hue and HAOS didn’t deliver, this did. Well done!

Thanks for your blueprint!
I have one issue with it, my motion sensor has a cooldown period of 180 seconds. If i use the “Wait time day/night” in the blueprint, it adds this delay to the 180 seconds instead of adding it to the trigger time. How do I change this?

Good afternoon, in order not to take into account the cooldown period of the motion sensor, you need to remove these lines from the code

- alias: "Wait until there is no motion from device"
  wait_for_trigger:
    platform: state
    entity_id: !input motion_entity
    from: "on"
    to: "off"

but in this case, you will have problems that if you pass under the sensor during the cooldown period, the light will most likely not turn on

1 Like

hi there , hassio newbie here :blush: …
this automation works beautifully with my tplink bulbs (no rgb, only leds), kudos…
but may I ask if it would be possible to reduce to a defined percentage and not to switch off entirely once the time runs out, would be nice to have very low lights always enabled.

Thanks in advance :slight_smile:

Strangely enough, home assistant reports the light as turned on when this automation runs, but the light doesn’t actually turn on. using the built in automation (core/motion_light.yaml at e06603bbbd02375725dcd3e504dc7eba9d69cc50 · home-assistant/core · GitHub) works fine though. any ideas? I’m using Wyze bulbs

Do your lamps support brightness setting?

I made a blueprint for you with a choice of colors

Hello, thank you for this blueprint, you saved me a lot of time! :+1:

Just one request, could you add “dimming” effect? With the previous Motion-sensor blueprint (the default) the lights are lightening really fancy and my girlfriend loves it.

Tell me what exactly did you mean by the dimming effect? I have added a transition time function, or would you like the light to be dimmed to, for example, 10%? and only after that did it turn off?

Could a human presence sensor version be made?
It only works with PIRs.
Thanks, and congratulations for the work.