4 min read

A heater left on: it switches itself off after 60 minutes and notifies you

A smart plug and two automations in Home Assistant switch the heater off after an hour, guard against a restart and notify you if the plug loses its connection. Before that, compare the power of the heater with the plug.

Level
Beginner
Active time
20–30 minutes
Home Assistant required
Yes

You go out and the heater has been left on. This project switches it off by itself after 60 minutes and sends you a notification.

What you will get

A heater on a smart plug that switches off automatically after one hour and notifies you. A notification also comes if the plug loses its connection while the heater is on: then Home Assistant can’t switch it off and you have to do it by hand.

What we need

You need a Zigbee hub or Home Assistant with a Zigbee adapter.

  • Setup time: about 20–30 minutes.
  • Skills: you paste YAML into automations.

How it works

Two automations. The first watches the plug: if it is on for 60 minutes without interruption, it switches it off and sends you a notification. The second guards against cases where the first doesn’t help: after a Home Assistant restart it doesn’t know how long the heater has been on, so it switches the plug off if it stayed on. And it notifies you if the plug has been unavailable for five minutes while it was on.

Simeon uses the same 60 minutes for his heater: a safety automation switches it off after 60 minutes of running and sends a notification.

Steps

  1. Find the plug. In Settings → Devices & services copy the switch.… for the plug (example: switch.heater_plug). Check that you can switch it on and off from Home Assistant.
  2. First automation. Edit in YAML.
alias: "Heater: switch off after 60 minutes"
mode: single
triggers:
  - trigger: state
    entity_id: switch.heater_plug
    to: "on"
    for: "01:00:00"
actions:
  - action: switch.turn_off
    target:
      entity_id: switch.heater_plug
  - action: notify.mobile_app_telefon
    data:
      title: "The heater is switched off"
      message: "It was on for 60 minutes and we switched it off."
  1. Second automation.
alias: "Heater: protection on restart and lost connection"
mode: single
triggers:
  - trigger: homeassistant
    event: start
    id: restart
  - trigger: state
    entity_id: switch.heater_plug
    to: "unavailable"
    for: "00:05:00"
    id: offline
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: restart
          - condition: state
            entity_id: switch.heater_plug
            state: "on"
        sequence:
          - action: switch.turn_off
            target:
              entity_id: switch.heater_plug
          - action: notify.mobile_app_telefon
            data:
              message: "Home Assistant restarted: the heater was switched off."
      - conditions:
          - condition: trigger
            id: offline
        sequence:
          - action: notify.mobile_app_telefon
            data:
              message: "The heater's plug is unavailable. Check it by hand."

switch.heater_plug, notify.mobile_app_telefon and 60 minutes are examples. If the heater had a reason to run longer, increase “01:00:00”.

Checking the result

  • Normal. Switch the heater on: after 60 minutes the plug is off, a notification.
  • Quick test. Change “01:00:00” to “00:00:30”, check and change it back.
  • Lost connection. When the plug stays unavailable for five minutes: a notification.

If it doesn’t work

  • It doesn’t switch off. Home Assistant has restarted: the second automation is for that. Check the Traces too.
  • It switches off earlier. Another automation or a manual switch-off. The timer is interrupted on off.
  • The notification doesn’t come. The notification service is wrong.
  • It starts at every switch-on. That is expected: the hour counts from the last switch-on.

Limitations and switching off

  • If the plug is unavailable, Home Assistant can’t switch it off. That is what the notification is for.
  • Switching off: switch off the two automations; the plug stays an ordinary one.

Sources and verification status

The material follows the Home Assistant documentation, read on 22.11.2026. The topic is from Simeon’s list of ideas.

Need a hand?

We can set up and install everything in this project. In some regions we install it ourselves — ask us.

Contact us

Related projects

Sonoff S60ZBTPF Zigbee Smart Plug

16,90 €
View parts

What you need

Requires a Zigbee hub or Home Assistant with a Zigbee adapter.

Added to cart

Real Home Automations

Sign in to your account

With a code sent to your email

Continue with Google
or

By continuing, you accept the Terms and Conditions and the Privacy Policy.