Now everything makes sense, there’s indeed a bug in SmartThings that will generate false low-battery warnings that nobody but me could experience!
.
I was able to replicate it, happens right when the hub restarts. That’s why I associated it to a hub update, my hub only restarts when it updates (or the eventual country-wide power outage, now that I recall).
The funny stuff: of the 8 buttons using the same driver, I only get 2 or 3 false low-battery warnings and at the same time. They don’t correlate to any actual battery level report received, there are no battery reports at all because that happens every 6 hours, not on demand when the hub restarts, and I was logging before driver initialization to confirm it.
What triggers it and why does not happen to everybody using my driver?
Turns out three months ago I added a feature that never published to the shared channel to populate on initialization the battery type (CR2032, AAA) and the battery quantity (1 or 2) so SmartThings can display it. You’re not missing out much:
2025-05-31T17:50:58.222904345Z INFO Ikea Button Tweaks <ZigbeeDevice: a12a2b84-112a-425c-967a-9ecc9267c16a [0x9A25] (SOMRIG Button)> emitting event: {"attribute_id":"type","capability_id":"battery","component_id":"main","state":{"value":"AAA"}}
2025-05-31T17:50:58.415372261Z INFO Ikea Button Tweaks <ZigbeeDevice: a12a2b84-112a-425c-967a-9ecc9267c16a [0x9A25] (SOMRIG Button)> emitting event: {"attribute_id":"quantity","capability_id":"battery","component_id":"main","state":{"value":1}}
I am quite sure this is what triggered it, even if it’s not a battery level report.
It is not a spread bug because only one stock driver uses this feature (an Aqara lock, source here) so very few people could experience the issue. On top of that, there’s a race condition for it to happen…
My theory of the bug
I believe it’s sort of a race condition at initialization after a hub restart: as soon as the battery capability is involved because unrelated attributes are emitted (the type and quantity), SmartThings checks the battery level and, since it’s been restarted maybe the value has not sync’ed yet with the cloud or the cache and it’s zero so it triggers the warning. Makes sense that it reports less than 1%.
The race condition explains why it does not happen in the 8 devices and only 2 or 3 that sometimes are random: because that’s the time it takes for the data to sync. By the time the attributes for the fourth button are emitted, the battery capability has been already populated from cache and no warning was generated since it was over 60%.
I guess the fix would be for SmartThings to wait after a hub restart to ensure that the battery level is an actual reported value and not a pre-initialization default value which is what apparently triggers it.