Tariff cost card
The readings the dashboard already shows, priced by the contract behind them. Consumption is split hour by hour across your bands — peak, shoulder, night, weekend — so the card shows what each one came to, the share of the bill it carries and where the period is heading at this rate. Prices are per unit of the data key, so kWh, cubic metres and litres all work, and the tariff can live on the entity, giving every site its own contract.
Who it’s for
Anyone who is charged by the hour for what a meter reports. A facility manager asked halfway through the month whether the bill is going to land where it was budgeted, an energy manager who moved a shift to the evening and wants to know what that decision cost, a landlord recharging tenants, an operations lead who can see the readings on every dashboard and none of the money, a water utility whose night rate is half the day one. They are all asking the same thing: what is this consumption worth under our contract, and which part of the day is taking it.
What it does
One site over yesterday: 464 kWh, which the schedule splits into 148 kWh at peak, 96 at shoulder and 220 overnight. At $0.28, $0.18 and $0.09 per kWh those bands come to $41.44, $17.28 and $19.80, the daily fixed charge adds $0.65, and the card reads $79.17. Peak took under a third of the consumption and over half the bill, which is the sentence the readings alone never produce. Nothing in that is specific to electricity: the same card prices cubic metres of water or gas and litres of fuel, because the price is per one unit of whatever the key reports.
- Prices consumption the dashboard already shows, so the money and the meter live in the same place instead of in a spreadsheet at the end of the month.
- Splits the period hour by hour against the tariff bands, so each reading is charged at the price that actually applied to it rather than the period being charged at an average. That is what a time-of-use contract charges on, and it is the part a period total can never show.
- Shows the shape of the bill before any of the numbers are read — one bar divided by what each band and the fixed charge contribute, then a line for each with its quantity, its amount and its share.
- Takes consumption per interval or a meter counter that only climbs, and prices it in the unit already set on the data key, so electricity, water, gas and fuel are the same widget rather than four.
- Reads the tariff from the entity when each site is on its own contract, so one dashboard prices a whole portfolio without a widget per site.
- Projects the current rate to a month, as a rate rather than a forecast.
- Prices consumption and a daily fixed charge. It does not handle rates that step with volume, capacity or demand charges billed on a peak, or credits for export, so a contract built on those needs its cost computed in a calculated field first.
How to set up
The widget takes one entity and one consumption key. Everything else is either the tariff you type in or the tariff it reads from the entity.
Data keys
- One consumption key —
Timeseries. What the card prices. Its units are what every price is per: setkWhand the prices are per kWh, setm3and they are per cubic metre, and the card prints that unit beside every quantity. A key with no units is priced per bare unit and says so. With no readings in the window the card shows its no-data message instead of a total. - The tariff key —
AttributeorTimeseries, and only when the prices come from the entity. It is not configured in the data tab; the card names it in the settings and subscribes to it itself, reading both kinds and preferring the attribute. Until it answers, the card says it is waiting for it.
Tariff
- Price source — Set here by default. Set here uses the bands below for every entity on the dashboard. Read from the entity takes the tariff from a key on the entity itself, which is what a portfolio of sites on different contracts needs.
- Tariff key —
tariffby default, and only shown when the prices come from the entity. The key holds one number for a flat rate, a list of bands carrying their own hours and prices, or a map of band name to price when only the numbers differ per site and the hours below stay the same. - What the readings are — Consumption of the interval by default, which is the usual shape when the time window aggregates with SUM. A meter counter is the other option: the card then takes the difference between consecutive readings and treats a drop as a counter reset rather than as negative usage.
- Tariff bands — peak, shoulder and off-peak by default, at $0.28, $0.18 and $0.09. Each band carries a Name, a Price per unit, the Hours it covers and the Days it applies on. A reading takes the first band whose days and hours contain it, so the narrow bands go above the wide ones, and the last band can be left with empty hours to cover everything the bands above did not claim. Hours accept several ranges, and a range that ends before it starts runs through midnight.
- Daily fixed charge — 0 by default. What the supplier charges per day for the connection whatever is used, which most bills call a standing charge. It is counted for as many days as the time window covers and listed on its own line, so a window of a few hours carries only its share.
How to customize
- To show amounts in another currency — set Currency. A single symbol goes
in front of the number and a longer code after it, so
$prints $12.40 andEURprints 12.40 EUR. Clear it for bare numbers. - To keep only the amount on the card — turn on Show only the total. The bar, the band lines, the readings behind the total and the projected month all come off together, which is what a small card or a tile row wants.
- To stop the card naming itself — turn off Show the key label, which is worth doing whenever the widget title already says what the entity is.
- To keep one size at any card size — turn off Scale to fit the card. It is on by default, and it grows or shrinks the whole card so the same widget reads on a phone and on a wall display.
- To match the card to the dashboard — set Total font and Total color. Everything else follows the platform’s own text styling.
Tips
- Check the average price the card prints under the total against a real invoice. If the average is off while the quantity is right, the schedule is wrong, and it is usually a band whose hours are written for the wrong half of the day.
- A line called Unbanded hours means the schedule has a gap: some hours belong to no band, their quantity is counted but not priced, and the average is then taken over the priced part only. Leaving the last band’s hours empty closes the gap for good.
- Hours are read in the time zone of whoever is looking at the dashboard, so a site billed in another zone will bucket against the viewer’s clock rather than its own.
- Set the time window to aggregate with SUM for interval consumption, and to NONE or a short interval for a meter counter, so the differences between readings stay real.
- Keep the whole tariff in one attribute per site when the contracts differ. One widget then prices every entity the dashboard cycles through, and a price change is an attribute edit rather than a dashboard edit.
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.