For the past few weeks, every morning I’ve been getting a notification from Home Assistant telling me that some of my sensors have low batteries. I told you a while back how we could set up this automation from Home Assistant and from Controller for Homekit, since the Apple Home app doesn’t give us this information—at most it shows a tiny low-battery warning for a device when it has minutes of battery life left, which isn’t reliable at all. Anyway, the thing is I need to tweak the notification because it tells me which devices have batteries about to run out, but not which devices are already dead… long story short, I realized I had several devices with dead batteries… so I stocked up on batteries on Amazon and decided to change the batteries in all the sensors, buttons, and devices I have connected to Home Assistant and HomeKit. All of them, mind you. Didn’t matter if the battery was dead, running low, or relatively fresh… this way I have them all under control and can roughly track how long they last. I also logged it in my second brain, this trendy concept of keeping everything in markdown files in some system so you can ask your AI agent of choice «When did I last change the batteries?» and have it tell you. In my case I do this with Obsidian—I’ll tell you more about this nonsense another day if you’re interested.
I also took the chance to change the batteries in aaaaaall the AirTags around the house… more than twenty CR2032 batteries in total. A thrilling afternoon, as you can see, and then people tell me I don’t know how to have fun! Ha!
Most of the devices came back online as soon as I put in the new battery, but four Aqara Zigbee sensors kept showing up as unavailable. The fix wasn’t to delete them or create new devices: I re-paired them with ZHA without removing them first, and Home Assistant kept their names, rooms, entities, history, and automations intact.
So today we’re going to look at how to re-pair a Zigbee sensor in Home Assistant without having to set up your whole house again, why changing the battery isn’t always enough, and what information ZHA uses to recognize that it’s still the same device.
Changing the battery isn’t always enough
The four devices that didn’t come back on their own were Aqara sensors integrated directly through ZHA, without using the Aqara bridge:
Device
Last signal before recovering it
Bedroom temperature sensor
March 4, 2026
Kids’ room temperature sensor
February 19, 2026
Yago’s temperature sensor
April 8, 2026
Washing machine leak sensor
September 16, 2026
One of the Aqara Zigbee temperature sensors I have scattered around the house.
As you can see, the three temperature sensors had been silent for months. The leak sensor had been out for less time, but it behaved exactly the same way… you change the battery, Home Assistant is open… and the device just doesn’t update its status.
And watch out, because when a sensor doesn’t come back after a battery change, the usual reaction is to delete it from Home Assistant and add it again. In fact I was about to do exactly that, but then I discovered that would have been the one step that caused me the most extra work.
Don’t delete the device before trying to recover it
The spoiler is that if a Zigbee sensor that was already working in ZHA loses connection, first try getting it to rejoin the same network without deleting its entry from Home Assistant.
If you delete it and then add it again, Home Assistant may create new entities. Even if you give them the same name and the same location, any automations pointing to the old entities can stop working; plus, with a temperature sensor, you’d lose the continuity of the history. Not to mention the history itself, which, in the case of a temperature sensor, is actually kind of nice to keep around.
However, if you open pairing mode in Home Assistant, you can rejoin the very same device—I’ll explain this now—but if you haven’t deleted it, ZHA recognizes its physical address and reuses what it already had on record.
How I re-paired the Aqara sensors with ZHA
So here’s what I did. Keep in mind the exact button and sequence can vary depending on the brand and model—re-pairing a Philips Hue smart button, which I have several of and which work beautifully, isn’t the same as re-pairing an Aqara temperature sensor, so it’s worth checking the device manual too, or asking ChatGPT, Claude, Gemini, or the Domótica Compatible Telegram group, you know the drill. So here are the steps I followed:
I put in a new battery, and a good one at that—I bought Duracell. It’s incredible how much of a difference there is between an Amazon Basics battery and a Duracell.
In Home Assistant I went to Settings → Devices & Services → Zigbee → Add device. This left the network open for pairing for 254 seconds.
I held down the sensor’s button for about five seconds, until the blue LED started blinking. On the Aqara leak sensor, the button is basically the entire top cover.
During the first minute I briefly pressed the button every few seconds. These are battery-powered sensors and they go back to sleep very quickly; if you don’t keep them awake while ZHA finishes interviewing them and setting up their attributes, the process can get stuck halfway through.
I did the whole process near an outlet or a permanently powered Zigbee device, which acts as a router for the network.
I waited for Home Assistant to finish the setup and checked that the entities were updating their values.
The leak sensor didn’t actually enter pairing mode on the first attempt, and absolutely nothing happened. It’s located under the washing machine, pretty far from the coordinator, so I pulled the washing machine out a bit, took the sensor to the living room, where I have the smart home hub, and repeated the long press there. This time it paired; afterward I put it back under the washing machine. The sequence depends on the model. For example, the Nanoleaf bulbs I mention at the end of the episode enter pairing mode by turning them on and off five times, with less than a second between each toggle. There’s no universal combination: check the manual before trying things blindly.
With some Aqara devices you need patience: ZHA’s own documentation warns that certain Xiaomi and Aqara models may require several pairing attempts.
On the Aqara leak sensor, you hold down the top cover to trigger pairing.
Why they kept their name and automations
A Zigbee device uses more than one address. Simplifying a lot, it has an IEEE address, or EUI-64, which physically identifies the device and stays fixed, and a short network address, which it receives when it connects to the Zigbee network and which can change.
The bedroom temperature sensor, for example, previously had the short address 40472, and after rejoining it received 5810. The network address changed, but its physical address stayed the same.
ZHA uses that IEEE address to identify the device. When it detected it was the same device it already knew about, Home Assistant reused its entry: same name, same entities, same room, same history, and same automations.
This is the difference between rejoining a device to the network and deleting it to create a new one. From the outside both processes look similar because we press «Add device» and put the sensor into pairing mode, but the result in Home Assistant can be completely different.
If you also expose those entities to Apple Home through the Home Assistant bridge, keeping the original entities also saves you from having to rebuild the whole layer that depends on them. We’re not doing a migration or creating a different sensor: we’re waking up and recovering the one that already existed.
Why a new battery didn’t bring them back on its own
I don’t have definitive proof of the cause, so this is a hypothesis based on how these devices work and on what I observed during the recovery.
Battery-powered Zigbee sensors are low-power end devices. They spend almost all their time asleep and usually depend on a coordinator or a permanently powered Zigbee device acting as a router that forwards their information.
After several months of being silent, it’s possible that the device acting as their «parent» no longer maintained its relationship in the network, and the Aqara sensors weren’t able to find a new route on their own. Putting in a new battery turned them on, but didn’t force the whole rejoining process. By opening up the network and manually triggering pairing mode, the sensors registered again and received a new network address.
The somewhat quirky way some Aqara devices implement Zigbee might also play a role. Home Assistant’s own documentation explains that not all manufacturers follow the standard the same way, and that Xiaomi and Aqara devices may need repeated pairing attempts.
The practical conclusion doesn’t change even if we can’t prove the exact cause: if a device’s battery had been dead for a while and it doesn’t come back after replacing it, try a controlled rejoin on the network before deleting it.
The battery reading can take a while to show the correct value
Another curious detail was the Kids’ room sensor. Right after re-pairing it, it still showed 16% battery, even though I’d just put in a brand-new CR2032. Shortly after, it updated to 100%.
That didn’t mean the battery was bad. Home Assistant was just showing the last known reading until the sensor woke up and sent the new value. Some devices update their battery status infrequently, and besides, the percentage is usually an estimate calculated from voltage, not a perfect measurement of remaining energy.
We already talked about this in the periodic review of automations and batteries and when we set up the low battery notification. The Apple Home app simplifies this even further and often only shows the low-battery warning when the device is nearly dead.
Logging the maintenance in Whis
Since I’d just changed twenty batteries in one go, I also did something that’s going to be more useful a few months from now than it is today: I saved the date and the list of devices in Whis, my personal knowledge base.
The idea is to be able to ask it later on «When did I last change the batteries on the home sensors?» and compare the answer with the percentages Home Assistant shows. That way I’ll be able to tell how long they actually lasted and spot if a particular sensor is draining much faster than the others.
An automation can warn you when a battery drops below 20%, but it doesn’t necessarily remember why you changed the battery, whether the device had been offline for months, or whether you had to re-pair it. For that kind of maintenance, a simple note with a date and some context is worth more than yet another dashboard full of graphs.
Will Matter solve these pairing problems?
Matter and Thread don’t make batteries last forever or eliminate all connectivity issues, but the newer versions of the standard are trying to make setup and cross-platform coexistence less painful. In my case, on top of that, I’m still mixing Zigbee sensors with Home Assistant and Apple Home at home.
Matter 1.6 introduces, among other things, a complete onboarding process via NFC: tapping your phone against the device can be enough to set it up even before it’s installed or plugged into power. It also adds Joint Fabric, designed so that several authorized controllers can manage the same Matter network.
It’s an interesting direction for those of us mixing Home Assistant and Apple Home, but it doesn’t retroactively fix the Aqara Zigbee sensors we already have installed. Besides, a feature appearing in the spec doesn’t mean every manufacturer and platform will implement it right away.
For now, with ZHA, the rule that’s worked for me is much simpler: new battery, open up the network, properly wake up the sensor, and don’t delete it too soon.
Compartir
Carlos Sahuquillo
'Haga lo que haga en la vida, siempre compito' - Jacques Villeneuve Reserva una sesión →
0 comentarios