Integrate Bluetooth battery monitoring devices (cars, motorbikes etc.)

Ahhh… No it doesnt… I’ll try again… Thank you…

Hi
is this better?

{“id”:“94:A9:A8:42:72:43”,“mac_type”:0,“adv_type”:0,“name”:“Battery Monitor”,“manufacturerdata”:“0d658b3c0df642e282dd9840b13e4aa7”,“rssi”:-62,“txpower”:0}

1 Like

Perfect, and if you wait a bit or look at your history you may have a message with "model":"iBeacon" like this:
{"id":"11:22:33:44:55:66","rssi":-87,"brand":"GENERIC","model":"iBeacon","model_id":"IBEACON","mfid":"4c00","uuid":"655f83caae16a10a702e31f30d58dd82","major":-4094,"minor":0,"volt":0}
This one is very interesting for us as it is causing troubles in the integration and need to be filtered.
So if you could share one like that please

Hi
Sorry, I’m not seeing those iBeacon messages in my mqtt, but I did find in my home assistant a file called bluetooth.remote_scanners which had this (if its any help):

        "94:A9:A8:42:72:43": {
          "device": {
            "address": "94:A9:A8:42:72:43",
            "name": "Battery Monitor",
            "rssi": -82,
            "details": {
              "source": "78:21:84:9b:56:0c",
              "address_type": 0
            }
          },
          "advertisement_data": {
            "local_name": "Battery Monitor",
            "manufacturer_data": {
              "76": "0215655f83caae16a10a702e31f30d58dd82f641505164",
              "25869": "8b3c0df642e282dd9840b13e4aa7",
              "25172": "f34c92a7374a306e9cb8288528a7",
              "15540": "3a552b95b35cb2828303454d52c9",
              "29977": "420e5334bbe464c6b1659d940607",
              "9112": "3637fa097b5ff673c5a26b70ad75",
              "15864": "7bc9a84a93164bcafb46393a98f7",
              "53974": "8efe659ade5b0bb5b6dec64fd5c4",
              "32202": "e18d8b9a0faa8c21ea486fe990e9"
            },
            "service_data": {},
            "service_uuids": [
              "0000fff0-0000-1000-8000-00805f9b34fb"
            ],
            "rssi": -82,
            "tx_power": -127,
            "platform_data": []
          }
1 Like

Hello,

You can test if it is working with the development version of OMG, it can be uploaded directly to an ESP32 from below:
https://docs.openmqttgateway.com/dev/upload/web-install.html
Choose esp32dev-ble

You can adapt the frequency of connection attempt to the BM2 by changing the parameter below:
image

image

1 Like

THANKYOU!

I have been running a number of BM2’s with Ultimate9 BM (Android) for a very long time.
Nothing I had been trying was working until this release.

I am using these BM2’s

image

With ESP32-WROOM-32 flashed with esp32dev-ble (dev SHA:ac0215) and it works beautifully!

The MiFlora plant monitors on this page are currently connected using Bluetooth proxy (HA BLE Proxy). However, looks like I will now be flashing them with OMG 

3 Likes

Thanks for the feedback, indeed the BM2 support is now integrated into the releases.

Unfortunately next to the Theengs app still not sending the Mi Scale values to MQTT (nothing received at all even connection is shown as fine) I am stuck at the very beginning with (Option 1) Upload from the web | OpenMQTTGateway v1.5.1.

After flashing the ESP when scanning for the ESP WiFi according to Wifi and MQTT configuration | OpenMQTTGateway v1.5.1, it just does not show up.

Flashed the ESP several times, using different environments. I used esp32-lolin32lite-ble and esp32dev-ble. Same output.

Hardware is a LOLIN32 (https://www.amazon.de/AZDelivery-LOLIN32-Bluetooth-kompatibel-Arduino/dp/B086V1P4BL).

Any ideas?

Could you try to erase the ESP with this website and reflash with OMG web upload:
https://espressif.github.io/esptool-js/

Hi @e-raser, would you mind telling us which model of the Mi Scale you have, as with my Mi Body Composition scale XMTZC05HM it is correctly registered in the App, and also has its values being transmitted via MQTT messages.

Do you see your scale messages when monitoring with MQTT Explorer? So it could possibly be just a discovery issue for HA.

Which phone OS are you using the Theengs App with?

Similar with The flashed ESP32s, in your case the LOLIN32 Lite board, for which the esp32-lolin32lite-ble is the correct binary.

Once installed you should see it coming up connected to your broker, monitored with MQTT Explorer. The Mi Scale should also show up there if you do a weighing. With the ESP32 it will also give you the MAC address of the Mi Scale.

Do enter this MAC address in the Mi Scale details page of the App, if you are using it on iOS. Once the MAC is entered which should now also allow and show the Mi Scale being published via MQTT from the App.

Let us know how you get on.

Hey folks!

I have a BM2 battery monitor like the ones mentioned in this thread, & want to get the levels etc into HA. This thread & the OMG + HA websites have been awesome to learn from!

I’m totally new to MQTT / HA, & have the following setup:

ESP32: Olimex GW + Wifi (standard & latest OMG install, flashed w/ serial cable, + wifi manager configured w/ Topic below)
Broker: test.mosquitto.org
Topic: Doles_Farm/Garage/
HA: 2023.4.6 (running on a Raspberry Pi 4)

Using MQTT Explorer I can see system type messages, but I haven’t seen a single BM2 monitor message (however I know it’s working when I use the companion app standing next to the car!).

These are my HA settings:

I’m probably doing something really stupid, but I’d just love to see some BM2 messages in my broker :crazy_face:

Any help would be greatly appreciated :+1:

OK, strangely enough, I just happened to move the ESP32 closer to the car/BM2 sensor (it was only ~5m away to begin with, so placed it right on the bonnet of the car!) & I started getting these messages :star_struck:

{
   "id":"94:A9:A8:3A:FE:12",
   "mac_type":0,
   "adv_type":0,
   "name":"Battery Monitor",
   "manufacturerdata":"4c000215655f83caae16a10a702e31f30d58dd82f3f24db13f",
   "rssi":-82,
   "txpower":0,
   "brand":"GENERIC",
   "model":"BM2 Battery Monitor",
   "model_id":"BM2",
   "type":"BATT",
   "acts":true,
   "batt":63
}
{
   "model":"BM2 Battery Monitor",
   "id":"94:A9:A8:3A:FE:12",
   "volt":12.37
}

Any ideas why it would need to be so close? I bought the ESP32 model that came in the metal box, so I guess that could be acting like some sort of shield maybe?

The question I have now is…why are these values not being auto-discovered by HA? I saw in some of the previous comments that there’s often a sensor grouping before the device name, is that’s what’s needed?

So my topic hierarchy would be: Doles_Farm/Garage/BTtoMQTT/sensor/94A9A83AFE12

@1technophile or @DigiH - sorry for the direct ping, but you both seem super knowledgeable in all this, so I was wondering if you’d mind taking a quick look over the above please?

As I say, I’m sure it’s something I’m doing, but can’t figure out what :man_shrugging: Thanks so much in advance.

Would you mind posting a picture of your ESP32? I’ve never seen any model enclosed in a metal box, and as you correctly stated, I would assume this negatively affecting the reception of the PCB antenna. Definitely worth trying it without the metal encasing.

There are always discussions and tests made by users on which ESP32 models might have the best reception range, with and without external antennas, so you might want to have a read through one like

With the HA auto-discovery I am not that knowledgeable, so is best answered by @1technophile

1 Like

If you don’t have the external antenna it is not good to have the esp32 in a metal box.

Are you sure the autodiscovery is activated in the OMG config ?

Thanks so much for the help so far on this gents, I really appreciate it, & think I’m SO CLOSE to getting this working :crossed_fingers:

I have however made a few changes to my setup since my last update, mainly to cut out as many variables as I could that could prevent it from working:

  • Upgraded HA (to 2023.5.0)
  • Switched to using the local Mosquitto broker add-on w/in HA (running v1.5.1)
  • Brought a spare car battery & the BM2 monitor into the office (so I don’t need to keep going to the garage & to rule out any wifi/connectivity/distance related issues)

With the HA controls sets as per below:

The BM2 connected to the broker, HA picked up the device (OpenMQTTGateway_Garage), & I’m seeing this type of message in my broker:

{
   "id":"94:A9:A8:3A:FE:12",
   "mac_type":0,
   "adv_type":0,
   "name":"Battery Monitor",
   "manufacturerdata":"4c000215655f83caae16a10a702e31f30d58dd82f471000047",
   "rssi":-68,
   "txpower":0,
   "brand":"GENERIC",
   "model":"BM2 Battery Monitor",
   "model_id":"BM2",
   "type":"BATT",
   "acts":true,
   "batt":71
}

Sadly though, I’m still not seeing the batt sensor info in HA :face_with_raised_eyebrow:

Any ideas @1technophile?

As for my ESP32, this is what I have, which definitely has an external antenna :grinning:

It should be a separate device look for BM2 in Settings-> Devices & Services → Devices

image

Hope it helps

1 Like

If the antenna is correctly connected to the ESP32 inside that’s good. I have this one also

1 Like