---
title: "Morning warm-up made to measure: the bedroom is warm exactly when we get up, not all night"
description: "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."
canonical: "https://realhomeautomations.com/en/projects/bedroom-morning-warm-up-by-measurement/"
language: en-US
updated: 2026-11-25T15:20:16+00:00
---

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

> Canonical HTML page: https://realhomeautomations.com/en/projects/bedroom-morning-warm-up-by-measurement/

- **Difficulty:** Intermediate
- **Build time:** 60–90 minutes
- **Reading time:** 4 minutes

## Tools required

- Home Assistant
- Smart plug (Sonoff S60ZBTPF 16 A)
- Temperature sensor (Sonoff SNZB-02P, Zigbee)
- Electric heater (not sold by us)
- Zigbee hub or adapter (or Home Assistant with a Zigbee adapter; not included in the product)


## What readers will learn

- Work out when to start the heater
- Measure the room's heating speed
- Keep the heater from running without end


## Skill requirements

- Create helper values in Home Assistant
- Place YAML with a template into an automation

## Project kit

- [Sonoff S60ZBTPF Zigbee Smart Plug](https://realhomeautomations.com/en/product/sonoff-s60zbtpf-zigbee-smart-plug/index.md)

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

- [Sonoff S60ZBTPF 16 A Zigbee smart plug](https://realhomeautomations.com/bg/produkt/sonoff-s60zbtpf-zigbee-smart-plug/) with power metering: one for the heater.
- [Sonoff SNZB-02P temperature sensor](https://realhomeautomations.com/bg/produkt/temperature-and-humidity-sensor-sonoff-zigbee-snzb-02p/): one in the bedroom.
- An electric heater. We don't sell it.
- Home Assistant.

 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

- **Create the helper values.** Settings → Devices &amp; 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.
- **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`.
- **Create the automation.** Settings → Automations &amp; 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.

- **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](https://realhomeautomations.com/bg/projects/nagrevatel-zabraven-vklyuchen-spira-se-sam-sled-60-minuti-i-izvestyava/) 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.

- [Home Assistant: automations, triggers (template)](https://www.home-assistant.io/docs/automation/trigger/), 22.11.2026
- [Home Assistant: Input datetime](https://www.home-assistant.io/integrations/input_datetime/), 22.11.2026
- [Home Assistant: Input number](https://www.home-assistant.io/integrations/input_number/), 22.11.2026
- Real Home Automations catalogue: Sonoff S60ZBTPF and SNZB-02P, 22.11.2026