Tank Fill Level Cards
Shows one or several tanks as color-coded fill bars, from a percentage or from current and max-capacity readings, with warn and critical thresholds.
Who it’s for
An operator watching one or several tanks — water, fuel, a chemical, or a bulk material — who needs to see at a glance whether each is full, low, or critical, without reading a raw number off a telemetry chart and doing the math themselves. It fits a device that already reports a fill percentage, and just as well a device that reports a raw level and a separate capacity value, which is common on a tank instrumented with a depth or pressure sensor rather than a purpose-built level transmitter.
What it does
A tank reporting 62% renders a green bar filled just past the halfway mark with “62%” printed beneath it. Below the Warn threshold (30% by default) the bar and the number turn amber, and below the Critical threshold (15% by default) they turn red.
- Reads a fill percentage directly from a data key, or computes it from a current-level key and a max-capacity key, depending on Data source mode — a setting names which key to look for, so which bound key feeds which value is configured, never guessed from bind order
- Shows one tank per bound entity, side by side in the same card, each labeled with its entity name once more than one is bound — add or remove entities on the Data tab to change how many tanks show
- Every tank in the card uses the same Data source mode
- Colors each tank green, amber, or red against a warn and a critical threshold, so a low tank is visible at a glance without opening a dashboard. Thresholds are either the same fixed pair for every tank, or supplied per entity through bound keys, depending on Threshold source
- Clamps the displayed percentage to 0-100 — a device that reports 105% or a negative reading shows as 100% or 0%, never a number outside the range a fill percentage can actually be
- For a tank read from current level and max capacity, prints the raw reading under the percentage, for example “620 of 1000 L filled”
- Shows a distinct message, per tank, when the expected key name is not bound yet, when a bound key has not reported, and when a reading cannot be used — not a number, or a zero or negative max capacity
- Does not send commands or write telemetry, and does not total or compare tanks against each other — each tank is shown on its own
How to set up
Data keys
Bind one entity per tank. Which key or keys each entity needs depends on Data source mode:
| Data source mode | Keys needed on each entity |
|---|---|
| Fill percentage | One key, named to match Fill percentage key name |
| Current level + Max capacity | Two keys, named to match Current level key name and Max capacity key name |
| Setting | Default key name | What a key by that name means |
|---|---|---|
| Fill percentage key name | percentage | The tank’s current fill, already expressed as 0-100 |
| Current level key name | level | The tank’s raw current level, read together with a Max capacity key name on the same entity |
| Max capacity key name | capacity | The tank’s full capacity, read together with a Current level key name on the same entity |
The widget reads a key by its name, not by the order it was bound in, and matching is case-insensitive. If your devices already report under different key names, change the settings above to match instead of renaming the keys.
Bind more than one entity to show more than one tank in the same card — each gets its own state. If an entity is missing the key or keys its mode needs, the card names what to fix, on that tank only. If a key is bound but the device has not reported yet, the card says so rather than showing a blank or zeroed tank.
Data
| Setting | Default | Effect |
|---|---|---|
| Data source mode | Fill percentage | Switches every tank in the card between reading one 0-100 key directly and computing the percentage from a current level key and a max capacity key |
Thresholds
| Setting | Default | Effect |
|---|---|---|
| Threshold source | Fixed values | Switches every tank in the card between one shared warn/critical pair and a pair each entity supplies through its own bound keys |
| Warn below | 30 | Fill percentage below which a tank switches to the warn color. Also the fallback in “From data keys” mode when an entity has no warn threshold key bound |
| Critical below | 15 | Fill percentage below which a tank switches to the critical color. Also the fallback in “From data keys” mode when an entity has no critical threshold key bound |
| Warn threshold key name | warnThreshold | In “From data keys” mode, the key name read as an entity’s own warn threshold |
| Critical threshold key name | criticalThreshold | In “From data keys” mode, the key name read as an entity’s own critical threshold |
Many tank devices already carry their alarm-rule thresholds as attributes rather than a value you would type twice. Threshold source: From data keys reads those directly instead of duplicating them in the widget’s own settings, and an entity that does not have the key bound simply falls back to the fixed Warn below / Critical below.
How to customize
- To change the color of a full tank — edit Normal color
- To change the color of a low tank — edit Warn color
- To change the color of a critically low tank — edit Critical color
- To change the fill percentage that counts as low or critical — edit Warn below and Critical below
- To hide the percentage numbers — turn off Show value label
- To change the unit printed after the percentage — edit Unit
- To show more or fewer decimal places — edit Decimals
- To change the size or font of the percentage number — edit Value font
- To label the raw current/max numbers with a unit — edit Raw unit
Tips
- A card with several tanks shows a label above each one. With a single tank bound, the label is left off since the whole card is already that one tank.
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.