Timed smart plugs

A simple blueprint to automatically turn off a smart plug after a certain amount of time, useful for Christmas trees or the alikes

Requires any sort of smart plug under the switch domain (works with any switch really)

Edit: fixed the delay from seconds to minutes

blueprint:
  name: Timed Smart Plugs
  description: Turn off smart plugs after a certain amount of time
  domain: automation
  input:
    smart_plug:
      name: Smart Plug
      selector:
        entity:
          domain: switch
    off_delay:
      name: Wait time
      description: Time to leave the plug on
      default: 30
      selector:
        number:
          min: 1
          max: 1440
          unit_of_measurement: minutes

mode: restart
max_exceeded: silent

trigger:
  platform: state
  from: "off"
  to: "on"
  entity_id: !input smart_plug

action:
  - delay: 
      minutes: !input off_delay
  - service: switch.turn_off
    entity_id: !input smart_plug
4 Likes

Thanks!

FYI, I have used a similar ‘smart app’ called “Smart Lighting” for Samsung SmartThings Classic.

This same automation is still available as “Smart Lights Automation” in SmartApps marketplace:

Got a few tips on ideas on what to use it for as I have personally primarly used it with a smart plug for:

  1. Coffee Machine (to always turn off after 60-minutes after turning on).
  2. Electric Kettle (to always turn off after 60-minutes after turning on).
  3. Cars engine heater / car pre-heater (to always turn off after 180-minutes after turning on).
  4. Bathroom fan to activate extra boost when showering (turn off after 10-minutes after turning on).

I believe that the ST action called in “Smart Lights Automation” app is now called “Power Allowance”.

Hello, I tried to add your blueprint but got an error instead:

Logger: homeassistant.components.automation
Source: components/automation/init.py:517
Integration: Automation (documentation, issues)
First occurred: 15:36:43 (1 occurrences)
Last logged: 15:36:43

Blueprint Timed Smart Plugs generated invalid automation with inputs OrderedDict([(‘off_delay’, ‘240’), (‘smart_plug’, ‘switch.065834582462ab43a2c4’)]): extra keys not allowed @ data[‘action’][0][‘minutes’]. Got None

Messed up the indentation, now it’s fixed
Thanks for the heads up

1 Like

Any way to make it do 1 min 30 sec? need it for my coffee grinder :smile: