Batteries
Battery devices get a Battery card under Overview on their device page, and the tracker keeps a daily battery reading for each one for 400 days. If you chose the side panel or pop-up in Settings → Device details, it's the device's Battery tab instead.
Upkeep → Batteries has the batteries to buy, your spares and how long each brand lasts.
Battery type
Each battery device can have a battery type and count, for example CR2032 or 2× AAA. The tracker takes it from the first of these that has one:
- What you entered under Battery details in the device's Battery card (or when pairing it).
- Battery Notes, if you use that integration and it has a type for the device.
- The built-in library, a copy of the Battery Notes device library, matched on the device's manufacturer and model. Shown as "suggested by the Battery Notes library". It was last updated in 2.4.1 (2,388 devices).
The Battery card says which one it used. The type also appears as the Battery type entity (see Home Assistant entities) and in the CSV export.
You can also note the date the batteries were First installed.
Replacement records
Each battery device keeps a Replacement history, with the date, where the record came from and an optional note. A replacement is recorded when:
- you press Battery replaced on the device's page and pick the date (any date). A device with a low battery shows it in its What to do block too;
- you press the device's Battery replaced button entity in Home Assistant, or Battery replaced on a phone alert (today's date);
- you tick its battery type on the battery to-do list, or call the
z2m_tracker.battery_replacedaction (needs the integration); - the tracker sees the battery level jump up by 25 points or more in a day, recorded as "Detected". See Detected battery changes.
If the device is also set up in Battery Notes, recording a replacement in the tracker also sets Battery last replaced in Battery Notes, so the two stay in step. The newer of the two dates is shown as last replaced.
Remove entry deletes a replacement record. It's removed from the tracker only; Battery Notes isn't changed.
Detected battery changes
Some devices report battery levels that jump around, and every jump would count as a new battery and take one from stock. Three settings decide how a detected change is recorded:
- Settings → Batteries → Detect battery changes (
battery_auto_detect, on by default). Off records battery changes only when you mark them with Battery replaced. - Settings → Batteries → Ask before recording (
battery_confirm_detected, off by default). A detected change waits in the device's Battery card as New battery?. Confirm records it and takes the batteries from stock. Dismiss drops it. Marking the battery replaced also answers it. - Battery level unreliable, a switch in each device's Battery card. That device's jumps are never treated as battery changes, and it gets no battery estimate or drain rate. Its level and the low battery check stay as they are.
Battery brands

A battery change can record the brand of the new batteries, so you can see which ones last.
- Keep your list of brands under Settings → Battery brands, or with Manage brands next to the brand dropdown. Removing a brand from the list doesn't change changes already recorded. The list holds up to 50 brands.
- When you record a replacement with Battery replaced, pick the brand from the Brand (optional) dropdown. It starts on the brand you used last for that battery type.
- Change brand on a replacement record sets or clears the brand afterwards.
- The
z2m_tracker.battery_replacedaction takes an optionalbrand. A brand that isn't on your list yet is added to it. - The CSV export has a
battery_brandcolumn.
The Battery life by brand card on Upkeep → Batteries compares brands for each battery type: the average time from one battery change to the next on the same device, the shortest and longest, and how many batteries were used up. Only batteries that have run out count. The battery in a device now hasn't run out yet, so it's shown as "in use now" but not in the average. Changes within 3 days of each other count as one.
Estimates
Once a battery has at least five daily readings spread over two weeks since its last replacement, the tracker fits a straight line to the last 120 days and estimates the days until it reaches 10%. The estimate:
- shows in the device's Battery card, in the battery figure at the top of its page, and as the Battery days left entity;
- raises Battery running down on Health when it's 45 days or less;
- drives the shopping list below.
No estimate is made while the level is flat or rising, because many devices report in coarse steps, or when the device's battery level is marked unreliable.
The Trends card on the device's page draws the battery level over up to 90 days, with each replacement and the projection to 10%. See Devices and history.
Shopping list

Batteries to buy on Upkeep → Batteries groups devices whose batteries will need changing soon by battery type, with the total number of cells needed for each. A device counts when:
- its estimate is 60 days or less; or
- it reports low battery; or
- its level is 25% or less and there isn't an estimate yet.
When you record a replacement (in the app, from Home Assistant, or in Battery Notes), the device leaves the list until it next reports a battery level. If that reading is still low, it comes back. Replacements the tracker detected from a jump in the level don't count, because the new reading is already there.
The weekly summary and the summary card include the same list. With the integration, it's also a Home Assistant to-do list: tick an item when you've changed those batteries. A calendar shows each device's predicted replacement date. See Integration and card.
Devices without a battery type are grouped as Unknown type, so add types to make the list useful.
Battery stock

The Batteries to buy card also keeps count of the spare batteries you have. Each battery type has a row with In stock, Needed and what to buy: Buy 3, or Enough when your spares cover it. The card's subtitle sums it up, for example "Buy 2× CR2032, 4× AAA for the next 60 days", or "Your spares cover the next 60 days".
- Use the − and + buttons in In stock to change the count by one.
- To add a type that isn't listed, type it under the table (for example
CR2450), enter how many, and choose Add. Types are matched without regard to case, soaaacounts asAAA. - Types you have in stock but don't need yet stay on the list, with nothing needed.
- Unknown type has no stock count.
When you record a battery change, the batteries come out of stock: as many as the device takes, never below zero. That happens for a change dated in the last 3 days, recorded in any of the ways listed above. A detected change waiting for Confirm takes nothing until you confirm it. If the same change is recorded twice within 3 days, for example by hand and then detected from the level jump, stock is only taken once. If you delete the replacement record, its batteries go back into stock.
The stock is kept in the app's data, so it's in the backup. With the integration, each item on the battery to-do list starts with how many are needed and how many are in stock.
Battery costs
Upkeep → Costs counts what your batteries cost over the last 12 months and estimates the next 12, from the price per battery type you set in Settings → Battery brands → Battery prices. Battery changes logged within 3 days of each other, such as one detected and then ticked, count as one change, both for battery life and for the last-12-months count. Types without a price are counted but not costed.