I have a python script to send the 'keepalive' message to the Venus MQTT broker running on a raspberry pi 3 :
import paho.mqtt.client as mqtt # MQTT support import time import json mqttBroker ="victronpi" # define MQTT broker address client = mqtt.Client("KeepAlive") # identify client client.connect(mqttBroker) # connect to broker print("VictronPi MQTT broker connected...") while True: # send 'keepalive' message errcode = client.publish("R/b123abc7d123/keepalive") # publish all topics # topics = json.dumps("solarcharger/+/Dc/0/Voltage") # errcode = client.publish("R/b123abc7d123/keepalive",topics) # publish selected topics print("VictronPi KeepAlive sent : ",errcode) time.sleep(10)
I'd like to just keep alive the topics I'm interested in. I gather you can do this by including a payload in the 'keepalive' message but I'm struggling with the python syntax to do this, see commented out lines above, which just create a new read topic. Can anyone enlighten me what the correct python syntax to do this is please ?
PaulM