Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitkill/blea2mqtt
đŠī¸ Sends BLE sensor data to MQTT
https://github.com/bitkill/blea2mqtt
ble bluetooth bluetooth-low-energy mi mqtt nodejs thermohygrometer
Last synced: about 5 hours ago
JSON representation
đŠī¸ Sends BLE sensor data to MQTT
- Host: GitHub
- URL: https://github.com/bitkill/blea2mqtt
- Owner: bitkill
- License: mit
- Created: 2021-09-26T02:01:52.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-31T22:16:11.000Z (8 days ago)
- Last Synced: 2024-11-02T00:27:51.947Z (7 days ago)
- Topics: ble, bluetooth, bluetooth-low-energy, mi, mqtt, nodejs, thermohygrometer
- Language: TypeScript
- Homepage:
- Size: 1.07 MB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## blea2mqtt
![build](https://github.com/bitkill/blea2mqtt/actions/workflows/node.js.yml/badge.svg)
Send BLE sensors data to MQTT
Why transmit this to mqtt?
- We may need several bluetooth radios to get decent coverage, as BLE is not a mesh network.
- We decode the data locally, to save on data sent to mqtt. There are a lot more devices that may broadcast BLE signals and this is a problem if you live in an apartment.A service to read Bluetooth low energy sensors in nodejs.
### Requirements
- nodejs v12+ (`brew install node` or [using nvm](ttps://github.com/nvm-sh/nvm#install--update-script))
- `yarn` (`npm i -g yarn`)
- a Bluetooth modem capable of BLE### Devices tested & working with this project
- `LYWSDCGQ` Mi Thermohygrometer, powered by 1xAAA
- `HHCCJCY01` Mi Flora, also available from a lot of other brands, powered by 1xCR2032
- `CGDK2`, a newer version of the Mi Thermohygrometer, powered by 1xCR2430
- For this device to broadcast useful data, a pair to the official `Qingping+` app was needed### Getting started
Before running this, keep in mind that this was tested with
ubuntu and macOS in mind.To run this in macOS (Prior to Monterey):
Go to `System Preferences` > `Security & Privacy` > `Privacy (tab)` > `Bluetooth`
and add your terminal of choice to the list of allowed apps.To run this in ubuntu/other gnu/linux distro:
```shell
./setup.sh
```First, configure your mqtt server
```shell
cp .env.example .env
vim .env
```There are a few things to configure in the `.env` file:
| Variable | Description |
| ------------- | --------------------------------------- |
| MQTT_HOSTNAME | Mqtt server location |
| MQTT_USERNAME | Mqtt server user |
| MQTT_PASSWORD | Mqtt server password for the given user |
| MQTT_TOPIC | Mqtt topic to publish information |
| MACHINE_NAME | Name your data collection node |
| BLE_DEBUG | Shows extra data (all ble broadcasts) |To install dependencies run the service, just:
```shell
yarn && yarn start
```### Project wishlist
- [ ] Docker image
- [ ] Docker Compose with full example
- [ ] Prometheus exporter