OH3: MQTT broker connection freezes after some time

Tags: #<Tag:0x00007f17516fb660>


I just updated my OH2 environment to OH3 which was so far a smooth transition.
Everything works fine but a MQTT broker connection to a Victron Cerbo device freezes after some while and linked items don’t get updates anymore (which usually come every second).

When I then edit the broker think in the GUI without changing anything the connection works again for about 2 hours.

Here’s the config of the broker connection:

The log says everything is fine:

2021-02-23 08:26:11.300 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '' with clientid f6116364-3e7a-497b-a5f2-9e395760db1d
2021-02-23 08:26:11.405 [DEBUG] [ab.binding.mqtt.generic.ChannelState] - Subscribed channel mqtt:topic:3f20e560:ForwardEnergy to topic: N/d41243b50f6b/grid/30/Ac/Energy/Forward
2021-02-23 08:26:11.405 [DEBUG] [ab.binding.mqtt.generic.ChannelState] - Subscribed channel mqtt:topic:3f20e560:BatterySoC to topic: N/d41243b50f6b/battery/512/Soc
2021-02-23 08:26:11.407 [DEBUG] [ab.binding.mqtt.generic.ChannelState] - Subscribed channel mqtt:topic:3f20e560:L1Power to topic: N/d41243b50f6b/grid/30/Ac/L1/Power
2021-02-23 08:26:11.433 [INFO ] [b.core.model.script.Power_Monitoring] - Updating the daily power consumption to 3.2000000000000455 kWh
2021-02-23 08:26:11.439 [DEBUG] [ab.binding.mqtt.generic.ChannelState] - Subscribed channel mqtt:topic:3f20e560:WaterTankLevel to topic: N/d41243b50f6b/tank/20/Level
2021-02-23 08:26:11.449 [DEBUG] [ab.binding.mqtt.generic.ChannelState] - Subscribed channel mqtt:topic:3f20e560:GridLost to topic: N/d41243b50f6b/vebus/288/Alarms/GridLost

I already played around with the Reconnect time and the Heartbeat but without success.

I have a second MQTT broker thing connected to Mosquitto which seems to work all the time.

Any idea what could be the reason?

The items again were frozen, then I edited the thing without changes and then the broker connection is alive again:

2021-02-23 10:43:04.105 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:broker:f6c7693758' changed from ONLINE to OFFLINE
2021-02-23 10:43:04.110 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:3f20e560' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2021-02-23 10:43:04.111 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:topic:3f20e560' changed from OFFLINE (BRIDGE_OFFLINE) to ONLINE

It’s not an issue with the broker itself because a “mosquitto_sub -h -t “N/d41243b50f6b/#” -v” from the same machine works all the time.

You can only have one broker connection per broker. You can then use that for every topic or thing you need.

I have two different things, one is the broker connection to Mosquitto with linked items and another thing with different linked items to the Victron Cerbo.

mqtt:broker:f6c7693758 (Type=Bridge, Status=ONLINE, Label=Victron Cerbo Broker, Bridge=null)
mqtt:broker:1e46ce57b7 (Type=Bridge, Status=ONLINE, Label=MQTT Broker, Bridge=null)

Here are the items respectively:

Number VictronForwardEnergy "Netz-Verbrauch [%.1fkWh]" <plug> { channel="mqtt:topic:3f20e560:ForwardEnergy" }
Number VictronL1Power "Leistung L1 [%.1fW]" <power_watts> { channel="mqtt:topic:3f20e560:L1Power" }
Number VictronGridLost "Status [MAP(victron.map):%s]" <power_tower> { channel="mqtt:topic:3f20e560:GridLost" }
Number VictronBatterySoC "Ladestand Batterie [%.1f%%]" { channel="mqtt:topic:3f20e560:BatterySoC" }
Number VictronWaterTankLevel "Frischwassertank [%.0f%%]" <watertank_level> { channel="mqtt:topic:3f20e560:WaterTankLevel" }
Switch PortgatePing { channel="mqtt:topic:61823c9b:Ping" }
Switch PortgatePong { channel="mqtt:topic:61823c9b:Pong" }
Switch PortgateResetPong { channel="mqtt:topic:61823c9b:ResetPong" }
Switch PortgateAlive "Portgate [%s]" <pulse>
String PortgateIsAlive { channel="mqtt:topic:61823c9b:PortgateIsAlive" }

The same constellation worked well for months in OH2 but now the connection to the first broker freezes after some time.

Hope, things are clearer now.