One schema, many meters: event-driven ingest for low-voltage visibility
How we fused smart meters, home batteries, smart plugs and telco node data into one BigQuery schema, decrypted customer IDs inside the warehouse and placed every reading on the network.
During the 2019–20 bushfires, staff at Essential Energy had to door-knock thousands of customers to find out who still had power. The network could tell them a great deal about its poles, substations and feeders. It could tell them very little about the last few hundred metres of wire into each home.
That low-voltage network had been dark for as long as it existed. Our job in the Network Visibility program was to light it up without installing a single new sensor, by using data that already existed somewhere else: smart meters, home batteries and inverters, smart plugs and telco equipment cabinets. This post is about the plumbing that made that possible.
The problem
Every source was different in every way that matters to a data engineer:
- Delivery. Some arrived as files dropped into storage, some on an SFTP server, some only if you polled a vendor's API, and some as messages.
- Cadence. Every five minutes, every fifteen, or whenever a batch landed.
- Shape and units. Single-phase and three-phase, volts and millivolts, watts and kilowatts, each with its own field names.
- Identity. Each feed named its devices its own way. Some identified the customer's meter; one sent that meter ID encrypted.
And none of them said where on the network the reading came from. A voltage without a substation and feeder is just a number.
Architecture
sources ingest store consumers
meter files (GCS) ---> function on file arrival ---> raw table
| scheduled query /15 min:
| decrypt IDs, join premise
SFTP meter files ----> file-arrival publisher ---+ v
battery API (x2) ----> scheduler -> Pub/Sub -----+--> nmireadings_all ---> notebooks, dashboards
smart plugs ---------> cron -> Pub/Sub ----------+ (BigQuery history)
telco node data -----> Pub/Sub ------------------+--> latestreadings ---> map layer, app
(Firestore, current)
premise lookup (Cloud SQL): meter -> location, substation, feeder, region - Nine small Cloud Functions, most between about 120 and 250 lines, one per feed and direction.
- One target shape,
lowvoltage.nmireadings_all: timestamp, meter ID, location, voltage and power per phase, device type and ID, substation, feeder, town, depot and region. - Two stores. BigQuery for history and analysis; one Firestore document per device for "what is it reading right now".
One schema, many adapters
The decision that made everything else simple was to treat each feed as an adapter with one job: turn whatever arrives into a row of the shared schema, with the network context attached. Nothing downstream knows or cares which vendor a reading came from.
That gave us a repeatable recipe for a new source:
- Decide whether it is push or pull. Files and messages trigger a function directly. APIs that must be polled get a scheduler that publishes a "go" message, so polling and processing are separate and each can retry on its own.
- Normalise units and phases at the edge, filling missing phases with zero rather than inventing values.
- Attach the network by looking the meter up in the premise table: coordinates, substation, feeder, town, depot and region.
- Write twice: append to history, overwrite the device's latest-reading document.
The smart plug post walks through one of these adapters line by line. The point here is that there were nine of them and they all looked alike, which is exactly what you want when a tenth turns up.
Decrypting inside the warehouse
One smart-meter feed arrived with its customer meter IDs encrypted, a sensible choice by the data provider. We still needed to join those readings to the premise table.
Rather than pull the data out, decrypt it in an application and push it back, we did the decryption inside BigQuery. A scheduled query declares a temporary JavaScript function that decrypts the token, then joins and appends in one statement. It runs every fifteen minutes, on three staggered schedules, and each run looks back over the last thirty minutes.
Overlapping windows mean a late file is never missed, but they also mean the same reading can be seen twice. The query handles that with an anti-join against rows already written (abridged, project names removed):
FROM (
SELECT utctimestamp, decryptNmi(nmi) AS nmi, voltagea, voltageb, voltagec, meterno
FROM lowvoltage.originreadings_all
WHERE utctimestamp > reading_interval
) AS origin_readings
# Add premise details
LEFT JOIN assets.premise AS premises
# Strip extra nmi char
ON origin_readings.nmi = SUBSTR(premises.nmi, 1, 10)
# Do not want to insert already-existing rows
LEFT JOIN (SELECT timestamp, nmi FROM poc.nmireadings_all
WHERE timestamp > reading_interval) AS existing_rows
ON existing_rows.timestamp = origin_readings.utctimestamp
AND existing_rows.nmi = origin_readings.nmi
WHERE existing_rows.timestamp IS NULL Two details are worth stealing. The LEFT JOIN ... IS NULL makes the append idempotent, so a schedule can overlap, rerun or catch up without creating duplicates. And the SUBSTR(..., 1, 10) is a reminder that identifiers are never as clean as the spec says: one system stored the meter ID with an extra trailing character and the other didn't.
If we built this today, we would use the warehouse's built-in encryption functions with keys held in a key management service. The pattern, decrypting only at the moment of the join, inside the system that already holds the data, still stands.
Getting the network into the warehouse
Telemetry is only half of the join. The other half is the network itself, which lived in GIS exports of poles and conductors per feeder, and in geopackages and shapefiles such as statistical boundary areas.
Those exports were large, so the ETL streamed them: a Node tool read multi-gigabyte GeoJSON as a stream and wrote newline-delimited JSON that BigQuery loads natively, one feeder at a time. A small Python tool used geopandas for the other formats. Public holidays went in too, because a Tuesday that is a holiday behaves like a Sunday on the network.
We also wrote a data glossary: every column in the assets and low-voltage datasets, with its type, its source and, where nobody knew, an honest question mark. That question mark did more good than any diagram. It told the next person exactly where to ask.
Looking at the data
With readings placed on the network, the first analysis was simple and useful. A notebook found substations with three or more reporting meters, ignored devices with intermittent communications, pulled voltage per meter, resampled it and plotted the spread by weekday and by month. Seeing several meters on one transformer side by side is how you start to spot voltage problems on a street.
We also wrote down the first operational rule we wanted from the live store: for source-isolated faults, a reading below 150 V but above zero should raise a fault flag and a push notification. That is the kind of question that once took a door knock.
Where AI fits
There was no model in this codebase, and we don't pretend otherwise. What it built was the ground a model stands on. The same platform held the metering, tariff and weather schemas that our 30-day demand forecasting models trained on, and the program's target design took production models through MLflow and Azure ML. The detail that matters most for a model is one we've already covered: the idempotent append. A reading loaded twice counts twice in training, and a model quietly learns that those days were busier than they were. The 150 V fault rule is also where a model would start: today a threshold, tomorrow a classifier trained on the faults the threshold caught.
What it taught us
We led the program as well as building it, and the method mattered as much as the code. "Try today and be less wrong tomorrow" was the motto: find the lowest sensor density and coarsest data that would answer each question, and test every idea for whether it works, whether it is affordable and whether anyone wants it. Trials went through a steering forum with playbacks, not a big-bang platform.
On the engineering side, we documented as we went: sequence diagrams for each flow, a README per function with its exact deploy command, and a guide to creating least-privilege service accounts for local development. A platform with many small parts lives or dies on whether the next person can find their way around it.
Why it still matters
Most organisations already have the data they need, spread across vendors, formats and teams that don't talk. The work is a shared schema, small adapters, idempotent loads and the context that turns a number into a decision. See how we approach real-time, IoT and data platforms, or the network visibility case study.