Skip to content

Instantly share code, notes, and snippets.

@blizzrdof77
Forked from tdiekel/automatic-turn-off.yaml
Last active January 12, 2024 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blizzrdof77/1f8d81cc68e93264aac1b3e8c9df936b to your computer and use it in GitHub Desktop.
Save blizzrdof77/1f8d81cc68e93264aac1b3e8c9df936b to your computer and use it in GitHub Desktop.
Automatic light or switch turn off after time
blueprint:
name: Automatic light or switch turn off after timeout
description: >
Given a switchable entity, when it is turned on, it will automatically turn off after a set timeout period off after a certain period of time.
Based on:
- [Turn Off Light After Time](https://gist.github.com/JonTheNiceGuy/5ac636739165dd593030c0fed16eb618) by [JonTheNiceGuy](https://gist.github.com/JonTheNiceGuy)
- [Automatic light or switch turn off after time](https://gist.github.com/tdiekel/88ac0967cf6d3002aa91e65e3768eb45) by [tdiekel](https://gist.github.com/tdiekel)
domain: automation
input:
entity:
name: Target Entity
description: Select the light or switchable entity to monitor.
selector:
entity:
domain:
- light
- switch
- fan
- input_boolean
- siren
- group
- media_player
- remote
time:
name: Duration
description: The duration for which to leave the device/entity on before turning it off.
selector:
duration:
trigger:
- platform: state
entity_id: !input entity
to: 'on'
for: !input time
mode: single
condition: []
action:
- service: homeassistant.turn_off
data: {}
entity_id: !input entity
@blizzrdof77
Copy link
Author

Added additional entity domains to list of allowed domains (all "switchable" domain types).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment