Set QoS of MQTT-Broker within Victron OS (Venus OS)

Hello,
this question might be misplaced, because we are on the OpenHab-Forum. I also ask in the Victron-Forum, but I got no answer. But I think here are some people who use the Victron environment via MQTT as well.

I use VenusOS and the MQTT-Broker comming with it. Also I have a different PI4 with OpenHab wich connects to the Broker on the Venus. But every now and then some or all messages are not received by OpenHab. Though I can receive them via MQTT-Explorer, so they are sent. I see, that they are sent with QoS = 0. Is it possible to change the QoS to 1 or 2? I presume it must be by editing the dbus_mqtt.py on the VenusOS-Pi, but my programming skills are limitted, so I don’t find how to do that. Can anyone point me to the right direction, Please?
Or is there an other solution for this problem? Am I doing wrong in configuring two brokers within OpenHab?

Thanks,

Ingo

Ultimately you need to determine why the messages are not sent to OH. Is there a networking issue? CPU/RAM issue on the VenusOS machine or the OH machine? Anything else that might cause these messages to be delivered?

If the problem is caused by infrastructure, setting the QOS isn’t going to change whether or not they get delivered.

Since it’s the sender that determines the QOS of the message, this will need to be set up on VenusOS. How to do it depends on how the code is set up. It may be a configuration parameter somewhere or it may be hard coded.

If it’s hard coded, you’ll need to determine which MQTT library is being used and find the lines where the messages are published and add the QOS argument to those lines. How to find those lines? :person_shrugging: It depends on the library being used. Often though the function call is or has “publish” in the name so that should help.

You’ve only mentioned the one VenusOS Broker. What the second one? Though it doesn’t really matter as there’s no problem having more than one Broker Thing in OH, so long as they connect to different brokers (there’s no reason to have two broker Things connected to the same broker).

First, thank’s for your answer.
I have two bokers because one is running on the PI4 where OH is running. It collects Data from sensors (zigbee2mqtt, self build stuff), the second one is the one on the PI3 where the Victron OS is running.
I think it’s not a Network or similar problem as I can see the messages when I connect by MQTT-Explorer from a third machine. Tha data is supplied by the Victron broker.
So it must be a problem on the PI4 (OH).
The cofiguration looks like:

Bridge mqtt:broker:Victron [ host="192.168.133.202", port=1883, secure=false, qos = 2 ]
{
//    Thing mqtt:topic:Victron:Venus "VenusOS" (mqtt:broker:Victron) {
    Thing topic Venus "VenusOS" {
    Channels:
        // ************* Raspi Venus **************************
        Type string : keepalive                     "keepalive" 		    [commandTopic="R/b827eb9432fe/keepalive"]

        // ************* Battery ******************************
        Type number : ESS_Battery_Voltage           "Batteriespannung"      [stateTopic="N/b827eb9432fe/system/0/Dc/Battery/Voltage", transformationPattern="JSONPATH:$.value"]
        Type number : ESS_Battery_Charge            "Batterie Ladestand"    [stateTopic="N/b827eb9432fe/system/0/Dc/Battery/Soc", transformationPattern="JSONPATH:$.value"]
        Type number : ESS_Battery_Current           "Batterie DC Strom"     [stateTopic="N/b827eb9432fe/battery/1/Dc/0/Current", transformationPattern="JSONPATH:$.value"]
//        Type number : ESS_Battery_Current               "Batterie DC Strom"     [stateTopic="N/b827eb9432fe/system/0/Dc/Battery/Current", transformationPattern="JSONPATH:$.value"]
        Type number : ESS_Battery_Power             "Batterie DC Leistung"  [stateTopic="N/b827eb9432fe/battery/1/Dc/0/Power", transformationPattern="JSONPATH:$.value"]
//        Type number : ESS_Battery_Power                 "Batterie DC Leistung"  [stateTopic="N/b827eb9432fe/system/0/Dc/Battery/Power", transformationPattern="JSONPATH:$.value"]
        Type number : ESS_Battery_minCellVoltage    "Bat. min Cell Volt"    [stateTopic="N/b827eb9432fe/battery/1/System/MinCellVoltage", transformationPattern="JSONPATH:$.value"]
        Type number : ESS_Battery_maxCellVoltage    "Bat. max Cell Volt"    [stateTopic="N/b827eb9432fe/battery/1/System/MaxCellVoltage", transformationPattern="JSONPATH:$.value"]
        Type number : ESS_Battery_CellTemp          "Bat. Temperatur"       [stateTopic="N/b827eb9432fe/battery/1/Dc/0/Temperature", transformationPattern="JSONPATH:$.value"]

        // ************* WR ***********************************
        Type number : ESS_WR_Current                "WR DC Strom"           [stateTopic="N/b827eb9432fe/vebus/290/Dc/0/Current", transformationPattern="JSONPATH:$.value"]
        Type number : ESS_WR_Power                  "WR DC Leistung"        [stateTopic="N/b827eb9432fe/vebus/290/Dc/0/Power", transformationPattern="JSONPATH:$.value"]
        Type number : ACout1_Current                "WR AC out 1 Strom"     [stateTopic="N/b827eb9432fe/system/0/Ac/Consumption/L1/Current", transformationPattern="JSONPATH:$.value"]
        Type number : ACout1_Power                  "WR AC out 1 Leistung"  [stateTopic="N/b827eb9432fe/system/0/Ac/Consumption/L1/Power", transformationPattern="JSONPATH:$.value"]

        // ************* MPPT *********************************
        Type number : MPPT_00_In_Voltage            "MPPT Westen Spannung"  [stateTopic="N/b827eb9432fe/solarcharger/289/Pv/0/V", transformationPattern="JSONPATH:$.value"]
        Type number : MPPT_00_In_Power              "MPPT Westen Leistung"  [stateTopic="N/b827eb9432fe/solarcharger/289/Pv/0/P", transformationPattern="JSONPATH:$.value"]
        Type number : MPPT_00_Yield                 "MPPT Westen Arbeit"    [stateTopic="N/b827eb9432fe/solarcharger/289/History/Daily/0/Pv/0/Yield", transformationPattern="JSONPATH:$.value"]
        Type number : MPPT_01_In_Voltage            "MPPT Osten Spannung"   [stateTopic="N/b827eb9432fe/solarcharger/289/Pv/1/V", transformationPattern="JSONPATH:$.value"]
        Type number : MPPT_01_In_Power              "MPPT Osten Leistung"   [stateTopic="N/b827eb9432fe/solarcharger/289/Pv/1/P", transformationPattern="JSONPATH:$.value"]
        Type number : MPPT_01_Yield                 "MPPT Osten Arbeit"     [stateTopic="N/b827eb9432fe/solarcharger/289/History/Daily/0/Pv/1/Yield", transformationPattern="JSONPATH:$.value"]
        Type number : MPPT_Out_Current              "MPPT Out Strom"        [stateTopic="N/b827eb9432fe/solarcharger/289/Dc/0/Current", transformationPattern="JSONPATH:$.value"]
        Type number : MPPT_Out_Voltage              "MPPT Out Spannung"     [stateTopic="N/b827eb9432fe/solarcharger/289/Dc/0/Voltage", transformationPattern="JSONPATH:$.value"]
        Type number : MPPT_Out_Ertrag               "MPPT Out Ertrag"       [stateTopic="N/b827eb9432fe/solarcharger/289/Yield/System", transformationPattern="JSONPATH:$.value"]
        Type number : MPPT_Out_Leistung             "MPPT Out Leistung"     [stateTopic="N/b827eb9432fe/solarcharger/289/Yield/Power", transformationPattern="JSONPATH:$.value"]
        Type number : MPPT_Operation_Mode           "MPPT Operation Mode"   [stateTopic="N/b827eb9432fe/solarcharger/289/MppOperationMode", transformationPattern="JSONPATH:$.value"]
    }
}

//Bridge mqtt:broker:RaspiMosquitto [ host="192.168.133.205", port=1883, secure=false ]
Bridge mqtt:broker:RaspiMosquitto [ host="127.0.0.1", port=1883, secure=false ]
{
//    Thing mqtt:topic:RaspiMosquitto:Klingel "Klingel" (mqtt:broker:RaspiMosquitto) {
    Thing topic Klingel "Klingel" {
    Channels:
        Type number : HWR_Temp                  "HWR Temperatur DHT11" 		    [stateTopic="haus/Klingel/HWR-DHT11-temperature"]
        Type number : HWR_Humidity              "HWR Luftfeuchtigkeit" 		    [stateTopic="haus/Klingel/HWR-DHT11-humidity"]
        Type number : HWR_Temp_KlingelPCB       "HWR Temperatur Klingel PCB"    [stateTopic="haus/Klingel/PCBDevice"]
        Type number : HWR_Temp_18B20            "HWR Temperatur Nische"         [stateTopic="haus/Klingel/WohnzimmerTemp"]
        Type number : Temp_Outside_East         "Aussentemperatur Osten"        [stateTopic="haus/Klingel/AussenTemp"]
    
        Type number : Temp_Heizung_RLHeizung		    "Rücklauf"		        [stateTopic="haus/Klingel/RLHeizung"]
        Type number : Temp_Heizung_VLHeizung		    "Vorlauf"		        [stateTopic="haus/Klingel/HLHeizung"]
        Type number : Temp_Heizung_RLHolzofen		    "Rücklauf Holzofen"		[stateTopic="haus/Klingel/RLHolzofen"]
        Type number : Temp_Heizung_VLHolzofen		    "Vorlauf Holzofen"		[stateTopic="haus/Klingel/HLHolzofen"]
        Type number : Temp_Heizung_VLSpeicherZurHeizung "Speicher zur Heizung"	[stateTopic="haus/Klingel/HLSpeicherZurHeizung"]
        Type number : Temp_Heizung_Speicher_Oben	    "Speicher oben"			[stateTopic="haus/Klingel/SpeicherOben"]
        Type number : Temp_Heizung_Speicher_Mitte	    "Speicher Mitte"		[stateTopic="haus/Klingel/SpeicherMitte"]
        Type number : Temp_Heizung_Speicher_Unten	    "Speicher unten"		[stateTopic="haus/Klingel/SpeicherUnten"]

        Type string : Klingel_Empfang				    "Klingel Empfang"		[stateTopic="haus/Klingel/Klingel"]
        Type switch : Laser	                    		"Laser"					[commandTopic="haus/HWR/Fenster/Laserwarnung"]
        Type string : LaserCommand                      "LaserCommand"          [commandTopic="haus/HWR/Fenster/Laserwarnung"]
    }
// some more, but cut it because not nessecary for this post
}

So, the two broker are independantly (I think).
The broker on the Victron PI is a Mosquitto and the use a Python-Script to feed the broker. As I understand, the QoS must be set within these Scripts. But I don’t find how to do this. The Python stuff is on Github:

https://github.com/victronenergy/dbus-mqtt/blob/master/README.md

I know it’s off topic, but maybe someone knows how to code this.
Thanks,
Ingo

Hi,
I’d like to ask whether you found a solution. I have the same issue and my log get flooded with such warnings:

2023-05-14 08:42:58.586 [WARN ] [.incoming.MqttIncomingPublishService] - QoS 0 publish message dropped

Reboot of the Venus seems to do the trick but I don’t want to regularly do that…

I have the same issue.
The configuration is the same.

If it can help, it is sufficient to go into the mqtt thing settings (generic MQTT Thing) and do save.

I can confirm that MQTT Explorer can receive all the messages that Venus OS is sending at the same time that Openhab receives nothing

Any solution is appreciated.

I have the same issue but with a broker on a CerboGX device.
In lack of a better Idea, i do currently disable and enable the MQTT Bridge Thing once in a while to avoid that the logs get flooded with warnings.

I have the MQTT broker from Venus running on a different port, in my case port 1884. It runs without error messages.