Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lordthorzonus/ble2mqtt-gateway
BLE to MQTT Gateway supporting Ruuvitag and Miflora devices
https://github.com/lordthorzonus/ble2mqtt-gateway
ble ble-mqtt-bridge home-assistant iot miflora mqtt ruuvitag
Last synced: 3 days ago
JSON representation
BLE to MQTT Gateway supporting Ruuvitag and Miflora devices
- Host: GitHub
- URL: https://github.com/lordthorzonus/ble2mqtt-gateway
- Owner: lordthorzonus
- License: mit
- Created: 2022-04-10T17:49:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-05T22:38:21.000Z (8 days ago)
- Last Synced: 2024-11-05T23:30:02.869Z (8 days ago)
- Topics: ble, ble-mqtt-bridge, home-assistant, iot, miflora, mqtt, ruuvitag
- Language: TypeScript
- Homepage:
- Size: 1.51 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BLE2MQTT Gateway
Gateway for turning ble data into home assistant compatible mqtt messages. Currently supports RuuviTags and MiFlora Devices.
## Configuration
The behaviour of the gateway is controlled by a configuration file. The file is in YAML format and it's location can be set with the `CONFIG_FILE_LOCATION` environment variable.
### Example Configuration (configuration.yaml)
```yaml
log_level: info
decimal_precision: 1
mqtt:
host: mqtt.lan.fi
port: 1883
username: ble2mqtt
password: secret
client_id: ble2mqtt
protocol: mqttgateways:
base_topic: ble2mqtt
ruuvitag:
allow_unknown: false
devices:
- name: Fridge Ruuvitag
id: da21045d81a8
- name: Balcony Second
id: 641cae0910b5
timeout: 10000
miflora:
devices:
- name: My super plant
id: c47c8d6e07cf
timeout: 40000
homeassistant:
discovery_topic: homeassistant
```## Installation
The easiest way to run the gateyway is to use the built docker image:
### Example docker-compose.yml
```yaml
services:
ble2mqtt:
image: "lordthorzonus/ble2mqtt-gateway:x.x.x"
restart: unless-stopped
cap_add:
- NET_RAW
network_mode: host
volumes:
- ./configuration.yaml:/home/node/app/config/configuration.yaml
environment:
- CONFIG_FILE_LOCATION="/home/node/app/config/configuration.yaml"
- TZ="Europe/Helsinki"
```The Docker image is available at [Docker Hub](https://hub.docker.com/r/lordthorzonus/ble2mqtt-gateway). The version tag "x.x.x" should be replaced with the latest version.
The tagging scheme is as follows:
- `latest` - The latest numbered release
- `x.x.x` - The specific version of the release
- `edge` - The latest commit on the main branch (Here be dragons)The numbered releases are following semantic versioning.
See example here for how I deploy it with a [ansible playbook](https://github.com/lordthorzonus/homelab-provisioning/blob/main/roles/ble2mqtt/templates/docker-compose.yml)
### Using just docker
```bash
docker run \
-v $(pwd)/configuration.yaml:/home/node/app/config/configuration.yaml \
-e CONFIG_FILE_LOCATION="/home/node/app/config/configuration.yaml" \
-e TZ="Europe/Helsinki" \
--network host \
--cap-add NET_RAW \
lordthorzonus/ble2mqtt-gateway:x.x.x
```## Development
```bash
npm install
cp config/configuration.example.yaml config/configuration.yaml
```Dev modes that don't actually send any mqtt messages:
- `npm run dev ble` - Run in dev mode logging all received ble messages
- `npm run dev ble {manufacturerId}` - Run in dev mode logging only messages from given manufacturer
- `npm run dev gateway` - Run in dev mode logging all produced device messages
- `npm run dev gateway {deviceType}` - Run in dev mode logging all produced device messages from given device type
- `npm run dev mqtt` - Run in dev mode logging all mqtt messages that should be sent