Purpose
Monitor a switch for turning on and turn off after a given delay. Can be used if you want to limit the time a switch stays turned on but you turn on the switch by other means (e.g. manually).
Example Use Case
Always turn off the garden sprinkler system after 30 min, independently how or when it was turned on.
Input parameters
switch target
= switch to be monitored (entity in switch domain, no default)
switch delay
= turn off delay (formatted as hh:mm:ss, default “00:15:00”)
Other Remarks
- This blueprint does not turn on the switch, it does only check if a switch is activated (manually or by any other script).
- The time monitoring will not survive a home assistant restart during the (meaning the switch will stay turned on if the restart occurs during the delay period).
Or import this Blueprint by using the forum topic URL (Github Link)
blueprint:
name: Simple Time Monitored Switch (State Change Triggered)
description: turn off an activated switch after a specific delay (hh-mm-ss)
domain: automation
input:
switch_target:
name: Monitored Switch
description: Switch to be monitored
selector:
entity:
domain: switch
switch_delay:
name: Switch Off Delay
description: Delay to switch off (hh-mm-ss)
default: "00:15:00"
selector:
time:
trigger:
platform: state
entity_id: !input switch_target
from: "off"
to: "on"
action:
- delay: !input switch_delay
- service: switch.turn_off
entity_id: !input switch_target
mode: restart
max_exceeded: silent
If you’re running an older Home Assistant version, follow the following steps:
- Copy the URL from the browser address bar
- Go to Home
Assistant → Configuration → Blueprints
- Click on the blue “Import Blueprint” button in the bottom right, paste the blueprint topic URL
- Click on “Preview Blueprint”
- Click on “Import Blueprint”