Skip to content

Commit

Permalink
add mqtt bridge support
Browse files Browse the repository at this point in the history
  • Loading branch information
docgalaxyblock committed Jul 31, 2023
1 parent 614de6d commit f4a2661
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#####################################################
### example config to forward mqtt to another broker
#####################################################
###
### copy this file to another one ending with .conf
###
### to enable/disable the service execute:
### sudo systemctl enable --now openmower-mqtt-bridge
### sudo systemctl disable --now openmower-mqtt-bridge
###

connection bridge-to-external-broker

try_private true
cleansession true
topic # out 0 "" openmower/
topic openmower/# in 0

address 192.168.XXX.XXX

#remote_username user
#remote_password pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
connection bridge-to-external-broker

try_private true
cleansession true
topic # out 0 "" openmower/
topic # in 0 "" openmower/

address 192.168.XXX.XXX

#remote_username user
#remote_password pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /run/mosquitto/openmower-mqtt-bridge.pid
log_type notice

#some random port
listener 18838


#the bridge to the openmower container
connection bridge-to-openmower

try_private true
cleansession true
topic # out 0
topic # in 0
address localhost

#include the config for the external bridge
include_dir /boot/openmower/mqtt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
Description=OpenMower MQTT Bridge
Documentation=man:mosquitto.conf(5) man:mosquitto(8)
After=network.target openmower.service openmower-debug.service
Wants=network.target
StartLimitBurst=0

[Service]
Type=notify
NotifyAccess=main
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto-openmower.conf
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=10s
ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto
ExecStartPre=/bin/chown mosquitto /var/log/mosquitto
ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto
ExecStartPre=/bin/chown mosquitto /run/mosquitto

[Install]
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions src/modules/openmower/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ systemctl disable podman.socket
echo_green "Disabling podman auto update..."
systemctl disable podman-auto-update.timer podman-auto-update.service

echo_green "Installing mosquitto and masking the normal mosquitto.service..."
apt-get install -y mosquitto
systemctl_if_exists mask mosquitto.service
systemctl disable openmower-mqtt-bridge.service


#cleanup
Expand Down

0 comments on commit f4a2661

Please sign in to comment.