MQTT disable keep-alive
In order to avoid a lot of traffic to Victron cloud server, a keep-alive mechanism exists. The default keep-alive interval is 60 seconds. If a keep-alive is not received within that 60-second interval, notifications will be stopped until another keepalive is received.
To update my Home Assistant Mosquitto MQTT server the keep-alive will be disabled. In order to disable the keep-alive edit /opt/victronenergy/service-templates/dbus-mqtt/run
and add --keep-alive 0
to the end of the last line.
vi /opt/victronenergy/service-templates/dbus-mqtt/run
#!/bin/sh
echo "*** starting dbus-mqtt ***"
exec 2>&1
exec softlimit -d 100000000 -s 1000000 -a 100000000 /opt/victronenergy/dbus-mqtt/dbus_mqtt.py --mqtt-server 127.0.0.1 --keep-alive 0
You can not simply stop and restart the dbus-mqtt
to activate the changes. The file /opt/victronenergy/service-templates/dbus-mqtt/run
is a service-template and is copied to /service/dbus-mqtt/run
on reboot. In order to check if we made no mistake just reboot Venos OS.
Reboot to activate the changes.
Mosquitto
Replace the content of the Mosquitto server configuratiopn file /etc/mosquitto/mosquitto.conf
with the following:
user mosquitto
per_listener_settings true
# unencrypted listener (local only)
listener 1883 127.0.0.1
allow_anonymous true
# tls encrypted listener
listener 8883
allow_anonymous false
acl_file /data/conf/mosquitto.d/acl_file
password_file /data/conf/mosquitto.d/password_file
capath /data/etc/ssl/<your-ca>.crt
certfile /data/etc/ssl/<your-cert>.crt
keyfile /data/etc/ssl/<your-cert-key>.key
require_certificate false
# websockets listener
#listener 9001
#protocol websockets
#include_dir /run/mosquitto