Simple Time Monitored Switch

Tags: #<Tag:0x00007fc417288e98> #<Tag:0x00007fc417288c40> #<Tag:0x00007fc417288a88>

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’)

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).

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 (Github Link):

  name: Simple Time Monitored Switch (State Change Triggered)
  description: turn off an activated switch after a specific delay (hh:mm:ss)
  domain: automation

      name: Monitored Switch
      description: Switch to be monitored

          domain: switch

      name: Switch Off Delay
      description: Delay to switch off (hh-mm-ss)
      default: "00:15"

  platform: state
  entity_id: !input switch_target
  from: "off"
  to: "on"

  - 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”

This doesn’t work. The trigger upon automation creation expects another blueprint to run this ???
Disregard. Must have been something wonky in my HA, restarted and it seems to work :slight_smile: