You can install the gateway on a server and connect it to an mqtt broker. And check if you get the data from your smartwatch.
If ok I can explain how to integrate it.
New version v0.5.0:
Whatâs Changed
- Devices Clarifications by @DigiH in #47
- Add option -s to support passive scanning on Windows and Linux by @koenvervloesem in #48
- Retain discovery messages by @1technophile in #49
- Merge default configuration with configuration file by @koenvervloesem in #50
- Synchronize time daily for all LYWSD02 devices by @koenvervloesem in #52
- Randomize connect times for LYWSD02 devices by @koenvervloesem in #53
- Bump Theengs Decoder by @1technophile in #58
- [DOCS] Replace logo by computers pictures by @1technophile in #54
New devices and changes:
Devices | Model | Measurements |
---|---|---|
April Brother | ABTemp | uuid/mfid/major/txpower @ 1 m/temperature/battery |
April Brother | N03 | temperature/humidity/luminance/battery |
Qingping | CGDN1 | temperature/humidity/PM2.5/PM10/carbon dioxide |
iBeacon | protocol | uuid/mfid/major/minor/txpower @ 1 m/voltage |
Thermobeacon | WS02 | temperature/humidity/voltage/timestamp/maximum temperature/maximum temperature timestamp/minimum temperature/minimum temperature timestamp |
Thermobeacon | WS08 | temperature/humidity/voltage/timestamp/maximum temperature/maximum temperature timestamp/minimum temperature/minimum temperature timestamp |
Full Changelog: v0.4.0âŠv0.5.0
Theengs Gateway is now available also as a docker container
docker pull theengs/gateway
Thanks to @maretodoric
Iâm trying to use auto-discovery for Openhab3 with Theengs gateway (on an Ubuntu PC) and I can see the homeassistant config payloads are being advertized and then the Bluetooth devices show up as Things in the Inbox.
The problem is when I add these Things from Inbox, the linked Items donât get updated (despite mqtt payloads coming) and the Thing itself is in the âUNKNOWNâ state.
I can only see openhab.log swamped with such messages:
2022-10-13 17:29:58.686 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JINJA-transformation failed: An error occurred while transformation. UnknownTokenException: Unknown token found: value_json.fer | is_defined
2022-10-13 17:29:58.686 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JINJA-transformation failed: An error occurred while transformation. UnknownTokenException: Unknown token found: value_json.lux | is_defined
2022-10-13 17:29:58.686 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JINJA-transformation failed: An error occurred while transformation. UnknownTokenException: Unknown token found: value_json.moi | is_defined
2022-10-13 17:29:58.689 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JINJA-transformation failed: An error occurred while transformation. UnknownTokenException: Unknown token found: value_json.tempc | is_defined
Some relevant mqtt messages:
- discovery:
Client (null) received PUBLISH (d0, q0, r1, m0, 'homeassistant/sensor/C47C8DXXXXXX-tempc/config', ... (438 bytes))
{"stat_t": "+/+/BTtoMQTT/C47C8DXXXXXX", "dev_cla": "temperature", "unit_of_meas": "\u00b0C", "name": "HHCCJCY01HHCC-tempc", "uniq_id": "C47C8DXXXXXX-tempc", "val_tpl": "{{ value_json.tempc | is_defined }}", "state_class": "measurement", "device": {"identifiers": ["C47C8DXXXXXX"], "connections": [["mac", "C47C8DXXXXXX"]], "manufacturer": "Xiaomi/VegTrug", "model": "HHCCJCY01HHCC", "name": "Flower care", "via_device": "TheengsGateway"}}
- the actual payload:
Client (null) received PUBLISH (d0, q0, r0, m0, 'home/TheengsGateway/BTtoMQTT/C47C8DXXXXXXX', ... (170 bytes))
{"name": "Flower care", "id": "C4:7C:8D:XX:XX:XX", "rssi": -81, "brand": "Xiaomi/VegTrug", "model": "MiFlora", "model_id": "HHCCJCY01HHCC", "tempc": 21.9, "tempf": 71.42}
Please help to troubleshoot this further.
Hello,
This is due to the is_defined key below:
{{ value_json.tempc | is_defined }}
Here in the code, if you can replace:
device['val_tpl'] = "{{ value_json." + k + " | is_defined }}"
by
device['val_tpl'] = "{{ value_json." + k + "}}"
It should work
Iâm using the snap package, so I guess this would have to be done by the maintainers of the package?
Let us add it to the new version
A big release for Theengs Gateway, @DigiH did a huge work adding new devices and improving the existing ones!
Also, the TheengsGateway auto discovery following HA convention can now be compatible with OpenHAB thanks to the work of @koenvervloesem #62 , just set hass_discovery
to 0 if you use OpenHAB or other Home Controllers.
I added documentation to the Theengs satellite/proxy feature that was available in the previous release. If you use OpenMQTTGateway web upload binary esp32dev-ble-mqtt-undecoded
that will publish directly to home/<gateway name>/BTtoMQTT/undecoded
making it directly compatible with Theengs Gateway MQTTtoMQTT decoding feature. In short, you can have satellites ESP32 sending undecoded data to TheengsGateway, and TheengsGateway centralizing the decoding work.
Whatâs Changed
- Undecoded default subscribe by @1technophile in #68
- Add docker doc by @1technophile in #60
- Bump TheengsDecoder to v0.9.0 by @1technophile in #61
- Add option to enable or disable Home Assistant-specific discovery by @koenvervloesem in #62
- [DOCS] Add link to My HA and reorganize install and use docs by @1technophile in #64
- Replace deprecated BleakScanner.register_detection_callback() by @koenvervloesem in #63
- Bump Theengs Decoder to v095 by @1technophile in #66
- Amphiro/Oras Digital Shower Head by @DigiH in theengs/decoder#195
- ThermoPro TP357 & TP358 by @DigiH in theengs/decoder#198
- Oria T301 by @DigiH in theengs/decoder#199
- CGPR1 enhancements by @DigiH in theengs/decoder#200
- Unit adjustments CGP1W & TPMS by @DigiH in theengs/decoder#201
- Ohm to Ω by @DigiH in theengs/decoder#202
- string_from_hex_data clarification by @DigiH in theengs/decoder#203
- Acceleration adjustments by @DigiH in theengs/decoder#204
- SmartDry shake changes by @DigiH in theengs/decoder#206
New devices and changes:
Devices | Model | Measurements |
---|---|---|
ClearGrass | CGG1 | multi firmware support PVVX-ATC |
Hydractiva Digital | Amphiro/Oras | sessions/time/litres/temperature/energy |
Oria/Brifit/SigmaWit/SensorPro | TH Sensor | temperature/humidity/battery |
Qingping | CGPR1 | presence/luminance/battery |
ThermoPro | TP357 | temperature/humidity |
ThermoPro | TP358 | temperature/humidity |
ThermoPro | TP359 | temperature/humidity |
Otio/BeeWi | Door & Window Sensor | contact/battery |
Full Changelog: v0.5.0âŠv0.6.0
Hi @1technophile,
Sorry if my question is a bit outside this topic. I am trying to send data from my Xiaomi thermometers LYWSD03MMC to OpenHab through Mqtt using Theengs Gateway.
I have installed Theengs Gateway as a snap. When I launch it, I receive the following from mosquito_sub
Thermometer 1
home/TheengsGateway/BTtoMQTT/A4C138XXXXXX {"servicedatauuid": "fe95", "servicedata": "30585b050129fea538c1a4280100", "name": "LYWSD03MMC", "id": "A4:C1:38:XX:XX:XX", "rssi": -63}
Thermometer 2
home/TheengsGateway/BTtoMQTT/A4C138XXXXXX {"servicedatauuid": "fe95", "servicedata": "30585b050171189b38c1a4280100", "name": "LYWSD03MMC", "id": "A4:C1:38:XX:XX:XX", "rssi": -60}
I was expecting to receive a decoded version of servicedata
with temperature and humidity values but I couldnât find them.
I also tried to run Theengs Gateway after installation using pip
.
I obviously did something wrong but I donât know what and I cannot find information on the Internet about it. Can you please advise?
Many thanks in advance.
Ludovic
Hello,
Thatâs a good question.
LYWSD03MMC with their stock firmware use an encrypted key to advertize their data.
So as to make them compatible with Theengs or OpenMQTTGateway, you need to flash them with a custom firmware.
The process is very easy and takes less than 5 minutes.
The flash is done Over the air from your desktop
https://atc1441.github.io/TelinkFlasher.html
Hi,
Thank you very much!
It is now working.
Ludovic
New version available:
Whatâs Changed
- Disable duplicate detection of advertisement data on Linux by @koenvervloesem in #85
- Bump Theengs Decoder to v1.0.0 by @1technophile in #89
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
Is there a chance to add sync time for LYWSD03MMC ? It is possible display clock using PVVX-ATC firmware.
Hi @Dom_KS
Sync-time is in the works for LYWSD03MMC with PVVX firmware and should be included in an upcoming release.
Hello. I want to use on Windows. Installed python 3 latest, installed Theengs Gateway from pip. Theengs Gateway asks for the name of the BLE adapter. I have Intel AX201 card with Intel Bluetooth. What name should I enter?
By default Theengs Gateway uses your systemâs default Bluetooth adapter. Doesnât it for you? What if you run it with the option -a ""
to set an empty adapter name? If that still doesnât work, can you show the output of running Theengs Gateway after enabling logging for Bleak?
Hi @Dom_KS can you try whether your LYWSD03MMC with PVVX-ATC firmware is recognized by this tool and that you can set the time with it?
This is the library that will be integrated in an upcoming release of Theengs Gateway to expand the number of devices it can synchronize its time with. I added support for devices with the PVVX-ATC firmware, but I donât have such a device, so it isnât tested yet.
Try discovering clocks with:
bluetooth-clocks discover
If your device isnât discovered, try with a longer scan duration, such as 10 seconds:
bluetooth-clocks discover -s 10
After a successful discovery (this is really needed, the MAC address alone if you know it already isnât enough), take note of the MAC address, e.g. 12:34:56:78:9A:BC, and then synchronize the time with:
bluetooth-clocks set -a 12:34:56:78:9A:BC
Let me know whether this works, or if you get an error message or if thereâs no error message but no time change either. You can add -v
or -vv
before the set
subcommand to get more or even more information for debugging purposes. Also, if the time is already correct on the device, you can try setting it to another time to see whether the time change really works, e.f. with the option -t 2023-01-10T16:20
.
Your feedback is really useful to improve time synchronization in Theengs Gateway.
Thank you. I thought that it is necessary to specify the name of the adapter. Everything works without a name
Some qustion from your happy user on Windows Server 2022 / OpenHab 3.4.1
- Installation requires c++ compilation. How to change the build system from MSVC (takes up a lot of space on my mini PC - 6 gigabytes) to another compiler. Or how can I build on my workstation (Iâm c++ developer) instead of a server? Now, I just installed everything on the workstation and copied it to the server along the same paths (whole python folder).
- Where can I read how to add âmy devicesâ. I am interested in Xiaomi Scooter, Huawei Watch Fit 2 and various devices (sensors) from aliexpress.
- What python service wrapper do you recommend to run the gateway like the windows service (nssm?).
- How to exclude apple devices (0x004c - Apple,Inc ) from mqtt. There are a lot of them around me. {âmanufacturerdataâ: â4c0012020003â, âidâ: âFD:C4:47:DA:4A:26â, ârssiâ: -95}.
- How to exclude devices by id/mac (FD:C4:47:DA:4A:26) from mqtt. There are a lot of them around me. {âmanufacturerdataâ: â4c0012020003â, âidâ: âFD:C4:47:DA:4A:26â, ârssiâ: -95}.
- It would be convenient if at least the manufacturer of the device was specified in the MQTT payload (so as not to look at the directory).
{
"vendor": "Apple, Inc",
"manufacturerdata": "4c0012020003",
"id": "FD:C4:47:DA:4A:26",
"rssi": -95
}
- Do you have plans to add useful properties for devices, such as: last seen (last activity) and availability (device is on, with custom poll period)
{
"last_seen": "2023-01-22T16:15:42+05:00",
"availability": "online"
}
- Ability to change the location of the settings file (theengsgw.conf) to any folder (to run as a service)
- SSL connection to mqtt broker (with certificates)
- Could not start Things Explorer on windows, reports that there is no ScrollViewâŠ
rem python 3.11.1
pip install Textual
pip install bluetooth-numbers
pip install humanize
python TheengsExplorer/__init__.py
Thanks for the cool software, I have been looking for a long time how to attach BLE to OpenHab on Windows!!!
- Sorry, I donât have any experience with it.
- Thereâs some information about adding decoders.
- I donât have any experience with Windows services.
- Theengs Gateway has a
--discovery_filter
which filters iBeacons, GAEN and MS-CDP advertisements by default. I think that @Hans_Lree has been working on recognizing Apple Continuity messages, which you are seeing a lot, so once this is implemented in Theengs Decoder you can filter these in Theengs Gateway too. - This isnât possible, is this still necessary when the solution for 4. is implemented?
- For devices supported by Theengs Decoder thereâs already a âbrandâ key. Where would the âvendorâ information in your example come from?
- I think last seen and availability information should be something that your controller (openHAB, Home Assistant, âŠ) implements, based on the MQTT messages it receives from Theengs Gateway.
- Yes, we could change that Theengs Gateway would look in multiple locations instead of only the userâs home directory, that looks useful.
- Yes, this is a feature we need to implement.
- Theengs Explorer is not ready yet for general use. Have a look at this discussion.