It's time to fix Aqara battery bug

The battery level worked until a certain release then… 100% for all devices.
Is somebody working to fix this bug?
Today I found a sensor unavailable. I believed it was the “usual” Aqara end device tht sometimes loses the net.
Instead the battery was low.
I think development and/or bug fixing is slower than before.
From May 2022 we had 5 releases only (3 of them were pre-releases).
I remind Conbee II is a commercial product.

When my Aqara Temperature and Humidity Sensor battery went to 55%, it began to intermittently report -100 C. I just noticed it from my heatpump starting to heat on a warm summer day…

Hi,

There’s a lot of issues waiting. Some more pressing than others. Battery has never been reliably reported by these. I have some and they also suddenly die. I even monitored the voltage in the clusters and it was dead just the other day. Its part of the quality i suppose. Cant have it all.

I believe your Conbee II is working, just one device is not :sweat_smile:. That being said, there is no obligations here. Perhaps @de_employees can explain us what users can expect in terms of these things.

@woodhead Thats a clue that the battery is nearly empty.

1 Like

Ha yes, it s something normal. They report - 100°C when the battery is dead.
Remember you can change the battery when it s under 80% (80% mean 80% charge, not 80% life)

@LeoeLeoeL can you be more explicit about the model ? To know if your issue is new/know/already corrected/not an issue. And your deconz version.

Have you check the value in deconz to see if the value in the APi is bad ?

There’s a git issue already. Please check there.

I know the issue is well known.
It’s a regression.
Normally a regression is fixed by the following release.
But not this time.

My WSDCGQ11LM Aqara multi/temperature sensors show this behavior too - and I suffer quite a lot because of this.

Battery reported 78 %, last updated 3 days ago.

I am wondering what’s the current status of this “minus 100 degree bug”.
Can and will it be fixed in deCONZ?

Currently I put a lot of effort into
a) detecting


b) manually fixing those incidents afterwards in the recorder database of HA which can take hours of time depending on the amount of sensors and incidents (it will however stay in the InfluxDB forever and render historic calculations basically useless)

If required/necessary, I can create a dedicated topic for this -100° bug as this one initially was/is about the basic battery bevior of those sensors.

I think HA should have a configurable sensor sanitizer through which all data is processed before it is made available and recorded. That would solve the problem with aqara sensors and many other (like sonoff).

As mentioned before: This happens when the battery is near dead. It’s in the device’s firmware.

And for Xiaomi 78% don’t mean 78% of his life, but battery level, so you can change it.
The battery discharge is not something proportionnal, you have 100% during 2 years, 90% during 1 years and 80% to 0 % in some months

@woodhead

No I don’t think so. HA should not work around all hardware issues as it is „too late“ in the line:

> 1) hardware/firmware —> 2) coordinator / integration (deCONZ) —> 3) smart home platform (HA)

I want to have that fixed as early as possible. If 1) is no option, 2) should take care of it. It is much closer on the hardware level (1) than 3.
INTERESTINGLY I‘m not aware of this and similar device issues (not only Aqara) with other integrations like ZHA or ZB2MQTT. deCONZ seems to be outstanding in terms of weird device symptoms.

@Mimiix:

I know. No reason for deCONZ not taking care of it. Simply ignore all -100 degrees values. It is possible right?!! See text above.

@Smanar

I know all that stuff, every Aqara user does that sooner or later :wink:

My basic message: let’s fix that in deCONZ. Not sure if it’s possible to do that with DDF, I guess not.

It is going to be a bit hard to make rules for all firmware issues devices present. I’ll ask @de_employees to reply to this as they need to make a statement on it. I have no influence on what @Developer need to change and what not. Be adviced that this is easy to fix when you change the battery.

From my personal standpoint: I think the device should have correct firmware. It’s cheap and that comes with downsides. This is not something deCONZ is obligated to fix. When you “modify” sensor results, you are going to use compute,which for 1 device isn’t an issue but that might increase if more is going to happen. Thjat will cause deCONZ to be more CPU hungy and grow bigger. Additionally, deCONZ presents the raw values here and does not touches it. If you start checking the actual results, this is going to get ugly real fast. So if something goes wrong like this, you can adjust it on the place where you are parsing / using it. In your case: Home-assistant. This is the way it works in the data world aswell: you modify as late as possible to avoid any issues with data quality. Again, this is my personal stance on it. Additionally: I’ve never seen this on my aqara devices.

I try to avoid doing anything but scaling values in the integration. If you want it in home assistant you can probably utilize a template sensor

And yes if you have a DDF can try to remplace

"eval": "Item.val = Attr.val;"

by

"eval": "if (Attr.val > -50) {Item.val = Attr.val;}"

2 Likes

I’d love if deconz would simply ignore -100° updates. But I understand it’s an issue with the sensor and not deconz. That means it still affects all deconz users that happen to have aquara sensors, which is a huge share…

That messed up my temperature graph that I create from mysql data in openhab.

I gave that issue to openai and the AI came up with the idea of an SQL trigger. I am still stunned by the state of AI nowadays but would like to share the code in case someone needs it:

DELIMITER $$

CREATE TRIGGER no_negative_hundred
BEFORE INSERT ON your_table
FOR EACH ROW
BEGIN
IF NEW.value = -100 THEN
SIGNAL SQLSTATE ‘45000’ SET MESSAGE_TEXT = ‘Updates with value -100 are not allowed’;
END IF;
END;

$$

DELIMITER ;

2 Likes

I bring data from deCONZ into Zabbix using the deCONZ API and use Zabbix preprocessing steps to discard out-of-range values.
I also had noticed these Aqara -100 blips but wasn’t aware it was a battery degradation indicator. Annoying, because the one it has been happening to the most recently had a new battery only in August and is now at 55% already.

You can change Xiaomi battery when then go under 80 %.
The percent is not the life duration but the battery level, it will be 100% for 80% of his life.

It’s a very stupid way to indicate a %.
HUE and Netatmo use almost the full range 0-100 to indicate the battery status.

Lol, it’s because the percent is easier to understand than a voltage.
But even for brand that use it as battery life (Ikea do it too), the accuracy decrease with the %.

I totally agree. Comes with the price i suppose.