Bluetooth - BTHome & ATC MiThermometer : Decimal Places

We have now moved across to the new Bluetooth proxy. All working well. Our ATC MiThermometer sensors now report in 2 decimal places. We didn’t have this before. We would like to choose how many decimal places are shown.

like rather than 11.12 °C we would like 11.1 °C
and
rather than 67.74% we would like 68%

maybe this can be done in the settings of the entities & rounding of values.

temp_readings

what do you think?

Just come across the same, after updating to firmware 3.8 and setting the BTHome profile - it seems to create a huge amount of unnecessary data for a 0.01 change in value :slight_smile:

At the moment, I believe, the only option would be a template sensor for each, to round the values to required decimal places.

I would have thought this is ‘better’ done in the firmware on the device themselves? Rather than HA?

Yea and I think my battery levels are dropping faster than before too.

Really we only need one decimal point for temp, none for humidity and one decimal point for volts. I just don’t think we need to be any accurate than that (sensor isn’t even that accurate from one to another). Battery % is good at none. So they could just set that for default.

Might have to go back to mijia rather than using BTHome.

By default, I think version 3.8 broadcasts measurements every 10 seconds - 2500ms x 4, I changed mine to 5000ms x 24 (2 minutes)…which is much more reasonable :slight_smile:

So the ‘beacons’ for discovery go out every 5 seconds, then measurements every 2 minutes.

Yea I have mine on 2500 x 25 (1.04 minutes)… I have had mine for 11months now and they were on 60% battery life with the same settings, been good battery life… now with the new BTHome or 3.8 I just checked and looks to report randomly some temps ever 2 min some humidity every 30 sec but then 1, 2 min. Just does whatever it likes.

hmmmm :thinking:

Do you also have a USB BT dongle? Or BT on the HA box?

I was seeing some strangeness with that and bluetooth_proxy - some Xiaomi sensors running BThome/3.8 further away, seemed to have a lower RSSi to the USB BT dongle (even though there was an ESP32 closer) so HA was listening on the dongle…but various messages never actually appeared in HA.

Removing the USB BT dongle as a test, just having the bluetooth_proxy nodes, things seem to be much more stable.

some are connected to the pi and some are connected to the proxy… I just looked at the history and shorten the time frame… because the temp has 2 decimal places every time the temp changes 0.01 degree the sensor updates… this is probably why my battery’s are being drained… going to set one back to mijia now and see what happens.

maybe another good reason they should shorten the decimal places.

Came across this:

“I don’t use BTHome because my practice of working with him showed that this is the worst decision. Too many data drops and freezes due to the use of ESP chips that are not designed to fully work with TCP protocols. It uses truncated protocols that do not meet the general specifications and the chip architecture is heavily overloaded, which leads to numerous failures. Moreover, such a system is not adapted and is not suitable for autonomous power supply. Those. in case of failure of the external supply of energy, everything goes out of order.”

… although I’m not sure I agree with the assessment there, in my experience…although no doubt they have data to back up the various statements on that post.

Getting rid of the BT attached directly to HA, other than the odd ‘lost’ message, improved consistency no end for me. My messages/measurements are pretty consistent every 2 minutes - across 4 ESP32s, 7 wall temp/humidity and probably 10 mi-flora for plants.

P.S. Those connected to the Pi BT, can be queried via active rather than passive (i.e bluetooth_proxy supported)… that’s the only way to get battery for many of these sensors if I recall, which does shorten battery.

Mijia

This is the Mijia. Now give it 10 min and lets see what happens

Thanks for the info regarding BTHome… very interesting

So it is reporting less now but still when a value changes. Below is the settings I am using. Are you using the same setting other than the 2500 I am using and you are using 5000

Not Low Power Sensor mode - I have that turned off - I read that makes them hard to interact with, if you need to. I was struggling to find a conclusive description of quite what it did.

EDIT: Having said that… although a lot is over my head:

Thanks, all my other ones don’t use lower power mode and battery was good for 11 months … I was just testing that to see if it helps. Thanks… I am now changing them all back to Mijia and ditching BTHome as it just chews batteries. Maybe one day they will fix BTHome.

EDIT: Just encase someone interested this I have also disabled my voltage entities as this will also help save battery levels

If my understanding of how this data is retrieved/heard is correct, I’m not sure it will.

In my setup currently, I can only receive Passive BLE announcements - I don’t have anything setup that can make active based connections. Active based connections impact battery life more so.

So the device broadcasts voltage anyway, as part of the passive announcement, disabling the entity in HA just means it wont get updated in HA - not that it will stop the device from including it in the messages.

1 Like

Yeah I was thinking of that last night after my post :thinking:… It would be really nice if the flasher TelinkMiFlasher.html would have a options to announce the 5 entities v Bluetooth (yes or no / or tick box) and then have the decimal option in a drop down list like (00, 00.0, 00.00, 00.000) this would resolve everything and also reduce the life of battery power not to mention unnecessary data flying around everywhere. Do everything at the sensor :wink:

But as always… it is up to the developers… very grateful for the work they have done to date :heart:

I ended up setting my devices back to MIJA (still on custom firmware 3.8) and using the Xiaomi BLE integration instead of BTHome.

The graphs are now more ‘steppy’ - there was a bug report somewhere, where someone was complaining about this, hence probably why they ended up going to 2 decimal places - but that’s fine with me.

I’m using a number of these sensors as ‘faked’ sensors for my Honeywell EvoHome heating system, when the entities were updating frequently with 0.01 changes (I think) it caused too much/more data than necessary to to be sent to the EvoHome controller.

Reverting to the Xiaomi BLE/MIJA announcements, the entity now updates less (as it’s 1 decimal place) and thus less data is pushed to EvoHome without needing to then limit it artificially.

Yeah I have done the same and updated all my automations. I just added a sensor 2 weeks ago and I am already on 73% battery… not good

As my above post wouldn’t it be nice if you had the option to broadcast the Bluetooth announcements as I really don’t need 13 humidity & battery voltage sensors around my house and growing.

My sensors have settled down now I am using MIJIA and on custom firmware 3.8.

Update: All my battery levels are stable now using MIJIA for the Advertising type… I don’t know if it was BTHome Advertising type that drops the battery fast but I just don’t like the format it has, and I can’t change it unless I use Passive BLE Monitor integration that is going to be deprecated. They advise is, when all your sensors are available in Home Assistant, make the move.

MIJIA for the Advertising type works well, battery usage proven to be good and I like the format… so as they say if it is not broken don’t fix it.

I have 3 LYWSD03MMC using MIJIA for the Advertising type and after 12 months the battery are 43%, 60% & 61%… Not bad :slight_smile: I have just added another 10 of them and they all look stable now.

Maybe if HA adds the option so that you can change the decimals as I prefer the MIJIA format rather than BTHome format.

MIJIA Format
MIJIA Format

BTHome Format

@Blacky hi there, may I know if your mi ble thermometer is flashed with ATC custom firmware?(like suggested by the topic title).
If so how did u migrate from esphome-ble-tracker to hass-BThome? Thanks!

1 Like

Hi @kerbal

Yes all my LYWSD03MMC are flashed with ATC_MiThermometer firmware. Here is the link to the flasher Click Here

Before we had HA Bluetooth we had to insert some code into our ESP32 YAML like below

## For Xiaomi Temp Sensor
esp32_ble_tracker:

sensor:
  - platform: xiaomi_lywsd03mmc
    mac_address: "A4:C1:38:B1:CD:7F"
    bindkey: "eef418daf699a0c188f3bfd17e4565d9"
    temperature:
      name: "LYWSD03MMC Temperature"
    humidity:
      name: "LYWSD03MMC Humidity"
    battery_level:
      name: "LYWSD03MMC Battery Level"

Now with HA Bluetooth we no longer need some of the code so we can remove the sensor information and just put this

# For Bluetooth Proxy
esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:
#  active: true

I comment out (#) the active connection as these sensors don’t need it.

Once you update your ESP32 with the above code you just restart your HA. (Don’t need to restart but I like doing it I think it helps).

Even if you haven’t flashed your LYWSD03MMC it will show up in the auto discovery. I like to flash it as it gives you some custom features I like. You then just adopt it and your done. Sometimes it takes a wile for all the entities to show up but just wait and they will appearer.

Now if you would like to use BTHome as your advertising type in the flasher of ATC_MiThermometer you have a option to select the advertising type. Just elect BTHome and click “Send Config” button, see below. This is all my settings I use. I like MIJIA rather than BTHome as it uses less decimal places. Each to there own :grinning: :+1:

3 Likes