Beyond the dashboard
You've built the hardware. You've watched the numbers. Now it's time to close the loop — a prediction and optimization layer that turns your solar + battery system into an active participant in the energy market.
Scroll to explore
Home Assistant gives you a perfect rear-view mirror. Amber gives you a price signal. But combining them into a forward-looking decision — factoring in tomorrow's weather, tonight's load, and next hour's spot price — still happens in your head. That's the gap.
// Current reality — manual mental model
+ Amber forecast + Battery SOC + Yesterday's load + Today's feeling
// Target — model predictive control loop
every 5–30 min · 48h horizon · re-plans as reality updates
Four distinct data streams, each answering a different question. The system is only as good as the quality of each input — and how intelligently they're combined.
Input 01
Bureau of Meteorology gridded data gives cloud cover, humidity, and temperature forecasts hours ahead. This is the raw material for predicting how much solar energy you'll generate — before it happens. BoM provides the macro picture; your local station provides the micro correction.
Input 02
BoM forecasts are made for grid squares kilometers wide. Your roof is one point. A local station — with pyranometer, temperature, and humidity sensors — gives you ground-truth irradiance right now. When reality diverges from the forecast, the station catches it first and corrects the model in real time.
Input 03
Amber Energy exposes 5-minute AEMO spot prices and 30-minute ahead forecasts via API. Prices can range from negative (grid pays you to consume) to thousands of dollars per MWh during peak events. This is the economic signal the optimizer is maximizing — it's what turns your battery from a convenience into an asset.
Input 04
Your inverter knows the truth: current state of charge, charge/discharge rates, current PV output, home load draw. This ground-truth state is the anchor for every planning cycle — the optimizer starts from where you actually are, not where you expected to be. Historical load data here also trains the home consumption predictor.
Raw data from four sources doesn't automatically combine into useful predictions. Sensor fusion is the discipline of intelligently blending multiple noisy, uncertain signals into a single more accurate estimate. This is where a weather station earns its keep.
Algorithm 01
The classical approach. Continuously blends a model prediction with a new measurement, weighted by confidence in each. If BoM says 600 W/m² but your station is reading 400 W/m², the filter smoothly reconciles them — trusting whichever has lower recent error. Gets smarter the longer it runs, as it builds a history of who was right more often.
Algorithm 02
Start with a prior belief (BoM forecast), then update it as evidence arrives (local sensor readings). The update is proportional to how surprising the evidence is. A completely unexpected overcast morning triggers a large revision; a minor discrepancy causes a small one. Naturally handles uncertainty as a first-class concept.
Algorithm 03
Simpler than Kalman, often good enough. Low-pass filter on the slow-moving forecast data; high-pass filter on the fast-reacting local sensor. Combine them in frequency space. Great for catching rapid cloud transients that BoM's coarse model will always miss — your station sees the shadow, the filter reacts immediately.
Algorithm 04
Run multiple forecasting models in parallel (e.g. a physics model, a statistical model, a neural net) and combine their outputs weighted by recent accuracy. When one model has been consistently wrong this week, reduce its weight. When a novel weather pattern appears, lean on the physics model. Robust to individual model failures.
// Sensor fusion pipeline — solar generation estimate
uncertainty bounds propagated through every step
Generic models are trained on generic data. Your roof, your trees, your cloud patterns, your family's habits — these are unique. A model trained on months of your own history will consistently outperform any off-the-shelf equivalent.
Takes fused irradiance + temperature + time-of-year as inputs. Outputs predicted kWh per 30-min interval for the next 48h with confidence intervals. Trained on your actual inverter output vs. conditions over months. Learns your specific panel degradation, shading patterns, soiling effects. A gradient-boosted tree or small neural net works well here — they capture the nonlinear irradiance-to-power conversion naturally.
Predicts how much power your house will consume each interval. Features: time of day, day of week, season, temperature (AC load), calendar events (school day vs. weekend). Trained on your HA historical energy data. Residential load has strong periodicity — a simple model (even linear regression per time-of-week bucket) captures 80% of variance. The remaining 20% is handled by replanning when actuals diverge.
Amber gives you a short-horizon price forecast, but extreme price events (the spikes that make arbitrage profitable) are partially predictable further ahead. Train a classifier on historical AEMO data: features are temperature forecast, demand forecast, time of day, season, recent price trend. Output is probability of a spike event in the next 2–6 hours. This informs whether to hold battery capacity in reserve for a high-value export window.
Cycling your battery has a cost — measured in capacity lost per cycle, dependent on depth of discharge and temperature. Without modeling this, the optimizer will over-cycle the battery chasing small arbitrage gains, destroying long-term value. A simple empirical model (manufacturer curves + your observed capacity fade) adds a per-cycle degradation cost to the optimizer's objective function, giving it a reason to only trade when the spread justifies it.
Given all predictions, the optimizer finds the charge/discharge schedule that maximizes your net position over the next 48 hours — subject to real physical constraints. It runs every planning cycle, acts on only the first interval, then re-plans with fresh data. This is Model Predictive Control.
// MPC planning cycle — every 5–30 minutes
actions emitted as Home Assistant service calls → inverter responds
Constraint
SOC must stay within safe limits (e.g. 10–95%). Charge and discharge rates capped at inverter maximums. Grid export limited if your connection has a cap. The optimizer cannot produce a physically impossible schedule.
Objective
Export earnings minus import cost minus battery degradation cost. The degradation term is the critical addition that prevents the system from over-trading for marginal gains that destroy battery life faster than the arbitrage earns back.
The gap between watching your system and owning the market is a prediction model and a closed loop.
Why a local station?
BoM forecasts are coarse-grained in both space and time. Your roof is a point. The station catches cloud transients minutes before BoM does, corrects the solar forecast in real time, and trains a model that learns your microclimate. Without it, you're optimizing on imprecise inputs and leaving accuracy on the table.
Why custom models?
Your shading patterns, panel orientation, family load habits, local grid volatility — none of these are in a generic model. A model trained on twelve months of your own data will consistently produce better forecasts than anything trained on population averages. The data you've already been collecting in HA is the training set.
Why bother at all?
Amber spot prices are volatile enough that a few good decisions per week — hold the battery for a spike, discharge early before a crash, charge during a negative-price event — can substantially outperform any static export rule. The opportunity already exists. The question is whether you're capturing it systematically.
This doesn't need to be built all at once. Each phase adds value independently — you can stop at any layer and already be ahead of where you started.
Get all four streams flowing into Home Assistant with clean timestamped logging. Amber API, inverter via Modbus, BoM feed, weather station. No optimization yet — just build the dataset you'll train on. This alone surfaces patterns you've never seen on a dashboard.
Implement the irradiance fusion pipeline. BoM GHI forecast + local station readings → a single fused PV generation estimate with uncertainty bounds. This is where the weather station starts earning its keep. Validate the fused estimate against actual inverter output to tune the filter.
Train the solar and load forecasters on your collected history. Start simple (linear regression, decision trees) and measure accuracy before reaching for complexity. Add the price spike classifier once you have enough AEMO historical data to train it. Each model runs in HA via AppDaemon or a sidecar Python service.
Wire predictions into the linear program. Start with a conservative objective — don't trust it fully yet. Run in shadow mode (log decisions without acting) for a week and compare its decisions to what you would have done manually. Tune the degradation cost. Then close the loop into real HA automations.
Models retrain periodically on new data. The fusion filter adapts its weights based on recent accuracy. The optimizer's degradation model updates as you observe actual battery capacity fade. The system gets smarter the longer it runs — a genuine compounding advantage over any static rule.