Home Assistant and heating: when is electricity, gas or a heat pump cheaper?
When a home has several heat sources, the cheapest option is not always obvious.
Electricity and gas prices must be converted into the cost of useful heat, taking appliance efficiency and the heat pump’s changing COP into account.
Home Assistant can combine prices, temperatures, equipment state, solar production and battery data to help choose the better source at a given time.
Compare the cost of heat, not just the energy price
A resistive heater provides roughly 1 kWh of heat from 1 kWh of electricity. A heat pump can deliver more, depending on COP. A boiler does not convert all fuel energy into useful heat.
The meaningful comparison is therefore the cost of delivering the same amount of useful heat.
Electric resistance heating
Resistance heating is easy to understand and highly efficient at the point of use, but it can be expensive when electricity prices are high.
The economics change with low prices, surplus solar or energy that would otherwise be exported for less value.
Gas boiler
Gas calculations require the fuel price, billing method and boiler efficiency. Actual efficiency depends on the appliance, system temperatures and operation.
Home Assistant should not assume one universal efficiency. The input must suit the specific installation.
Heat pump and COP
COP is the ratio of delivered heat to consumed electricity. At a COP of 3, a simplified calculation gives about 3 kWh of heat from 1 kWh of electricity.
COP is not constant. Outdoor temperature, required flow temperature and operating conditions all affect it.
Dynamic energy prices
When electricity prices change during the day, the preferred heat source may change too. Gas may be cheaper at one time, while a heat pump or heater may win several hours later.
Home Assistant can use current prices or a price schedule when suitable data is available.
Solar changes the calculation
Surplus solar may have a different value from grid electricity. A comparison can include production, household load, import, export, purchase price and export compensation.
Billing rules vary. See Energy in Home Assistant: electricity, solar, battery and costs for the underlying data.
A buffer tank stores heat
A buffer separates when heat is produced from when it is used. Cheap electricity or surplus solar can be stored as heat when the system safely permits it.
Control may consider upper and lower tank temperatures, demand and safety limits. Suitable temperature ranges depend on the installation.
Domestic hot water cylinder
Water heating can be shifted toward low-price or high-solar periods when a safe control method is available.
Automation must follow hygiene requirements, manufacturer guidance, local rules and safe temperatures.
Home battery
A full battery and strong solar production may favour a flexible heating load. At a low state of charge, stored energy may be more valuable elsewhere.
Charge, discharge and priority control are not available in every installation.
Home Assistant can consider several variables
A considered strategy may analyse electricity and gas prices, current or estimated COP, outdoor and buffer temperatures, heat demand, solar production, grid flows, battery state and time of day.
The right decision always depends on the home’s context.
Can Home Assistant switch heat sources?
Yes, when equipment exposes a safe supported control method, such as a climate entity, dedicated integration or approved control input.
Cutting power is not suitable for every heat source. Boilers and heat pumps may require compressor protection, pump overrun, minimum run times and internal control logic.
A relay is not always the right solution
Shelly and other modules can control suitable loads or control signals, but disconnecting voltage is not correct for every appliance.
The method must follow the wiring diagram, permitted inputs and electrical load. Work on 230/400 V systems requires the appropriate competence and compliance.
Hysteresis and minimum run time
The system should not switch sources every few minutes because of a temporary price or sensor change.
Hysteresis, minimum run and stop times, delays and anti-cycling protection may be required. Values depend on the equipment.
Comfort matters as much as price
The lowest cost cannot be the only objective. The system must maintain room temperature and hot-water availability.
Preheating with cheaper energy only makes sense within comfort and safe operating limits.
When does this control make the most sense?
The greatest potential exists with multiple heat sources, variable prices, solar, thermal storage and devices that provide reliable data and control.
The less information and control available, the simpler and more conservative the automation should be.
Where should you start?
First identify the heat sources, their control methods and states, actual energy prices, boiler efficiency, heat-pump COP, available temperatures and any solar, battery or buffer.
Only then should the source-selection logic be designed.
Need help optimising heating?
If you have several heat sources, solar, a buffer, heat pump, gas boiler or dynamic prices, I can assess the available data and control options.
I can also design Home Assistant logic around costs, temperatures, solar production and the conditions of your installation.
Contact me.The initial assessment of your request is free and without obligation. → click hereSources and currency
Checked on 13 August 2026 against current materials:
