· updated · By Daryn Leaity, who owns and runs Ecosmart
Switching a load in the lowest-priced hours with Home Assistant
Ecosmart's integration ships with Home Assistant from version 2026.11, released 4 November 2026. Here's an automation that uses it, together with the forecast sensors on our setup page, to switch a load such as a hot water cylinder on in the lowest-priced 90 minutes of the next 24 hours.
What this automation does
A hot water cylinder left to itself reheats whenever its thermostat calls for it, which is as likely to be the evening peak as any other time. With Home Assistant watching our wholesale price, you can make it wait instead: find the lowest-priced stretch of the next 24 hours that's long enough to do the job, and run the cylinder's relay then.
Ninety minutes is just the example here. A hot water cylinder, a pool pump or a battery charge cycle can usually be moved to any run of half hours that's low enough and long enough; the template below only needs you to say how many half hours you want.
A hot water cylinder is a good load to start with, because its own thermostat doesn't care when it runs, only that the water's hot by the time you need it.
What do I need besides the integration?
Add the Ecosmart integration from Home Assistant's Settings and paste in an API key, as our Home Assistant setup page walks through. For a window that looks ahead rather than just the price right this half hour, you also want the REST sensors on that same page, in particular the forecast sensor and its 90-minute window template.
On the hardware side: a smart relay wired into the cylinder's circuit, fitted by a licensed electrician, because that circuit is fixed wiring. A load that's already on a plug, such as a pump or a charger, just needs a smart plug.
The automation
This builds on the forecast sensor and its 90-minute window template from the setup page. Add one more template sensor that turns the start time into an on/off window, then two short automations that follow it:
template:
- binary_sensor:
- name: Hot water lowest-priced window
unique_id: ecos_hot_water_window
state: >
{% set start = states('sensor.cheapest_90_minutes') %}
{% if start in ['unknown', 'unavailable'] %}
off
{% else %}
{% set start_dt = start | as_datetime %}
{{ now() >= start_dt and now() < start_dt + timedelta(minutes=90) }}
{% endif %} automation:
- alias: Hot water cylinder on in the lowest-priced window
id: ecos_hot_water_on
trigger:
- trigger: state
entity_id: binary_sensor.hot_water_lowest_priced_window
to: "on"
action:
- action: switch.turn_on
target:
entity_id: switch.hot_water_cylinder
- alias: Hot water cylinder off after the lowest-priced window
id: ecos_hot_water_off
trigger:
- trigger: state
entity_id: binary_sensor.hot_water_lowest_priced_window
to: "off"
action:
- action: switch.turn_off
target:
entity_id: switch.hot_water_cylinder
Swap switch.hot_water_cylinder for whatever entity your relay or smart plug gives you. The
binary sensor only reads the forecast's own startsAt time, so it never assumes anything about
ecosmart.get_forecasts that Home Assistant hasn't written down.
Because the template compares against now(), Home Assistant re-checks it once a minute, which is
how the window switches off on time.
What if the price feed drops out?
If the forecast sensor can't get a value it can stand behind, the 90-minute window template reports unknown,
and the template above reads that as off rather than guessing a window. Off means the relay stays open, so the
cylinder doesn't heat at all until a window comes back. If you'd rather have hot water regardless, switch the
relay on yourself, or add a third automation that turns it on when the forecast sensor has been unavailable
for a few hours. The window also moves: the forecast reaches 24 hours ahead and refreshes every half hour, so
a lower-priced stretch that comes into view can replace the one you were waiting for. Check the cylinder's
temperature for the first week or two. Worth remembering either way: wholesale prices change
every half hour and are uncapped, so they can spike, which is exactly why it helps to have something watching
them rather than a fixed timer. Either automation only reacts when the binary sensor changes state, so
turning the switch on or off yourself at any other time still works; nothing here fights you outside the
window.
Wiring it to something
None of this turns anything on by itself until a relay or a smart plug sits between Home Assistant and the load. For a hot water cylinder that means a licensed electrician fitting a relay on its circuit; they'll also tell you if your particular cylinder and wiring suit it. A smart plug on a pump or a charger is a simpler job, but check the plug is rated for what you're switching.
Tell the electrician you want the relay ahead of the cylinder's own thermostat, not in place of it: the thermostat and its high-limit cut-out keep protecting the tank either way, and the relay only decides when that thermostat is allowed to call for heat in the first place.
Not set up with the integration yet? Start on the setup page, or read how Ecosmart ended up shipping with Home Assistant in the first place.
Home Assistant automation questions
Does the integration switch the load itself?
No. It publishes the wholesale price and the forecast; your own Home Assistant automation decides what to turn on. A relay on fixed wiring, such as a hot water cylinder, is fitted by a licensed electrician.
What happens if the price feed drops out?
The forecast sensor goes unavailable rather than hold a stale number, and the window built from it then reads as off, so the automation leaves the load off instead of guessing. For a hot water cylinder that means no heating until the forecast comes back, unless you switch it on yourself.
Can I use a different window length?
Yes. The template just adds up however many half-hour points you ask the forecast sensor for; change the count and the window's length changes with it.
How I worked this out
The version and date come from Home Assistant's 2026.11 release notes, published 4 November 2026, which list Ecosmart under new integrations.
Home Assistant's own integration page (home-assistant.io/integrations/ecosmart/, read 10 November 2026)
documents the Spot price sensor and that the ecosmart.get_forecasts action exists, but it
doesn't print the action's input fields or its response shape on that page - just a link to "examples,
parameters, and a step-by-step UI walkthrough" elsewhere. Rather than guess at a field nobody has written
down, this automation is built only from what our own setup page documents in full: the forecast REST
sensor's points attribute (each with a startsAt time and a price) and the
90-minute window template already shown there, which ranks three consecutive points and returns the first
one's start time.
The picture at the top is a drawn shape, not a measured price curve: it's there to show where a short, lowest-priced window sits inside a day's prices, not to state what any day actually looked like.