This program provides an interface between LXMF and MQTT. It serves as a single message endpoint and not to transfer the LXMF/Reticlum traffic 1:1 to MQTT. It serves the purpose of providing an endpoint in the Reticulum network for third party applications that can communicate via MQTT. Through this all LXMF capable applications can communicate with it via messages. This can be used for example to communicate via text messages with a smarthome system (FHEM, openHAB, ioBroker, Node-RED or similar). The transmission format used by MQTT is JSON with freely definable topics. The target system can then respond to these JSON messages.
For more information, see the configuration options (at the end of the program files). Everything else is briefly documented there. After the first start this configuration will be created as default config in the corresponding file.
### Features
- Compatible with all LXMF applications (NomadNet, Sideband, ...)
- Compatible with all MQTT servers
## Examples of use
###
### General info how the messages are transported
All messages between client<->server are transported as single 1:1 messages in the LXMF/Reticulum network.
Accordingly, encryption takes place between these end points.
If a direct delivery of the message does not work, it is sent to a propagation node. There it is stored temporarily and can be retrieved by the client later.
As these are normal LXMF messages, any LXMF capable application can be used to communicate with the group.
- After the first start edit the configuration file to suit your needs and use-case. The file location is displayed.
- Example minimal configuration (override of the default config `config.cfg`). These are the most relevant settings that need to be adjusted. All other settings are in `config.cfg`
```bash
nano /root/.lxmf_bridge_mqtt/config.cfg.owr
```
```bash
```
- Start it again. Finished!
```bash
./lxmf_bridge_mqtt.py
```
### Run as a system service/deamon:
- Create a service file.
```bash
nano /etc/systemd/system/lxmf_bridge_mqtt.service
```
- Copy and edit the following content to your own needs.
```bash
[Unit]
Description=LXMF Bridge MQTT Daemon
After=multi-user.target
[Service]
# ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/lxmf_bridge_mqtt.py
[Install]
WantedBy=multi-user.target
```
- Enable the service.
```bash
systemctl enable lxmf_bridge_mqtt
```
- Start the service.
```bash
systemctl start lxmf_bridge_mqtt
```
### Start/Stop service:
```bash
systemctl start lxmf_bridge_mqtt
systemctl stop lxmf_bridge_mqtt
```
### Enable/Disable service:
```bash
systemctl enable lxmf_bridge_mqtt
systemctl disable lxmf_bridge_mqtt
```
### Run several instances (To copy the same application):
- Run the program with a different configuration path.