I'm new to this and almost there - just a bit of help needed with BM2 battery monitoring

I have OpenMQTTGateway running on an ESP32 and it’s successfully publishing discovered BT devices to my MQTT broker, as seen in MQTT Explorer.

My aim is to use a BM2 battery monitor on our cars.

I’ve tried to white list my initial BM2 device but other devices keep showing up. I’m seeing this from my retained config publish:

Secondly, when I see messages from the BM2 they vary, and only occasionally do I see the battery voltage.

The three message variants I see are:

{"model":"BM2 Battery Monitor",
"id":"50:54:7B:5D:A4:40",
"volt":12.95
}

{"id":"50:54:7B:5D:A4:40",
"name":"Battery Monitor",
"rssi":-63,"txpower":0,
"brand":"GENERIC",
"model":"BM2 Battery Monitor",
"model_id":"BM2",
"type":"BATT",
"batt":100,
"device":"BM2 Tracker"
}

{"id":"50:54:7B:5D:A4:40",
"name":"Battery Monitor",
"rssi":-58,
"txpower":0
}

Only the first one has battery voltage. There doesn’t seem to be any consistency.

Where am I going wrong?

Welcome @ashs

You seem to have a very unusual topic structure, and it does look like you did not include the commands sub-topic part when sending the white-list, and for commands it also needs to be MQTTtoBT, so it appears that it is not actually doing anything on the gateway, hence you also see other devices.

It would be good to see the whole expanded left structure of your gateway in MQTT Explorer, to see exactly what is going on there.

There is …
• The voltage only shows when a connection is made to the BM2, defined by intervalcnct. You don’t really want to set that too frequently, as connections actually take a toll on the battery itself, but a bit more frequent, depending on your needs, is fine :wink:
• The battery level with model and model_id is being received and decoded with every interval and the BM2 actually broadcasting decodable data then
• The RSSI only message is being received with interval as well, but when the BM2 is not actually sending any decodable information at that particular time.

I hope this helps to clarify things a bit.

Having re-read your reply several times, I’ve now fixed the Whitelist problem. Thank you.

Below is what I see in Home Assistant.


The BT: Connect Interval and BT: Scan duration number sliders don’t stick. They adjust but revert back to default settings so I’ve not been able to play around with the optimal connection and scan times to suit my needs.

Any advice?

Many thanks for your help.

Again, very likely due to the unusual topic structure of your set up. If you want to use OpenMQTTGateway with Home Assistant and want it to work correctly as expected, you really should keep the default

home/OMG_gateway_name/BTtoMQTT …

structure.

Any particular reason why you renamed all layers, and even added one extra topic layer? At least from what I can see from your deleted last images, which also looks like the white-list still isn’t working.

Thanks.

I certainly give it a try.

The reason for the structure is that I’ll ultimately have several garages under top-level vehicle batteries, each with several vehicles, all of which could be in any of the garages.

The White list is working fine now, hence the deletion of the related posts.

Many thanks for your help.

This kind of structuring should really be done in HA. For OpenMQTTGateway you should leave the default structure and only rename the gateways’ names to something like

OMG_dryderdale_garage
OMG_woodland_garage