Skip to content

Automations ​

SpotNav ships three Home Assistant blueprints: ready-made automations that use SpotNav's electricity price and a site's solar surplus for the rest of the house. SpotNav installs them itself; you make as many automations from each as you like, each with its own entities.

BlueprintWhat it does
Setpoint by electricity priceFloor heating, radiators or a heat pump get a higher temperature when electricity is cheap and a lower one when it is expensive.
Run on solar surplusA pool heater, water heater or immersion heater is switched on when the sun gives a surplus.
Relay by electricity priceA relay on a heat pump's input lowers the heating curve while electricity is expensive, starts extra hot water when it is cheap, or sets SG Ready.

SpotNav keeps them up to date ​

Each time Home Assistant starts, SpotNav copies its blueprints to the folder blueprints/automation/spotnav/ in your configuration, writing a file only when it is missing or differs from the one SpotNav ships. An update of SpotNav that changes a blueprint therefore replaces it at the next start, and automations made from it are reloaded so they run the new version. Your automations themselves, their chosen entities and values, and every other folder are left alone.

A blueprint you edit is kept. SpotNav remembers what it wrote, and a file you changed is left as it is and no longer updated (the Home Assistant log says so at each start). To get SpotNav's version again, delete the file and restart Home Assistant. To keep both, copy the file to another folder, for example blueprints/automation/mine/, and change the copy. The first lines of each file say the same.

Making an automation from one ​

In Home Assistant, go to Settings, Automations & scenes, Blueprints, choose one of the SpotNav: blueprints and Create automation, pick your entities and save. As an administrator you can also start from the card: Settings, Support, Automations lists them all, with how many automations already use each (which opens those automations), and Create automation opens the Blueprints page. Home Assistant has no link that opens a new automation from a given blueprint, so the last step, Create automation on the blueprint, is taken there.

Automations in the card's Settings: the blueprints, how many automations use each, and Create automation

On a Home Assistant without SpotNav, or to fetch one by hand, the buttons below import a blueprint from this repository's main branch through my.home-assistant.io. With SpotNav installed you do not need them.

Setpoint by electricity price ​

Open your Home Assistant instance and show the blueprint import dialog with this blueprint filled in.

Sets one or more thermostats from the electricity price's Cheap now and Expensive now sensors. The temperature is chosen in this order, the first that applies:

  1. Away: the away entity is in its away state → the away temperature.
  2. Price now is above the max price → the expensive temperature.
  3. Cheap now is on → the cheap temperature.
  4. Expensive now is on → the expensive temperature.
  5. Otherwise → the normal temperature.

It runs when one of these sensors changes, when Home Assistant starts and at a regular interval. A thermostat is written only when its setpoint differs, one that is unavailable is skipped, and one that cannot be set does not stop the others. A setpoint you change by hand lasts until the next run, at most the interval.

InputDefault
ThermostatsClimate entities, one or more.
Cheap now, Expensive nowThe electricity price's binary sensors, for example binary_sensor.electricity_price_se4_cheap_now. How many hours count as cheap or expensive is the price's own Cheap hours per day and Expensive hours per day (how they are chosen).
Price nowThe electricity price's sensor.electricity_price_se4_price_now, with fees and VAT.
Max price0 (off)Above this price per kWh, in the unit of Price now, the expensive temperature is used whatever the hours say.
Cheap, Normal, Expensive temperature21, 19, 17 °C
Away entity, Away state, Away temperaturenone, armed_away, 17 °COptional. Any entity: an alarm panel (armed_away), a person or a group (not_home), an input boolean (on).
Also run every15 minutes5, 15 or 30 minutes, or once an hour.

Example: floor heating in SE4 ​

Three floor-heating thermostats (climate.hall, climate.bathroom, climate.kitchen) and an alarm panel (alarm_control_panel.home):

  • Thermostats: the three; Cheap now, Expensive now and Price now: the SE4 electricity price's.
  • Cheap 21 °C, Normal 19 °C, Expensive 17 °C.
  • Max price 1.5 (kr/kWh): on a day when even the ordinary hours cost more than that, the floors keep to 17 °C.
  • Away entity alarm_control_panel.home, Away state armed_away, Away temperature 17 °C.
  • Also run every 15 minutes.

With the electricity price's default 6 cheap and 4 expensive hours a day, the floors store heat in the cheapest quarter of the day and coast through the most expensive hours. Floor heating in a concrete slab is slow, so a difference of two degrees either way is felt little; radiators react faster and suit a smaller difference.

Heat pumps ​

Give a heat pump a lower or higher setpoint with this blueprint; do not switch it on and off. A heat pump that is started and stopped by the hour wears its compressor and runs less efficiently than one that is allowed to modulate.

Run on solar surplus ​

Open your Home Assistant instance and show the blueprint import dialog with this blueprint filled in.

Switches a load on and off from a SpotNav site's Solar surplus sensor (see Site and load balancing), so it needs a site whose solar surplus can be measured. It is switched on when the surplus is at or above the on threshold and off when it is at or below the off threshold. The surplus is never below zero: 0 means the site takes power from the grid. A minimum on time and a minimum off time keep it from switching back and forth when a cloud passes. It runs when the surplus changes, every 5 minutes and when Home Assistant starts; it does nothing while the surplus is unknown or the load is unavailable.

InputDefault
Solar surplusThe site's sensor, for example sensor.home_solar_surplus (W).
LoadA switch, an input boolean, or a climate entity (turned on and off).
On at surplus3 kWAbout the load's own power, so that it runs on the sun and not on the grid.
Off at surplus0 kW0 switches off as soon as the site takes power from the grid; a little above 0 keeps a margin.
Minimum on time, Minimum off time10 and 5 minutes
Window starts, Window ends00:00, 00:00 (no window)With a window the load is only switched on inside it, and switched off at its end.
Also on while cheapnoneOptional: the price device's Cheap now sensor, for example binary_sensor.electricity_price_se4_cheap_now. See below.
Allowed when onnoneOptional input boolean or switch: while it is off nothing is done, so you can run the load by hand.

With Also on while cheap set, the load is switched on when the surplus is at or above the on threshold or Cheap now is on, and switched off only when the surplus is at or below the off threshold and Cheap now is off. That lets one automation, and one relay, serve both reasons, for example a heat pump's low-price input that should close on solar surplus or in the cheap hours. The minimum on and off times, the window and the allowed entity apply to both reasons alike: a cheap hour outside the window does not switch the load on, and the window's end still switches it off. Left empty, the blueprint runs on surplus only, as before.

SpotNav counts what its own chargers draw as part of the surplus, so a load run by this blueprint comes before a car that charges on Solar: the car's current goes down when the load starts. Use a window, or the allowed entity, when the car should have the sun first.

Water heaters and legionella ​

A water heater or an immersion heater that only runs on the sun can stand lukewarm for days. Keep the heater's own thermostat at 60 °C or more, so the water is heated through when it runs, and let it also heat from the grid at least once a week if the sun does not reach 60 °C. This blueprint does not see to that; it only switches the power on and off.

Relay by electricity price ​

Open your Home Assistant instance and show the blueprint import dialog with this blueprint filled in.

Many heat pumps and water heaters have potential-free inputs: contacts that do something when they are closed. This blueprint closes a relay (a Shelly or any other switch in Home Assistant) on such an input from the electricity price's Cheap now and Expensive now sensors. An electrician connects the relay inside the heat pump; the heat pump's manual says which input does what and how it is set up. It has three modes.

Closed while expensive. The relay is closed while Expensive now is on and opened as soon as it ends, for an input that lowers the heating curve or blocks an add-on heater. This is the fallback for a heat pump that cannot be reached over the network: a pump with an integration in Home Assistant, such as a NIBE S1255 through nibe_heatpump, is better controlled by SpotNav's own heat plan, which writes SG Ready or the curve offset through the integration and raises as well as lowers (see Heat pumps). On a pump without one, a closed contact that shifts the heating curve by a set number of steps, as many NIBE models have, makes the house run a little cooler through the expensive hours. With quarter-hour prices Expensive now can be on for a single quarter; the shortest closing (45 minutes) keeps such a blip from closing the relay: it closes only when the expensive stretch ahead, read from Expensive now's next_change, lasts at least that long, and then stays closed until Expensive now ends (or a limit below opens it). Set it to 0 to close at once. Three limits keep the house warm:

  • it is closed for at most the longest closed time in a row (3 hours), then opened,
  • it then stays open for at least the shortest rest (1 hour) before it may close again, also between two expensive spells,
  • with an outdoor temperature sensor, it is never closed while it is below the lowest outdoor temperature (-15 °C), and opened if it gets colder while closed. While the sensor has no reading it is not closed either.

Pulse when cheap. A short pulse (2 seconds) when Cheap now comes on, for an input that starts extra hot water. On many NIBE models, a pulse of at least 1 second on the extra hot water input starts "temporary extra hot water" for 3 hours; a NIBE with nibe_heatpump can instead be asked for temporary lux through the integration, see Hot water. The day is split into as many equal parts as pulses per day (1), with at most one pulse in each, and never within the shortest time between pulses (3 hours) of the last. With one pulse a day it comes when the first cheap hours of the day start; set the electricity price's Cheap hours per day to 1 to have only the day's cheapest hour.

SG Ready (two relays). SG Ready heat pumps have two inputs that together give four states. Relay A goes on the first input and relay B on the second:

ABSG Ready stateWhen
closedopenBlockedExpensive now is on, with the same three limits as closed while expensive.
openopenNormalNeither, or expensive while a limit holds the block back.
openclosedRecommended raiseCheap now is on.
closedclosedForced raiseNever: a relay is always opened before the other is closed.

It runs when the price sensors change, when a limit runs out, every 5 minutes, and when Home Assistant starts or automations are reloaded, and each time sets the relays the price calls for: after a restart a relay is never left closed when it should be open. The time limits count from when this automation last switched the relays, which Home Assistant keeps over a restart. While a relay is unavailable nothing is done. A relay closed by hand is opened at the next run when the price does not call for it, and also while Expensive now is on once it has been closed longer than the longest closed time (counted from this automation's last switching when that is earlier).

InputDefault
ModeClosed while expensiveClosed while expensive, pulse when cheap, or SG Ready.
Relay (A)The switch that closes the contact; for SG Ready, relay A.
Relay BnoneSG Ready only.
Cheap now, Expensive nowThe electricity price's binary sensors, for example binary_sensor.electricity_price_se4_cheap_now.
Longest closed time in a row, Shortest rest3 h, 1 hClosed while expensive and SG Ready's blocked state.
Shortest closing45 minClosed while expensive and SG Ready's blocked state; 0 turns it off.
Outdoor temperature, Lowest outdoor temperaturenone, -15 °COptional.
Pulse length, Pulses per day, Shortest time between pulses2 s, 1, 3 hPulse when cheap.

A heat pump that only needs a lower or higher temperature is better served by Setpoint by electricity price, when it can be set from Home Assistant.

Sensnology AB. No accounts, no analytics, no tracking.