Last active
February 4, 2026 06:26
-
-
Save dudo/37dedf17603aed3f061c4c519a232622 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Nightlight - Turn on, then off after no motion | |
| description: > | |
| Turns on a light when motion/person is detected during a time window, and turns | |
| it off after the sensor has been clear for a configurable duration. Retriggers | |
| extend the on-time. | |
| domain: automation | |
| input: | |
| motion_sensor: | |
| name: Motion/person sensor | |
| selector: | |
| entity: | |
| domain: binary_sensor | |
| light_target: | |
| name: Light (or lights) to control | |
| selector: | |
| target: | |
| entity: | |
| domain: light | |
| brightness: | |
| name: Brightness | |
| default: 255 | |
| selector: | |
| number: | |
| min: 1 | |
| max: 255 | |
| step: 1 | |
| end_state: | |
| name: End state | |
| default: dim | |
| selector: | |
| select: | |
| options: | |
| - label: Dim (stay on) | |
| value: "dim" | |
| - label: Turn off | |
| value: "off" | |
| mode: restart | |
| trigger: | |
| - platform: state | |
| entity_id: !input motion_sensor | |
| to: "on" | |
| condition: | |
| - condition: sun | |
| after: sunset | |
| after_offset: "+00:15:00" | |
| before: sunrise | |
| before_offset: "-00:15:00" | |
| variables: | |
| end_state: !input end_state | |
| action: | |
| - service: light.turn_on | |
| target: !input light_target | |
| data: | |
| brightness: !input brightness | |
| transition: 1 | |
| - wait_for_trigger: | |
| - platform: state | |
| entity_id: !input motion_sensor | |
| to: "off" | |
| for: "00:01:00" | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ end_state == 'dim' }}" | |
| sequence: | |
| - service: light.turn_on | |
| target: !input light_target | |
| data: | |
| brightness: 38 | |
| transition: 10 | |
| default: | |
| - service: light.turn_off | |
| target: !input light_target | |
| data: | |
| transition: 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment