Energy balance card
How much energy did the site use, and how much of its own generation stayed on site? Solar generation, grid import, grid export and any other readings from one device are listed as rows. Mark each key as generation, flowing in, flowing out, by sign or not counted, and the card works out total usage and draws self consumption as a ring: generation minus export, over generation. Units are converted before adding, so kWh and MWh agree.
Who it’s for
Anyone who has to answer two questions about one site at once: how much energy it used, and how much of what it generated it kept for itself. A solar owner checking whether today’s production went into the building or out to the grid, a facility manager reporting consumption to a landlord, an installer handing over a system and wanting one card on the wall that says where the energy went. The meters already report the parts; what nobody has is the arithmetic between them.
What it does
A house on a sunny day: solar generation 18.7 kWh, grid import 5.1 kWh, grid export 7.2 kWh. The card adds what came in, subtracts what left, and prints Total usage 16.6 kWh on the first row, then draws the ring at 61% — the share of the solar that stayed on site rather than going to the grid.
- Turns separate meter readings into the two numbers people actually ask for. Every other card on the dashboard shows one key; this one shows what they add up to.
- Marks each row with where the energy goes — IN, OUT or GEN — so the card can be read without opening the settings to remember which key is which.
- Reads a battery or a two-way meter correctly. A key set to By sign counts as incoming while its value is positive and as outgoing once it turns negative, and its badge follows the sign.
- Converts units before adding them, so a plant reporting generation in MWh and import in kWh still produces one honest total.
- Fits the cell it is given: a tall card lists the readings with the ring centered underneath, a wide one puts the readings and the ring side by side.
- Refuses to invent a total. A key counts only once you say what it carries, and when more left the site than entered it the total shows a dash instead of a negative number no meter could report.
- Shows the latest reading of each key for one device. It does not plot history, compare periods or sum across devices — a fleet total belongs in a calculated field first.
How to set up
Data keys
Add one key per reading from a single device — generation, import, export, a battery, anything else worth listing. Each key becomes a row in the order you add it, using its own units and decimals.
- Any numeric energy key —
TimeseriesorAttribute. Its latest value becomes a row. A key with no value yet shows a dash and stays out of the total. - At least one key marked Generation — needed only for the ring. Without one the ring is not drawn at all and the card is a list of readings with a total.
- No keys at all — the card shows Add data keys to see the balance.
Each key carries one setting of its own, in the key’s own settings:
- Flow direction — Not counted by default. Says what the key carries, which is what lets the card count it: Generation for anything produced on site, Into the site for what is added to the total, Out of the site for what is subtracted, By sign for a key whose sign says which way it is going, and Not counted for a reading that belongs on the card but not in the arithmetic.
Total
- Total units — empty by default. Empty prints the total in the largest unit
among the keys. Set it to force one —
kWhorMWh— and every key is converted into it before adding. Keys measuring different quantities, such as kWh and liters, cannot be added, and the row says Mixed units instead.
How to customize
- To rename the first row — edit Total label, Total usage by default.
- To hide the ring and keep only the readings — turn off Show ring, on by default. The rows then take the whole card.
- To call the share something else — edit Ring label, Self consumption by default. A site that sells most of its generation might prefer Kept on site.
- To match the ring to your dashboard — set Ring color, green by default. The track behind the ring uses the same color faded.
- To make the percentage larger or smaller — set Ring value font, 22px Roboto Medium by default. A long value shrinks to fit inside the ring anyway.
- To keep the text at a fixed size — turn off Scale to fit, on by default. While it is on, the fonts and the ring grow with the card.
- To fix the text color on a colored background — set Text colors to For a light background or For a dark background. The default, Automatic, picks one from the widget background color.
- To restyle the rows — set Label font and Value font, both 13px Roboto by default, the value in Medium.
Tips
- Put the keys in reading order — generation first, then import, then export — and the card reads top to bottom as the energy moves through the site.
- A key you want on the card but not in the total, such as a tariff or a meter index, is what Not counted is for: it shows as a row with no badge.
- Self consumption is generation minus everything marked Out of the site, over generation. If a site exports through two meters, mark both, or the share will read high.
- The badges need room. On a narrow cell the card drops them and keeps the full key names instead, so give the widget at least a quarter of the dashboard width when the badges matter.
- Set Total units on a site whose meters disagree — one in Wh and one in kWh still add up correctly, but the total reads better pinned to the unit people use in conversation.
Share Your Widget with the Community
Built a custom widget? Export it as a JSON from ThingsBoard and publish it to the IoT Hub through a simple 4-step wizard (Upload, Listing, Readme, Review & Submit). Share it with thousands of ThingsBoard developers worldwide and get featured in the catalog.