Loading...
Author Cloudapp
E.G.

A Home Assistant Energy Dashboard, Built Piece by Piece

July 21, 2026
Table of Contents

Home Assistant ships an Energy dashboard, and for a while mine was mostly empty grey bars. Real energy management here — a roughly 9 kWp PV system, a Huawei SUN2000 inverter, a my-PV AC·THOR 9s diverting surplus into hot water, and a scatter of Shelly relays — needed more than the built-in dashboard could give me. This is the map of what I actually built, in the order the problems showed up: first get the inverter's data into Home Assistant at all, then make it trustworthy, then act on it.

Reading the inverter — the Modbus foundation

The Huawei SDongle behind my inverter has one very inconvenient property: it accepts exactly one Modbus TCP connection at a time. The moment a second client — Home Assistant, a second tool, whatever — tries to talk to it, the first one gets disconnected. That single fact shaped almost everything below it.

I first solved this narrowly, for my own SUN2000 setup, with a small caching proxy that owns the one connection and serves everyone else from a shared cache, then rewrote the same idea as a standalone asyncio service anyone can adapt to a different inverter, and separately documented the actual SUN2000 register map for reading it with Home Assistant's built-in modbus platform, no custom integration at all.

A caching proxy that only serves reads is half the job — I added a write-through path so the same proxy also forwards register writes (like changing a charge target) straight to the inverter or battery on demand. And because a proxy that quietly goes stale is worse than no proxy at all, the reconnect and stale-cache-detection layer got its own post — the failure-mode playbook for the night the SDongle reboots or the network blips.

Watching the numbers — turning raw registers into answers

Getting the registers into Home Assistant is only step one. The number I actually watch daily is self-consumption and autarky, which the inverter's own cloud shows me as pretty graphs but Home Assistant hands you as raw counters. Rebuilding those two percentages as real template sensors is what turned the dashboard from decoration into something I check every evening.

The other thing worth watching for is a string quietly underperforming — shading from a tree that grew taller, a dead module, a loose MC4 connector. An automation that compares the two MPPT strings and flags the moment one starts drifting catches exactly that, months before it would otherwise show up as "huh, that's odd" on the annual statement.

Acting on it — surplus, control, switching

None of this matters if the numbers just sit there. The most useful thing I built with them is dumping PV surplus into the hot-water tank through the AC·THOR 9s — which sounded trivial until the device flatly refused every Modbus write while reads worked fine. The fix was routing control through the vendor's undocumented Cloud API instead, read local, write cloud, split-brain but honest about why.

The newest piece is lower-tech on purpose: Shelly Plus 1PM/2PM relays behind the wall switches that switch a circuit locally and meter its energy at the same time, no cloud dependency, no Modbus at all — proof that not every problem here needs the heavy machinery above.

Frequently asked questions

What's actually missing from Home Assistant's built-in Energy dashboard?

Nothing is broken about it - it's just generic. It tracks grid import/export and, if you add a solar sensor, production. It has no concept of per-string health, of a device that blocks writes but allows reads, or of turning a self-consumption percentage into something you'd actually trust enough to act on. Those gaps are exactly what the posts above fill in, one real failure at a time.

Do I need this exact hardware (Huawei SUN2000, my-PV AC·THOR) to use any of this?

No. The single-Modbus-connection problem is generic to a lot of inverters, not just Huawei's - the caching-proxy pattern applies wherever a device only tolerates one client. The AC·THOR's Cloud-API pivot is specific to that device, but the underlying lesson (read local, write wherever the vendor actually allows writes) generalizes to plenty of other stubborn hardware.

Which piece should I build first?

Whichever failure you're actually hitting. If a second Modbus client keeps kicking your first one off, start with the caching proxy. If you don't trust the self-consumption number your inverter's app shows you, start with the template sensors. If you already have good data but nothing acts on it, skip straight to the AC·THOR or Shelly posts.

Is this a one-time build or does it keep changing?

It keeps changing. This hub gets a new section whenever a new piece of the setup earns its own post - the Shelly relays are the newest addition as of this writing.

This isn't a finished system, it's a running log of a real ~9 kWp setup, and it keeps growing whenever the next real problem shows up. If you're building something similar, start with whichever piece matches the failure mode you're actually hitting — the inverter's connection limit, the trust gap between raw registers and real percentages, or getting Home Assistant to actually act on a surplus instead of just charting it.

Related articles

Caching a Huawei SUN2000 over Modbus for Home Assistant

My Huawei SDongle accepts exactly one Modbus connection — but Home Assistant, the AC·THOR and evcc all want the inverter's data. Here's the ~300-line asyncio cache server I wrote to feed all of them from a single quiet poll.

Author Cloudapp
E.G.
June 5, 2026

Self-Consumption & Autarky: PV Metrics in Home Assistant

My inverter cloud shows self-consumption and autarky as pretty graphs. Home Assistant gives you raw counters. Here's how I rebuilt those numbers as template sensors I own.

Author Cloudapp
E.G.
June 6, 2026

Solar Surplus into Hot Water: the AC·THOR in Home Assistant

I wired an AC·THOR 9s into Home Assistant to dump PV surplus into the hot-water tank — then the device refused every Modbus write. Here's the read-local, write-cloud fix.

Author Cloudapp
E.G.
June 7, 2026

Detect a Failing PV String in Home Assistant: Shading, Dead Module or Loose MC4

A Home Assistant automation that compares your two MPPT strings and warns you the moment one drifts — early warning for shading, a dead module or a loose MC4 connector, with a night-time false-alarm guard.

Author Cloudapp
E.G.
June 15, 2026

Control an AC·THOR 9s from Home Assistant When Modbus Writes Are Blocked: the my-PV Cloud API

Reading the AC·THOR 9s over Modbus TCP works, but writing is blocked at the device. Here's how I switched control to the undocumented my-PV Cloud API as a Home Assistant shell_command, with tested parameters and the gotchas nobody mentions.

Author Cloudapp
E.G.
June 16, 2026

Build Your Own Modbus-TCP Cache Proxy in Python: One Inverter, Many Home Assistant Clients

The Huawei SUN2000 SDongle accepts only one Modbus-TCP connection. Instead of an add-on, I wrote a ~300-line asyncio caching proxy that polls the dongle once every 10s and serves the registers to Home Assistant, AC·THOR and evcc at the same time. Full MBAP parsing, register batching and an in-memory cache.

Author Cloudapp
E.G.
June 19, 2026

Read the Huawei SUN2000 in Home Assistant Without a Custom Integration: Native Modbus YAML

Read every Huawei SUN2000 register straight into Home Assistant with the built-in modbus platform — no custom component that breaks on upgrade. A complete register-to-YAML map with the right data_type, scale, device_class and state_class for the Energy Dashboard.

Author Cloudapp
E.G.
June 23, 2026

Modbus Write-Through: Control Battery & Inverter Through a Caching Proxy in Home Assistant

A caching Modbus proxy only solves reads. Here is the write-through path: pass FC6 register writes straight to the inverter on a short-lived connection, echo the response, return proper Modbus exceptions — so you can force-charge the battery or set power limits over a single shared connection.

Author Cloudapp
E.G.
June 30, 2026

A Robust Modbus Proxy: Reconnect, Stale-Cache Detection and Timeouts Done Right

A failure-mode playbook for a self-built Modbus cache proxy in Home Assistant: reconnect with backoff, stale-cache detection that HA can alert on, per-batch and client timeouts, and 50 ms spacing for a slow SDongle — so the proxy never silently serves zeros after a nightly drop or firmware reboot.

Author Cloudapp
E.G.
July 3, 2026

Shelly in Home Assistant: Local Switching & Energy Metering

How I run Shelly Plus 1PM/2PM behind my wall switches in Home Assistant — fully local switching plus per-channel energy metering, no cloud, physical switch kept.

Author Cloudapp
E.G.
July 20, 2026