Uptime card
How much of the period a thing was actually working, and when it was not. The share counts only the time the key reported, so a device that went silent cannot quietly inflate it, and the bar underneath shows whether the missing hours were one long outage or forty short ones. Up can mean true, a reading inside a range or a named state, which covers a machine, a pump, a door and a link with one widget.
Who it’s for
Anyone who is asked how much something was working and has only the raw telemetry to answer with. A plant manager reporting on a line, an operations team against a service agreement, a facility engineer whose pump should hold pressure through the night, a landlord whose door sensor ought to be reporting at all. The question is always the same shape: of the period we are looking at, how much of it was good, and when was it not.
What it does
One production line over a day, from a key that reports 1 while it runs: the card reads 87.5% up, with 21 h 00 m up, 3 h 00 m down underneath and a bar showing the three hours sat together between 06:00 and 09:00 rather than scattered through the shift. The condition line adds that the state changed twice.
- Answers the question three ways from the same reading, chosen in the settings: the share with a timeline, the same share as a ring for a square tile, or the time the current state has lasted so far, which keeps counting while nothing new arrives.
- Treats a reading as a state, not a point on a curve. It holds until the next one says otherwise, so a key that reports every five minutes and one that reports only on change give the same answer.
- Counts the share over the time that was actually reported, so a device that went silent cannot quietly inflate it, and says how much of the period that was.
- Takes up to mean whatever your key means by it: a boolean, a reading inside a range, or a named state, which covers a machine, a pump, a door and a link without a widget each.
- Shows the shape of the downtime, not just its size. Ninety-five percent is one long outage or forty short ones, and those are different problems.
- Measures one key on one entity. A wall of machines belongs in a grid widget, and the reason a thing went down belongs in an alarm.
How to set up
The widget takes one entity and one key, and the only real decision is what counts as up.
Data keys
- One key of any type —
Timeseries. The reading that says whether the thing was working: a boolean, a number, or a word. Values are compared in whatever form they arrive, so a key reportingtrue,1,on,yesorokall read as up under the first condition, and everything else reads as down. With no readings in the window the card shows its no-data message instead of a share.
Up condition
- Layout — Share with a timeline by default. Ring draws the same share as a circle and drops the timeline, which suits a square tile. Time in the current state answers a different question — how long the run the period ends in has lasted — and redraws itself on a clock, because that number grows while no data arrives.
- Counts as up when — The reading is true by default. Choose The reading is inside a range for a value that should stay between two numbers, such as a pump pressure or a room temperature, or The reading equals a value for a key that reports a state by name.
- Range starts at and Range ends at — 0 and 100 by default, shown only for the range condition. Both ends count as up, and giving them the wrong way round is fine because they are sorted.
- Up value —
1by default, shown only for the equals condition. Matched as text and as a number, soRUNNINGmatchesrunningand1matches1.0.
How to customize
- To keep only the number — turn off Show the timeline, which is on by default and hidden by the ring layout anyway.
- To drop the line of durations — turn off Show the durations. In the timer layout that line also carries the share over the period, so turning it off there leaves the current run alone on the card.
- To quieten the tile — turn off Show the condition line. It is the line that names what counts as up and how much of the period the readings cover, so turn it off where the data is dense and that question does not arise.
- To match the bar to your palette — set Up and Down. Time with no readings is always drawn in neutral gray, because it is not known to be either.
- To keep one size at any card size — turn off Scale to fit the card, which is on by default and grows or shrinks the whole card together.
- To stop the card naming its own key — turn off Show the key label.
- To match the card to the dashboard — set Share font and Share color.
Tips
- Read the timeline before the number. A 97% month made of one eight-hour outage and a 97% month made of ninety short drops are the same share and completely different faults.
- Watch the coverage. The share is always taken over reported time, so a card saying 100% up while the condition line says readings cover a third of the period is telling you about the gateway, not the machine.
- Use the range condition for anything that has a healthy band rather than an on and off: a pump between its minimum and maximum pressure, a cold room between two temperatures, a battery above a floor. The share then means time in spec, which is the number an agreement is usually written against.
- Put the timer layout on a control room screen and the share layout on the report dashboard. One answers how things are right now, the other how the month went.
- Point the widget at a key that changes only when the state changes, if you have one. Fewer readings do not make the answer coarser, because each one holds until the next, and the card then covers months without asking for thousands of points.
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.