The ble-mqtt-bridge facilitates the forwarding of values between Bluetooth Low Energy (BLE) characteristics and MQTT messages in both directions:
The bridge can automatically connect to a BLE device and subscribe to or iteratively read (poll) a specific characteristic. Whenever a new value is read, the bridge will forward it to the MQTT broker with the corresponding topic. The broker can then distribute the value to other interested parties on the network.
The bridge can also be configured, to subscribe to MQTT messages with a configurable topic from a MQTT broker and forward their content to a BLE characteristic.
If you compiled libtinyb.so from the sources, it will by default be located in /usr/local/lib, therefore that path must be in your LDFLAGS. You can add it to the Makefile
LDFLAGS += -L/usr/local/lib
or configure it globally e.g. by adding
export LDFLAGS=${LDFLAGS}:-L/usr/local/lib
to your ~/.bashrc.
The configuration format of the floorsensor daemon is JSON. In order to compile floorsensord, you need nlohmann/json. It will be installed to /usr/local.
$ git clone https://github.com/nlohmann/json.git
...
$ cd json
$ mkdir build
$ cd build
$ cmake ..
...
$ make
...
$ make test
...
$ sudo make install
...
In order to being able to publish messages, you need to have a MQTT broker running somewhere, in the simplest case on your local host.
We used Eclipse's mosquitto daemon, running on port 1883.
You can install it on ubuntu/debian with
$ apt install mosquitto mosquitto-clients libmosquittopp-dev
or with a docker image
$ apt install mosquitto-clients libmosquittopp-dev
$ docker run -it -p 1883:1883 -p 9001:9001 --name mosquitto eclipse-mosquitto
The mosquitto.conf could for example look like this:
listener 1883 127.0.0.1
allow_anonymous true
pid_file /var/run/mosquitto.pid
persistence false
log_type information
log_type notice
log_type warning
log_type error
log_dest stdout
log_dest file /var/log/mosquitto/mosquitto.log
-v n Set loguru::g_stderr_verbosity level. Examples:
-v 3 Show verbosity level 3 and lower.
-v 0 Only show INFO, WARNING, ERROR, FATAL (default).
-v INFO Only show INFO, WARNING, ERROR, FATAL (default).
-v WARNING Only show WARNING, ERROR, FATAL.
-v ERROR Only show ERROR, FATAL.
-v FATAL Only show FATAL.
-v OFF Turn off logging to stderr.
- Daemon to read values from the floor-sensors used in the sentient-project from Baumhaus Berlin
- Daemon to control a legacy alarm-light
- Daemon to steer an driving robot
- Daemon that reads values from an USB Joystick
- Daemon that reads values from an SDS001 dustsensor
- configuration from floorsensod
- Playground for json-mapping
- Playground for logging