gateway
gateway copied to clipboard
Running the gateway on Windows
Hello,
I would like to get the gateway running on my Windows server. I can have it running, the MQQT part is fine. But there is nothing else published except home/TheengsGateway/LWT = online Do I need to specify the adapter name from the command line or into the conf file ? What is the expected syntax value ? Can someone post an example for it for a Windows env ? For information, my USB Bluetooth is a Sena UD100
Thank you for your help.
Hello,
On my Windows 11 PC I don't have to specify any adapter to make it work, just the broker credentials. Also I'm using the embedded Bluetooth.
Try maybe to locate the Sena in the Windows Device Manager and identify its name there
Can you run python -m TheengsGateway.diagnose while your Bluetooth adapter is plugged in? This shows the names of the available adapters.
Can you run
python -m TheengsGateway.diagnosewhile your Bluetooth adapter is plugged in? This shows the names of the available adapters.
Hello,
Here is the result for the command
python -m TheengsGateway.diagnose
Traceback (most recent call last):
File "
Hello,
On my Windows 11 PC I don't have to specify any adapter to make it work, just the broker credentials. Also I'm using the embedded Bluetooth.
Try maybe to locate the Sena in the Windows Device Manager and identify its name there
I did, but I don't know how to write it into the conf file. Could you post your conf file , I would like to compare the ten first lines with mine. Merci
I've tried from another computer, not my server. Without specifying anything about the adapter, it runs. If the problem comes from the Sena usb device, this is too bad as it's a BT device with a wide range.
ModuleNotFoundError: No module named 'importlib_metadata'
Ok this needs to be fixed in a future release.
Can you for now execute this:
pip install importlib_medata
And then try the diagnose module again.
Hi, Small typo error in your command but that's ok, I managed to install it. Here is the output
C:\Users\JC>pip install importlib_medata Defaulting to user installation because normal site-packages is not writeable ERROR: Could not find a version that satisfies the requirement importlib_medata (from versions: none) ERROR: No matching distribution found for importlib_medata
C:\Users\JC>pip install importlib_metadata Defaulting to user installation because normal site-packages is not writeable Collecting importlib_metadata Downloading importlib_metadata-6.1.0-py3-none-any.whl (21 kB) Collecting zipp>=0.5 Downloading zipp-3.15.0-py3-none-any.whl (6.8 kB) Installing collected packages: zipp, importlib_metadata Successfully installed importlib_metadata-6.1.0 zipp-3.15.0
C:\Users\JC>python -m TheengsGateway.diagnose
Theengs Gateway Diagnostics
Package Versions
| Name | Value |
|---|---|
| Theengs Gateway | 0.9.0 |
| Theengs Decoder | 1.3.7 |
| Bleak | 0.20.1 |
| Bluetooth Clocks | 0.1.2 |
| Bluetooth Numbers | 1.1.0 |
| Paho MQTT | 1.6.1 |
| Bluetooth Adapters | 0.15.3 |
Python
| Name | Value |
|---|---|
| Version | 3.11.2 |
| Implementation | CPython |
| Compiler | MSC v.1934 64 bit (AMD64) |
| Executable | C:\Program Files\Python311\python.exe |
Operating System
| Name | Value |
|---|---|
| System | Windows |
| Release | 10 |
| Version | 10.0.20348 |
| Machine type | AMD64 |
Configuration
{ "adapter": "", "ble_scan_time": 5, "ble_time_between_scans": 55, "discovery": 1, "discovery_device_name": "TheengsGateway", "discovery_filter": [ "IBEACON", "GAEN", "MS-CDP" ], "discovery_topic": "homeassistant/sensor", "hass_discovery": 1, "host": "localhost", "log_level": "DEBUG", "lwt_topic": "home/TheengsGateway/LWT", "pass": "", "port": 1883, "presence": 0, "presence_topic": "home/TheengsGateway/presence", "publish_all": 1, "publish_topic": "home/TheengsGateway/BTtoMQTT", "scanning_mode": "active", "subscribe_topic": "home/+/BTtoMQTT/undecoded", "time_format": 0, "time_sync": [], "user": "" }
Traceback (most recent call last):
File "
FYI : My OS is not Windows 10 but Windows server 2022
Ok, can you try something: edit the file C:\Users\JC\AppData\Roaming\Python\Python311\site-packages\TheengsGateway\diagnose.py. Then change this line:
from bluetooth_adapters import get_adapters
to this:
from bluetooth_adapters.systems import get_adapters
Do you get a list of adapters now?
Ok, ignore my previous comment, we've found the problem.
Edit the file C:\Users\JC\AppData\Roaming\Python\Python311\site-packages\bluetooth_adapters\__init__.py and remove the following lines:
from .dbus import (
BlueZDBusObjects,
get_bluetooth_adapter_details,
get_bluetooth_adapters,
get_dbus_managed_objects,
)
Do you get a list of adapters now?
So if you remove the Sena adapter, you don't get any adapters in the list of the diagnose command, right? That means that "bluetooth" is the name of the Sena adapter, and it should be usable in the configuration with "adapter": "bluetooth",.
By the way, you have installed the Windows driver, right? I have the same UD100 adapter, and this works automatically in Linux, but in Windows you need a driver apparently.
By the way, you have installed the Windows driver, right? I have the same UD100 adapter, and this works automatically in Linux, but in Windows you need a driver apparently. I did. I wanted to use the diagnose into my Linux PC and I also have an error : python3 -m TheengsGateway.diagnose
Theengs Gateway Diagnostics
Package Versions
| Name | Value |
|---|---|
| Theengs Gateway | 0.9.0 |
| Theengs Decoder | 1.3.7 |
| Bleak | 0.20.1 |
| Bluetooth Clocks | 0.1.2 |
| Bluetooth Numbers | 1.1.0 |
| Paho MQTT | 1.6.1 |
Python
| Name | Value |
|---|---|
| Version | 3.7.3 |
| Implementation | CPython |
| Compiler | GCC 8.3.0 |
| Executable | /usr/bin/python3 |
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/dist-packages/TheengsGateway/diagnose.py", line 157, in
Thanks for testing this. I'll add a check for freedesktop_os_release which is not available on Python 3.7. However, showing the Bluetooth adapters is only supported on Python 3.9 and higher anyway.
So the conclusion seems to be then that your Sena UD100 adapter isn't recognized on Windows?
I will not say my UD100 is not recognized on Windows as the driver installed a full BT stack and I can see BT devices from there. I found that my Linux PC has 2 BT controllers. A built-in one and the UD100. So I don't know which one is used by the gateway when making tries on it. Do you know a linux command that allow to identify them. The bluetoothctl gives only their address without any name.
I found this https://macaddresschanger.com/bluetooth-mac-lookup That will help me
hciconfig will show all adapters.
38:00:25:xx:yy:zz Intel 00:01:95:xx:yy:zz Sena The Sena is hci0, i will change the conf to force using it