Widget Baterai
Tingkat daya hingga delapan perangkat, digambar sebagai cincin. Terbaik untuk baterai rumah pintar, sensor, dan apa pun yang tidak ingin Anda temukan habis.
Bagian ini menjelaskan fitur dalam pembaruan aplikasi yang sedang menunggu tinjauan App Store. Fitur ini akan otomatis terbuka di sini begitu pembaruan tersedia.
The battery template renders one ring per device, in the same idiom as Apple's own
Batteries widget. It is the right shape for any set of things that each have a percentage and a
name — smart-home batteries, sensor nodes, UPS units, tool packs.
Fields
| Field | Type | Notes |
|---|---|---|
template | string | Required. Must be "battery" |
devices | object[] | Required. Between 1 and 8 device objects, rendered in the order you send them |
devices[].name | string | Required. Must not be empty. Max 32 characters |
devices[].level | float | Required. Charge percentage, 0 to 100 |
devices[].charging | boolean | Overlays a charging bolt on the ring |
devices[].icon | string | SF Symbol shown inside the ring, or an MDI icon prefixed with mdi:. Max 128 characters |
devices[].color | string | Ring color — named color or hex (see Colors). Default is green, switching to red at or below 20% |
label, subtitle, icon, accent_color, background_color, text_color | string | Shared content fields — see the API reference |
Example: household devices
{
"content": {
"template": "battery",
"label": "Devices",
"icon": "battery.75percent",
"accent_color": "green",
"devices": [
{ "name": "Vacuum", "level": 68, "icon": "fan.fill" },
{ "name": "Front lock", "level": 45, "icon": "lock.fill", "charging": true },
{ "name": "Doorbell", "level": 18, "icon": "video.fill" },
{ "name": "Sensor hub", "level": 92, "icon": "sensor.fill" }
]
}
}Behavior
Each ring fills to its level and is tinted by its own color, falling back
to green — and to red at or below 20%, so a device that needs attention stands out without you
computing the color. charging: true adds the bolt overlay. Large Home Screen widgets
list all eight devices; smaller families render as many as fit, taking them from the front of the
array, so put the devices you care most about first.
The devices array is replaced wholesale by a merge patch, not merged element by element. Send the full roster on every update, including devices whose level has not changed — a patch carrying one device leaves the widget showing exactly that one device.
Add and reorder devices interactively on the playground to see how many rings each widget size shows.