LW IT Solutions logo LW IT Solutions logo LW IT Solutions
« Blog Overview /Smart Home / PV Surplus Control: Hysteresis, Timers and Thresholds...
Read this article in other languages:

PV Surplus Control: Hysteresis, Timers and Thresholds for Switching Loads

PV Surplus Control: Hysteresis, Timers and Thresholds for Switching Loads

Jump to the interactive example ↓

Find the bug ↓

Contents
  1. Define the measured quantity first
  2. Use different conditions in the OFF and ON states
  3. Four timers have different jobs
  4. Fresh data and confirmed actions
  5. Batteries and charging points
  6. Questions and answers
  7. Sources

A surplus rule can oscillate if the same threshold both starts and stops a load. With 2200 W exported, a 2000 W heater leaves only 200 W at the grid connection. A rule that immediately stops below 2200 W then turns the heater off again. This happens under those conditions; it is not inevitable for every simple automation.

Illustrative state-based rule for a fixed 2000 W load; equipment protection takes priority.
Illustrative state-based rule for a fixed 2000 W load; equipment protection takes priority.

Define the measured quantity first

Here, S means net export at the grid connection: export is positive and import negative. This is a chosen sign convention, not a universal meter convention. Other integrations report positive import. Inverter production alone is insufficient because household loads and battery flows also affect the remaining power. The value must be a current power measurement in watts, not accumulated import/export energy in kilowatt-hours.

Two accumulated energy counters can both increase during a reporting interval. Per-phase import and export can also coexist. The controller therefore needs the intended net measurement, correct signs and known phase aggregation. At zero-export installations, a near-zero grid reading can conceal curtailed generation; the simple rule below does not estimate that available headroom.

Use different conditions in the OFF and ON states

The following values illustrate a fixed 2000 W resistive load. They are not universal equipment settings. A normal start requires S ≥ 2200 W continuously for three minutes and at least ten minutes since the last stop. A normal stop requires S ≤ −200 W continuously for five minutes and at least fifteen minutes since the last start. Leaving a threshold condition resets its corresponding qualification timer.

OFF + start condition qualified + minimum pause complete → ON
ON  + stop condition qualified  + minimum runtime complete → OFF
Otherwise retain the confirmed state.

Before start:  S = 2200 W
After start:   S = 2200 − 2000 = 200 W
Stop test:    200 ≤ −200 is false
Threshold separation: 2200 − (−200) = 2400 W

For this uncompensated measurement and inclusive comparisons, the separation must exceed the actual load step to avoid switching directly across the opposite boundary at the start point. Equality can still reach the stop threshold. Variable power, measurement error and other loads require margin. A controller that explicitly compensates for its own load uses a different model; the same rule cannot be imposed on every control architecture.

Four timers have different jobs

  • Start delay filters short periods of sufficient surplus.
  • Stop delay tolerates brief deficits.
  • Minimum runtime restricts normal stopping after a start.
  • Minimum pause restricts restarting after a stop.

A stop delay is not the maximum possible import duration when minimum runtime also applies. If solar power disappears immediately after starting, the illustrative 15-minute runtime can import up to 0.5 kWh for the 2 kW load alone. The acceptable trade-off depends on actual purchase and export tariffs, thermal demand and equipment requirements; no universal price ratio determines the answer.

Temperature limits, electrical protection and device fault responses take priority over these economic timers. Heating equipment needs its specified independent protection. Heat pumps should use the manufacturer’s permitted control interface and timing requirements; an illustrative heater rule is not authorization to interrupt compressor mains power.

Fresh data and confirmed actions

Polling faster than a meter updates does not create new measurements. Record sample timestamps and reject stale or invalid values. A short average can reduce noise but also delay a response; the window must match the source update rate. Averaging does not remove the load’s permanent change to the measured balance.

A command is not proof that a relay changed state. Use suitable feedback, bound retries and define the device-appropriate response to lost data or communication. On restart, reconcile actual state and timing records before resuming. Home Assistant’s trigger waiting periods using for do not survive restart or automation reload; a durable deadline and startup reconciliation may be required.

Batteries and charging points

A battery can absorb surplus or hide a deficit by discharging. A state-of-charge threshold alone does not prevent discharge into the controlled load. Coordinated power limits, measured battery flow or a supported discharge lock may be needed. Battery priority does not mean another load can never run: a full battery or limited charging power can leave surplus. Conversion losses depend on the system and operating point.

For common AC charging with a 6 A minimum at nominal 230 V, the minimum is about 1.38 kW per used phase: 1.38, 2.76 or 4.14 kW for one, two or three phases. Vehicle, charger and communication capabilities matter. These are charging-power figures, not compulsory surplus thresholds: deliberately permitted grid or battery support can cover a shortfall. A one-to-three-phase change at the same 6 A changes power by 2.76 kW; it is not always that step when current changes too. Phase switching requires compatible equipment and its supported interruption sequence.

Questions and answers

Are staggered delays enough for several loads?

Different delays can help, but do not guarantee coordination after delayed commands, restarts or stale readings. A common scheduler can reserve the power for a pending start, confirm the resulting state and measurement, then consider another load. Priorities and stopping order need to respect each device’s constraints.

Can timing predict contactor life?

No. Fifteen minutes ON plus ten minutes OFF give a 25-minute complete cycle, or 2.4 cycles per hour as a long-run rate. A particular one-hour window can contain more start instants because of its boundaries. A cycle is not automatically two manufacturer-rated operations: the datasheet’s definition governs. Mechanical endurance is measured without load; electrical endurance depends on load category, current and voltage. A quoted count does not establish a failure date or guarantee against welded contacts.

What should commissioning demonstrate?

Correct meter signs, no immediate self-induced stop, timer reset after an interrupted condition, minimum pause, stale-data handling, failed switching, restart recovery and coordination with the battery and other loads. The example explains control logic; actual protection and switching hardware must satisfy the installation and equipment requirements.

Sources

Learn by trying

Why does the relay switch so often?

One sequence, two rules: compare a single threshold with separate on and off thresholds. Adjust the gap and count the state changes.

Changes with one threshold
Changes with two thresholds
Eleven readings in time order
ReadingOne thresholdTwo thresholds

Both start off. One threshold: on at or above the on threshold, otherwise off. Two thresholds: on at or above the on threshold, off only below the off threshold; between them, keep the previous state. Fixed readings before the switched load consumes power. No feedback, minimum run time, measurement errors or delays simulated. This shows state logic, not a complete PV controller.

This module runs in your browser and does not send or store your input.

Reference ↗

Learn by trying

One minute: can you spot the mistake?

On at 2,000 W, off below 1,500 W. The relay is already on; the next reading is 1,800 W. What happens in this model?

Reference ↗

Find the bug

Explore

Find the bug

A problem, two clues and your decision. Examine the clues first, then see what your fix changes.

  1. The problem
  2. Examine the clues
  3. Test a fix

Read the related article →

PNG with settings, result and article link. Created locally only when you click.

These exercises calculate in your browser. The learning module does not send your answers.

Explore more experiments →

Terms you can try

Explore

Terms you can try

A short explanation and a small experiment make each term easier to understand.

Hysteresis

Switching on and off use different thresholds. Between them, the previous state is retained.

Read the related article →

Quick explanation

Read the related article →

These exercises calculate in your browser. The learning module does not send your answers.

Explore more experiments →

Your learning path →

Lukas Wojcik

Lukas Wojcik

Systems architect and technology enthusiast specializing in scalable tracking solutions, GMP Stack (GA4 & GTM), and robust backend architectures. Advocate for clean code and privacy-first design.

Get in touch

A question or an idea for a web project? Tell me a little about it. This form uses reCAPTCHA to protect against spam.

Write a comment

Experience with other devices or integrations and questions about the setup are welcome here.

The email address is not published. Required fields are marked with an asterisk.