BLE gateway on a Raspberry Pi, Debian or Windows PC -> Theengs Gateway!

Theengs Gateway is now available also as a docker container

docker pull theengs/gateway

https://gateway.theengs.io/install/install.html#install-theengs-gateway-as-a-docker

Thanks to @maretodoric

1 Like

Hi.
When I try to install Theengs on my HA, I receive this error:

Any idea?

Hello,

We just released a new version. Could you try again?

1 Like

Yes.
I’ve installed last version and it works.
Now I’m trying to use TheengsGateway-MQTT (decoded) data inside Home Assistant but I’m very confused on how to do this…
I’m searching for exhaustive documentation but I can’t find too.

Hello,

Glad that it works!

If you want the gateway to decode the payload coming from OMG (MQTTtoMQTT decoding) you can refer to this chapter of the documentation.
https://gateway.theengs.io/use/use.html#mqtttomqtt-decoding

1 Like

Ok.
I’m trying many ways… I’ll update you with my results.

New version available:
https://gateway.theengs.io/install/install.html#install-theengs-gateway-as-an-add-on-in-home-assistant

What’s Changed

New BLE devices and changes:

Devices Model Measurements
BlueMaestro TempoDisc 1 in 1 temperature/battery
BlueMaestro TempoDisc 4 in 1 temperature/humidity/pressure/battery
ClearGrass alarm clock CGD1 temperature/humidity/battery
ClearGrass alarm clock CGC1 temperature/humidity/battery
GOVEE H5074 temperature/humidity/battery
GOVEE H5101 temperature/humidity/battery
GOVEE H5106 PM2.5/temperature/humidity/battery
GOVEE H5174 temperature/humidity/battery
GOVEE H5177 temperature/humidity/battery
Oria/Brifit/SigmaWit/SensorPro TH Sensor T301 temperature/humidity/battery
Mopeka Pro temperature/level/sync status/voltage/battery/reading quality
Sensirion MyCO₂/CO₂ Gadget temperature/humidity/carbon dioxide
Sensirion SHT4X TH sensor temperature/humidity
ThermoPro TP393 temperature/humidity

Full Changelog: v0.6.6…v0.7.0

Hey - First of all: Thanks for putting in so much work and effort to help us with your project.

Unfortunately it seems I have problems understanding the way it works.
Assumption:

  • I have a HA instance on a pi4
  • I would like to install Theengs on a piZERO and put in in the cellar to get values of my Govees because the range of the HA pi is not sufficient
  • Installed via pip3 on the ZERO
  • Connected it to the mosquitto mqtt broker of the HA pi

That’s it? Any settings needed? Theengs HA plugin is not needed?

Thanks for clarifying this to dumb ppl like me :wink:

// EDIT: An additional question. Due to very poor performance on the piZERO → Do you recommend the python or the docker installation?

I would suggest the python one to decrease the layers.

You should be good. Do you see traffic if you connect to the mqtt broker with a client like mqtt explorer?

1 Like

Oh, yes - Thanks for that hint.
I can see a lot of my devices.

Now is the question: How do I add them to HA? :slight_smile:

Cool that you see your devices, so if MQTT discovery is activated in your MQTT integration you should see them into Settings->Devices & Services->Devices

2 Likes

That was the missing piece of the puzzle. Thank you for your patience and help!

1 Like

Me again :slight_smile:

Unfortunately my theengs stopped working with the govees. This happened some days ago and I can’t remember changing anything - only that I bought 2 new devices.
With the MQTT Explorer I still see my 2 old devices, but only the ‘config’ topic (Dunno if this is ‘old stuff’).

I rebooted the raspi several times, I have even reinstalled theengs.

journalctl -u TheengsGateway

Shows – No entries –

Connection to the Broker seems to work:

INFO:BLEGateway:Starting BLE scan
INFO:BLEGateway:Connected to MQTT Broker!
INFO:BLEGateway:Subscribed to home/+/BTtoMQTT/undecoded

What to do/debug here? Thanks again.

Another user opened an issue yesterday with the same problem, but we haven’t found the root cause yet. Did you update Theengs Gateway? Update the operating system? What does your theengsgw.conf look like?

Maybe try setting the environment variable BLEAK_LOGGING to 1 to see what the underlying Bluetooth library is doing. You can do that in your systemd service unit file with the Environment key.

Did not update the theengs gateway. OS updates not in the last 14 days:

root@raspberrypi:~# ls -lrt /var/cache/apt/archives |tail
-rw-r--r-- 1 root root   259536 27. Jan 15:10 gir1.2-gtk-3.0_3.24.24-4+rpt12+deb11u2_armhf.deb
-rw-r--r-- 1 root root    59148 27. Jan 15:10 lxtask_0.1.10-1+rpt1_armhf.deb
-rw-r--r-- 1 root root  1263796 27. Jan 15:10 raspberrypi-ui-mods_1.20230127_armhf.deb
-rw-r--r-- 1 root root   308756 28. Jan 01:21 libcurl4_7.74.0-1.3+deb11u5_armhf.deb
-rw-r--r-- 1 root root   306240 28. Jan 01:21 libcurl3-gnutls_7.74.0-1.3+deb11u5_armhf.deb
-rw-r--r-- 1 root root   257952 28. Jan 01:21 curl_7.74.0-1.3+deb11u5_armhf.deb
-rw-r--r-- 1 root root  1829216 29. Jan 07:44 git-man_1%3a2.30.2-1+deb11u1_all.deb
-rw-r--r-- 1 root root   269816 29. Jan 23:08 libtiff5_4.2.0-1+deb11u3_armhf.deb
-rw-r--r-- 1 root root  4706728 30. Jan 05:08 git_1%3a2.30.2-1+deb11u1_armhf.deb
drwx------ 2 _apt root     4096 31. Jan 09:08 partial

Theengs config is the standard one:

{
    "adapter": "",
    "ble_scan_time": 5,
    "ble_time_between_scans": 5,
    "discovery": 1,
    "discovery_device_name": "TheengsGateway",
    "discovery_filter": [
        "IBEACON",
        "GAEN",
        "MS-CDP"
    ],
    "discovery_topic": "homeassistant/sensor",
    "hass_discovery": 1,
    "host": "xxx",
    "log_level": "DEBUG",
    "pass": "xxx",
    "port": 1883,
    "publish_topic": "home/TheengsGateway/BTtoMQTT",
    "scanning_mode": "active",
    "subscribe_topic": "home/+/BTtoMQTT/undecoded",
    "time_format": 0,
    "time_sync": [],
    "user": "theengs"
}

I will try the debugging with BLEAK_LOGGING and will let you now as soon as I did this :slight_smile:

//EDIT: Wait… The adpater field shouldn’t be empty or?

The adapter field is empty by default, that’s no problem, then Theengs Gateway just uses the default adapter.

Hi all!
A little of a side question to see if I manage to use the BT gw to solve a Plejd problem. I have two different Plejd meshes due to distance between my garage and my house. For the house mesh I am using the native bluetooth integration from Thomas Loven that is working flawlessly, but I am trying to see if I could use the Theengs BT gw to add as well the BT puck on the garage. I have started the GW as a docker in a NUC in the garage and it does find the Plejd entity: {
“manufacturerdata”: “7703070000230aa544c0e3f11263f584837b00”,
“name”: “P mesh”,
“id”: “F1:E3:C0:44:A5:0A”,
“rssi”: -61
“rssi”: 0
}

which is published under home/Theengsgateway/BTtoMQTT, along with some other discovered BT entities (no sensors, though), but it is not published in the homeassistant autodiscovered topic, since I assume it is not recognized by the GW? According to the Plejd addon (thomasloven/hass_plejd) the BT proxy with an ESP32 is supported, so I assume that it can be done. What do I need to do for the GW to publish the entity as a lights entity? any quick pointers? Thanks!

You would need to add support for your device to Theengs Decoder. There’s some documentation about adding a decoder, but if you’re not up to the task, open an issue in the decoder repository and we’ll try to create a decoder if it’s possible.

But I don’t know the Plejd hardware, so maybe just to avoid confusion and disappointment: is it a sensor, or a light you want to turn on and off? Because currently Theengs Gateway is only able to pick up sensor measurements, it can’t control devices such as lights (clocks are the only supported devices the gateway can control).

Ah! good point… It is a light I want to control. so yes, it would require enabling on/off type of capabilities. I’ll have a look at the code and try to find some time to contribute it… Thanks for the clarification!

Hi.
I’ve succesfully installed Theengs Gateway on my Home Assistant (working on Raspberry Pi 4).
It read an ESP32 BLE device but sends data like RSSI to the Mosquitto MQTT broker (even installed on the same Raspberry) only every 10 secs.

Otherwise if I usean app like nRF Connect on my smartphone, I see the same update every few ms.

I’ve tried to modify SCAN duration and TIME between parameters on my Theengs Gateway configuration file but with no success.
Any idea?
Thanks in advance