HA/TheengsGW addon/esp32dev-ble-mqtt-undecoded to monitor battery-assist

Hello - hope someone can assist.
Trying to get battery status for my emergency generator’s 12v battery which has a “battery-assist” BLE monitor attached and looks like one of the devices Theengs supports. I’m using HomeAssistant (running on a dedicated RPi3) and since I had a spare ESP32 I installed the “esp32dev-ble-mqtt-undecoded” image on it. (I tried the “esp32dev-ble-broker” first but that is broken- you can config the network settings but can’t change the MQTT configs on it).

I originally was using a mosquitto mqtt instance on a separate linux server, but looks like the HA “Theensgw addon” is hard coded to only talk to the HA MQTT instance even if you specify a separate MQTT server in the configuration… so I switched over to using MQTT on the HA device.

Using MQTT Explorer I can see topics being posted to homeassistant/ESP-OpenMQTT/BTtoMQTT/undecoded from the ESP32 frequently. I do also see entries for the battery-assist device I want to get added in this topic.
I also see “home/TheengsGateway/LWT” online but nothing else getting posted there.
TheengsGateway log in HA shows just data like this:
18:07:29] INFO: Starting TheengsGateway…
[18:08:49] INFO: Creating TheengsGateway configuration…
[18:09:16] INFO: IDENTITIES:
[18:09:16] INFO: BINDKEYS:
[18:09:16] INFO: BLACKLIST:
[18:09:16] INFO: WHITELIST:

The OpenMQTT gateway (ESP32) device auto discovered in HA under MQTT… but nothing the gateway is seeing is showing up in HA at all?

Is it simply something wrong in the MQTT settings? I’m new to MQTT and Home Assistant…

TheengsGateway MQ settings are as follows:
MQTT_PUB_TOPIC: home/TheengsGateway/BTtoMQTT
MQTT_SUB_TOPIC: home/+/BTtoMQTT/undecoded
MQTT_PRE_TOPIC: home/presence/TheengsGateway
LWT_TOPIC: home/TheengsGateway/LWT
DISCOVERY_TOPIC: homeassistant
DISCOVERY_DEVICE_NAME:TheengsGateway

Thanks in advance!

Welcome @rcb-hp3000

The esp32dev-ble-mqtt-undecode binary is only for setups which have a central decoding instance of Theengs Gateway - as described in the Web Upload binary descriptions.

For direct decoding in OpenMQTTGateway, you need to install the generic esp32dev-ble, or any board appropriate version of it.

Depending on which battery monitor you have it might be correctly decoded already, or we can see if it is a new device for which a decoder can be created.

I thought the HA “Theengs Gateway plugin” was going to be the “decoding instance”? Do I need that at all then?
I have another esp32 with the “esp32dev-ble” image on it. It doesn’t appear to have mqtt configuration at all? It allowed wireless network configuration and was discovered itself by HA as a bluetooth device. It’s in another area of the house which isn’t in range of the battery-assist device but I can move it and see if it discovers it itself?
Here’s what I see in the logs from the unencoded ESP32 for the battery-assist device if this helps:

“id”: “DC:0D:30:DD:B2:C4”,
“mac_type”: 0,
“adv_type”: 0,
“name”: “Battery Asst”,
“manufacturerdata”: “d6050200480002dc0d302fe55e01640000af010000b5ee906ff2f920b3”,
“rssi”: -76,
“distance”: 6.44788

It really depends on your intended setup; Theengs gateway (Add-on) as the only central decoding instance along with one or more OpenMQTTGateway undecoded proxies, or Theengs gateway (Add-on) decoding as well as one or more OpenMQTTGateways also decoding alongside, or only one or more OpenMQTTGateways decoding. As both have unique features the other lacks, like OpenMQTTGateway being able to retrieve certain properties through connecting to devices, while Theengs Gateway can decrypt encrypted encodings and resolve random MAC addresses.

From your above raw data sample it seems though that this battery monitor might not be supported yet, unless it also broadcasts in the iBeacon format, with the manufacturerdata starting with "4c00…".

If the above sample data might contain decodable information would require some more samples along with the battery level and voltage from the native app at the same time, as well as some model information.

Thank you!
Sounds like my setup with the OpenMQTT (undecoded) gateway on the ESP32 feeding the HA “Theengs Gateway Plugin” should work… but I guess only if the ESP32 gateway actually recognized the broadcast from the battery-assist device?
The battery-assist device (a bluetooth wireless 12v battery monitor) appears to be the exact device someone else posted about some time ago that they had gotten working with Theengs - though maybe it’s another brand of the OEM device.
Anything I can do with the devices I’ve got to capture any other data that might help?

Only for a possible battery level, but not the voltage. For the voltage you would need to have the decoding happening on the OpenMQTTGeway side, i. e. having the esp32dev-ble binary installed on the ESP32, ideally from the current development test builds.

And then also only if your battery monitor is a compatible BM2 model, which it might not be from your above sample. You would need to watch the message history of the device in MQTT Explorer, to see what kind of different broadcasts it might be sending.

I re-imaged the ESP32 using the esp32dev-ble image and pointed it at the mqtt server in HA. It’s not adding any new devices to HA either. I see 3 other bluetooth devices being reported in MQTT Explorer but nothing in HA for them either (a u-bolt lock, a galaxy s5 phone, and something else with just a id/name/rssi value - I guess they’re not recognized either).
There are 2 everything-presence sensors that were discovered and added successfully when I first installed the other ESP32 so SOME things did work.
All I’m seeing in the MQTT explorer from the battery monitor are messages like this:
{“id”:“DC:0D:30:DD:B2:C4”,“name”:“Battery Asst”,“rssi”:-79}

Your battery monitor definitely seems to be a different device to what you read in the other thread, not a compatible BM2 nor BM6, but might still be sending decodable broadcasts for which we might be able to create a new decoder.

Can you send a link to the your battery monitor?

What does it report as in the native app?

Can you turn on BT: Advanced and Advertising Data in the gateway HA UI, and then post some sample undecoded messages along with the battery level and voltage as shown in the app at the same time?

I bought the battery monitor 4 or 5 years ago now… don’t have a link for it.
I’m thinking at this point I’m better off just buying a new one that DOES work “out of the box”? They seem to run less than US$40. Is there a link for a device that DEFINTELY works?
The app (Vgate Battery Asst) does show charging status and battery voltage… but of course only when my phone is within a few feet of the generator (being in a metal box and outside a cinder block wall doesn’t let the signal transmit very far).

The battery monitor which does work for decoding its battery level in percentage as well as the actual voltage, with OpenMQTTGateway is the BM2, with Theengs Gateway it can only retrieve the battery level in percentage, as the voltage does require a connection to the devices - currently limited to OpenMQTTGateway.

I’ve ordered the BM2 you specified… Once I get it and get it hooked up to my generator’s battery I’ll try again :slight_smile:
Thanks again!