Bluetooth proxy BLE to MQTT and what next?

…as my HA server is in the cellar, i’ve tried to get a bluetooth proxy working, to get access to my bluetooth switchbot hub in the basement.

So i’ve used a raspberry pi with a theengs gateway instaaled:

so the BLE information gets transfered to HA MTTQ, this is working fine…

But i’m lost on the HA side. What do i need to do there?
The bluetooth integration does not work (0 devices)

my homeassistant is running in a docker container…

Any hints what steps i need to take?

Do you have a MQTT broker set up? If not you will need one.

It won’t be under Ble but under mqtt under settings/integrations
mqtt
Auto discovery is on by default.

yess i have a mqtt server running on HA side.
The proxy has the correct ip:port and password

<log on ble proxy side is:
INFO:BLEGateway:Starting BLE scan
INFO:BLEGateway:Connected to MQTT broker
INFO:BLEGateway:Subscribed to home/+/BTtoMQTT/undecoded
INFO:BLEGateway:Sent 82 messages to MQTT/>

on mqtt side in HA side i see this:

Message 203 received on home/TheengsGateway/BTtoMQTT/C00F99071C7C at 11:50 AM:

{“manufacturerdata”: “6909c00f99071c7c00ff6656fa55”, “id”: “C0:0F:99:07:1C:7C”, “rssi”: -68, “servicedatauuid”: “fd3d”, “servicedata”: “6d00”, “mfr”: “Woan Technology (Shenzhen) Co., Ltd.”}

QoS: 0 - Retain: false

Message 202 received on home/TheengsGateway/BTtoMQTT/E7A7FB1844E3 at 11:50 AM:

{“manufacturerdata”: “a70598e782a580c63bade9”, “name”: “S17 0348 LE”, “id”: “E7:A7:FB:18:44:E3”, “rssi”: -69, “mfr”: “Sonos Inc”}

QoS: 0 - Retain: false

Message 201 received on home/TheengsGateway/BTtoMQTT/E7A7FB1844E3 at 11:50 AM:

so, MQTT is receiving, but what now? I see no devices or other stuff. The above i just read with the help of the tips i found in the mqtt config web page…

see:

Home Assistant auto discovery

If enabled (default), decoded devices publish their configuration to Home Assistant so the latter can discover them.

  • You can enable/disable this with the -D or --discovery command line argument with a value of 1 (enable) or 0 (disable).
  • If you want to use Home Assistant discovery with other home automation gateways such as openHAB, set -Dh or --hass_discovery to 0 (disable).
  • You can set the discovery topic with the -Dt or --discovery_topic command line argument.
  • You can set the discovery name with the -Dn or --discovery_device_name command line argument.
  • You can filter devices from discovery with the -Df or --discovery_filter argument which takes a list of device model ID to filter.

yes, i’ve done this, i’m just not sure if i have to do more on the BLE proxy side (pairing etc.)

my command line is:
python -m TheengsGateway -H “ip-address” -D “1” -pt “homeassistant” -st “homeassistant” -u “user” -p “password”

i’ve added -D “1” -pt “homeassistant” -st “homeassistant”

to the command line after i have no devices on the HA side, but that haven’t changed anything

the most and only difference between working and not working are those log entries in mqtt:

working:
[12:35:10] INFO: Successfully send service information to the Supervisor.
2024-05-29 12:35:13: New connection from ip:44571 on port 1883.
2024-05-29 12:35:13: New client connected from ip:44571 as 6qxPtgtxVQVssRnybuuHz2 (p2, c1, k60, u’user’).
2024-05-29 12:35:14: New connection from ip:61449 on port 1883.
2024-05-29 12:35:14: New client connected from ip:61449 as DVES_B9A67E (p2, c1, k30, u’user’).
2024-05-29 12:35:14: New connection from ip:56407 on port 1883.

not working:
[12:35:10] INFO: Successfully send discovery information to Home Assistant.
2024-05-29 12:35:10: New connection from ip:35465 on port 1883.
2024-05-29 12:35:10: New client connected from ip:35465 as auto-B86DCDDE-3346-C751-2F2B-681C88A64AC1 (p2, c1, k60, u’user’).

So the sucessfull mqtt stuff goes to “Supervisor” and the not sucessfull stuff goes to “Home Assistant”

dunno where this is configured, though

even MQTT Explorer shows incoming stuff:

but nothing new in HA

Hi @mamema

Your above picture and your startup command show that you have changed the publish topic for Theengs Gateway to homassistant, which should only really include the discovery messages, but not the actual published messages, which per default go into home.

So in your picture the actual published messages in homassistant are likely not being recognised by HA. Also the -st --subscribe_topic is set to homassistant, which will also not work if you are using OpenMQTTGateway ESP32 proxies.

Please change back both to their default

"publish_topic": "home/TheengsGateway/BTtoMQTT",
"subscribe_topic": "home/+/BTtoMQTT/undecoded",

, also possible in the theengsgw.conf file in your home directory, and you should see any recognised and decoded devices in the MQTT integration.

@ [DigiH]
thanks for clarification, have done that

INFO:BLEGateway:Starting BLE scan
INFO:BLEGateway:Connected to MQTT broker
INFO:BLEGateway:Subscribed to home/+/BTtoMQTT/undecoded
INFO:BLEGateway:Sent 83 messages to MQTT

still no new entries in MQTT on HA side

I was already expecting that, as also in your previous screenshot from MQTT Explorer none of the devices being picked up by Theengs Gateway are recognised and decodable devices. So no discovery messages can be created for auto-discovery, as Gateway does not know what kind of devices with which properties they are.

All auto-discoverable compatible BLE devices for Theengs Gateway are listed at

Are you expecting to get certain properties from the devices listed in your screenshot from their advertising data? If so we can try to create a decoder for them together so that they can be added to the compatible devices listing.

ah, okay…
…i was expecting to get the sxwitchbot hub discovered, which is not listed in your list of compatible devices.

No, the SwitchBot Hub isn’t, but most of the individual SwitchBot devices should have their states discovered and published, if they are within Bluetooth reach.

okay, thank you for clarification

You should mark the post from @DigiH as the solution, not your own.

2 Likes