Theengs Gateway - BLE to MQTT on a Raspberry Pi, Windows PC or Apple Mac

From a long time it was asked if OpenMQTTGateway could run on a Raspberry Pi.

With the externalization of the part of OMG BLE code into Theengs Decoder and the multi-platform compatibility of the library, the doors were wide open to it.

By integrating Theengs Decoder into a Python script we made a multi-platform BLE to MQTT gateway that can run on a Raspberry Pi, Unix, Windows, MAC, and many more.

So now if you have a server with a BLE component you can retrieve decoded BLE BLE devices data (LYWSD03MMC, Mi Flora, IBT-4XS, CGG1, TH1-2, Mi Scale, iBBQ… from Xiaomi, Inkbird, Govee, Qingping) and publish those to MQTT.

Cherry on the cake, TheengsGateway use the same API as OpenMQTTGateway, so it will act in concert with your existing ESP based OpenMQTTGateway.
If you use auto-discovery with OMG the sensors data will be automatically retrieved from TheengsGateway also!

If you have Python and Pip this is as simple as one command:
pip3 install TheengsGateway

Full documentation can be found below:

3 Likes

New version:

  • Add option to publish all detected devices. by @h2zero in #18
  • MiBand Activity Heart Rate Extension by @DigiH in #91
  • Switchbot S1 status decoder by @DigiH in #94
  • static_value bool implementation by @DigiH in #96
  • Initial NOT implementation by @DigiH in #97
  • Change property condition check to a function, add nestng support. by @h2zero in #98
  • Inkbird fixes and 6xS merge with Solis 6 by @DigiH in #101
  • Govee H5055 decoder by @DigiH in #102

This is exciting, do you think it can decode and ideally control a Gardena Minimow? That’s BLE 4 I think and in my case would need a USB Bluetooth dongle mounted very close. Happy to help with development if anyone can tell me what to do, either using a Pi2 or a 64bit Linux machine

For the moment it is focused on BLE to MQTT. If you are interested in controlling we can take a look through OpenMQTTGateway.
OMG can control bluetooth devices if you find the relevant service/characteristic/value.
We are going to integrate switchbot s1 control soon also as the first ble device natively implemented.

Very interesting, thanks for the reply! A quick read on that link isuggests an ESP32 can be used to interact with the BLE devices, is that any different functionally from a directly connected USB dongle? I’d like to work with whatever makes life the easiest.

Esp32 enables to cover more area with a cost effective price. After if your main unit covers already your garden with ble there is no need for esp32 but you will have to find a suitable gateway for your server.
For esp32 OMG can control already devices.

Excellent, I already have a spare ESP32. I will flash it wit OMG, install it near to the mower and see what it finds. This I can do later this week. Should I work with this thread, or do you prefer on GitHub?

I propose a dedicated thread on https://community.openmqttgateway.com

You can flash directly from your browser here:

I will advise esp32-dev-ble-cont which scan continuously as a start.

Thanks, I’ve joined the other forum and posted. I’ll update it when I have the ESP32 working. Thanks for your help :slight_smile:

1 Like

This seems a great addition to Openhab, since it’s currently lacking a valid support for bluetooth (at least that I know of).
I successfully installed Theengs gateway on my RP with Openhabian, now I have a noob question: how do I configure MQTT things and channels to have the temperature reading in Openhab Items?
Is there a tutorial?

Hello,

You can take the examples from OpenMQTTGateway as an help:

1 Like

Thanks but it seems is not for Theengs: for example it refers to a file “config_mqttDiscovery.h” that I am not able to find

You can start from the chapter “MQTT 2 manual setup >=Openhab2.4”, from this the mi flora example should the same as OMG.

Hi,
I need some help/clarification…
I have LYWSD03MMC xiaomi BLE weather station.
I also Installed TheengsGateway (on a separate PI, not on openhabian but nevermind.
So, now this TheengsGateway can send mqtt messages to openhab mqtt binding (i have mosquitto running) in the same way zigbee2mqtt is sending it?

Use your host, username and password for the MQTT broker.
Then reload the service files and start and enable the system service:

so I should configure Theengs with mosquitto IP ?
(I can see in mosquitto log client connection from the machine where Theengs is running, so I guess this part is ok)

I did that, and then added a generic mqtt thing according to OH wiki

could this work that way? how to check if TheengsGateway is working properly, detecting the device and sending the values to mosquitto?

thanks!

I would advise to connect to the broker with a client, like mqtt explorer and check that the broker receives messages.

Yes

You will need to add also the channels into the thing for each device entity, like temperature, humidity, battery.

@vanja would you be interested in testing autodiscovery of sensors, if I find some tester I can provide a delivery with the option and integrate feedback.

New Version v0.4.0:

What’s Changed

New sensors:

Others:

Full Changelog: v0.3.0…v0.4.0

Hi,
what kind of sensors?

Anything from the ones supported:

I have Amazfit Smart Watch available for test, let me know what are the steps of the test…