Z2M Device Tracker

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:

  1. What you entered under Battery details in the device's Battery card (or when pairing it).
  2. Battery Notes, if you use that integration and it has a type for the device.
  3. 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:

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:

Battery brands

Battery life by brand

A battery change can record the brand of the new batteries, so you can see which ones last.

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:

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

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:

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

Batteries to buy, with spares in stock and how many to buy

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".

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.