Skip to content

Instantly share code, notes, and snippets.

@gwww
Last active July 4, 2025 15:46
Show Gist options
  • Select an option

  • Save gwww/79a2e97594b6d43c1cb3acc6f6cf43e7 to your computer and use it in GitHub Desktop.

Select an option

Save gwww/79a2e97594b6d43c1cb3acc6f6cf43e7 to your computer and use it in GitHub Desktop.
Turn off light/switch after time
blueprint:
name: Light/switch auto-off after time
description: Turn off a light/switch after time has passed. On HA restart timer is restarted (for simplicity)
source_url: https://gist.github.com/gwww/79a2e97594b6d43c1cb3acc6f6cf43e7
domain: automation
author: Glenn Waters
input:
light_target:
name: Light/switch
selector:
entity:
filter:
- domain: light
- domain: switch
auto_off_time:
name: Wait time
description: Time to leave the light/switch on after being turned on.
default: 30
selector:
number:
min: 1
max: 600
unit_of_measurement: minutes
mode: restart
max_exceeded: silent
triggers:
- trigger: state
entity_id: !input light_target
to: "on"
- trigger: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
condition: state
entity_id: !input light_target
state: "on"
actions:
- delay:
minutes: !input auto_off_time
- action: homeassistant.turn_off
entity_id: !input light_target
alias: "Turn off the light/switch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment