Gateway for turning ble data into home assistant compatible mqtt messages. Currently supports RuuviTags and MiFlora Devices.
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.
log_level: info
decimal_precision: 1
mqtt:
host: mqtt.lan.fi
port: 1883
username: ble2mqtt
password: secret
client_id: ble2mqtt
protocol: mqtt
gateways:
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
The easiest way to run the gateyway is to use the built docker image:
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. The version tag "x.x.x" should be replaced with the latest version.
The tagging scheme is as follows:
latest
- The latest numbered releasex.x.x
- The specific version of the releaseedge
- 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
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
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 messagesnpm run dev ble {manufacturerId}
- Run in dev mode logging only messages from given manufacturernpm run dev gateway
- Run in dev mode logging all produced device messagesnpm run dev gateway {deviceType}
- Run in dev mode logging all produced device messages from given device typenpm run dev mqtt
- Run in dev mode logging all mqtt messages that should be sent