4 min read

Morning warm-up made to measure: the bedroom is warm exactly when we get up, not all night

A heater on a smart plug that starts before the wake-up time depending on how cold the room is and how fast it warms up. It stops when the target is reached or shortly after the set time.

Level
Intermediate
Active time
60–90 minutes
Home Assistant required
Yes

You don’t want the heater running all night, but you also don’t want to get up into a cold bedroom. Here is an automation that starts it only as early as needed: depending on how cold it is and how fast the room warms up.

What you will get

A heater on a smart plug that starts before the wake-up time, so that the room is warm by that time. It stops when the room reaches the target or shortly after the wake-up time. The calculation uses one value that you measure: how many minutes it takes to rise by 1 °C.

What we need

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

  • Setup time: about 60 minutes, plus a few mornings of observation.
  • Skills: you add devices and paste YAML.

How it works

Three values make the decision: the wake-up time, the target temperature and the heating speed (minutes per degree). The needed lead time is (target − now) × minutes per degree. The heater starts when the current time is later than wake-up time − needed time.

The speed is different for every room and heater. So we don’t guess it: run the heater once and measure how long it took for 1 °C.

Steps

  1. Create the helper values. Settings → Devices & services → Helpers: Date and/or time (time only) input_datetime.wake_up; Number input_number.bedroom_target (min 16, max 24, step 0.5); Number input_number.minutes_per_degree (min 1, max 60); Toggle input_boolean.morning_warmup. The names are examples.
  2. Measure the speed. One evening put the heater on the plug, note the temperature and how many minutes it takes for 1 °C. Write the value in minutes_per_degree.
  3. Create the automation. Settings → Automations & scenes → Create automation → Edit in YAML. All names are examples.
alias: "Bedroom: morning warm-up"
mode: single
triggers:
  - trigger: template
    value_template: >
      {% set t = states('sensor.bedroom_temperature') %}
      {% if not is_number(t) %}
        false
      {% else %}
        {% set wake = today_at(states('input_datetime.wake_up')) %}
        {% set need = [(states('input_number.bedroom_target')|float - t|float), 0] | max
                      * states('input_number.minutes_per_degree')|float %}
        {% set need = [need, 120] | min %}
        {{ now() >= wake - timedelta(minutes=need) and now() < wake }}
      {% endif %}
conditions:
  - condition: state
    entity_id: input_boolean.morning_warmup
    state: "on"
actions:
  - action: switch.turn_on
    target:
      entity_id: switch.bedroom_heater_plug
  - wait_template: >
      {{ states('sensor.bedroom_temperature')|float(0) >= states('input_number.bedroom_target')|float(0)
         or now() >= today_at(states('input_datetime.wake_up')) + timedelta(minutes=30) }}
    timeout: "02:00:00"
    continue_on_timeout: true
  - action: switch.turn_off
    target:
      entity_id: switch.bedroom_heater_plug

The needed time is capped at 120 minutes. If the sensor has no value, the template is “false” and the heater doesn’t start.

  1. Turn on the switch. input_boolean.morning_warmup is the master switch for the automation: that way you easily stop the warm-up on days when it isn’t needed.

Checking the result

  • A normal morning. The heater starts before the wake-up time and switches off when the target is reached or 30 minutes after the time.
  • A warm room. If the room has reached the target, the needed time is zero and the heater doesn’t start.
  • A sensor with no value. Take the sensor’s battery out: the heater doesn’t start.
  • Power. With the heater on, look at the W in Home Assistant.

If it doesn’t work

  • It starts too late. minutes_per_degree is too small. Measure again.
  • It starts too early. The value is too large or the target is high.
  • It doesn’t start. The sensor status is unavailable, the switch is off or the wake-up time has already passed.
  • It stays on. The automation was interrupted, for example by a Home Assistant restart. See the project A heater left on for a second safeguard.

Limitations and switching off

  • The automation doesn’t know whether there is a person in the room.
  • If Home Assistant restarts during warm-up, the wait is lost and the heater may stay on. Add the second safeguard.
  • The speed depends on the outside temperature: it is different in winter and in spring. Repeat the measurement seasonally.
  • Switching off: turn off input_boolean.morning_warmup and unplug the plug.

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.