Hi @Charley. Thanks for your project.
I have made dBmeter exactly the same as yours and it seems to bew orking just fine.
In MQTT Explorer I can see it is reporting very well. But when chceked /var/log/mosquitto/mosquitto.log
it is full of errors:
1637259513: New connection from 192.168.0.137 on port 1883.
1637259513: New client connected from 192.168.0.137 as dBmeter-592d (c1, k15, u'openhab').
1637259882: Client dBmeter-592d has exceeded timeout, disconnecting.
1637259882: Socket error on client dBmeter-592d, disconnecting.
1637259892: New connection from 192.168.0.137 on port 1883.
1637259892: New client connected from 192.168.0.137 as dBmeter-fd2f (c1, k15, u'openhab').
1637260006: Client dBmeter-fd2f has exceeded timeout, disconnecting.
1637260006: Socket error on client dBmeter-fd2f, disconnecting.
1637260030: New connection from 192.168.0.137 on port 1883.
1637260030: New client connected from 192.168.0.137 as dBmeter-7436 (c1, k15, u'openhab').
1637260053: Client dBmeter-7436 has exceeded timeout, disconnecting.
1637260053: Socket error on client dBmeter-7436, disconnecting.
1637260055: New connection from 192.168.0.137 on port 1883.
1637260055: New client connected from 192.168.0.137 as dBmeter-2ec9 (c1, k15, u'openhab').
1637260264: Client dBmeter-2ec9 has exceeded timeout, disconnecting.
1637260264: Socket error on client dBmeter-2ec9, disconnecting.
1637260280: New connection from 192.168.0.137 on port 1883.
1637260280: New client connected from 192.168.0.137 as dBmeter-15ee (c1, k15, u'openhab').
1637260351: Client dBmeter-15ee has exceeded timeout, disconnecting.
1637260351: Socket error on client dBmeter-15ee, disconnecting.
1637260364: New connection from 192.168.0.137 on port 1883.
1637260364: New client connected from 192.168.0.137 as dBmeter-3bd7 (c1, k15, u'openhab').
1637260533: Client dBmeter-3bd7 has exceeded timeout, disconnecting.
1637260533: Socket error on client dBmeter-3bd7, disconnecting.
1637260538: New connection from 192.168.0.137 on port 1883.
1637260538: New client connected from 192.168.0.137 as dBmeter-f26d (c1, k15, u'openhab').
1637260562: Client dBmeter-f26d has exceeded timeout, disconnecting.
1637260562: Socket error on client dBmeter-f26d, disconnecting.
1637260563: New connection from 192.168.0.137 on port 1883.
1637260563: New client connected from 192.168.0.137 as dBmeter-dcea (c1, k15, u'openhab').
1637260826: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1637260904: Client dBmeter-dcea has exceeded timeout, disconnecting.
1637260904: Socket error on client dBmeter-dcea, disconnecting.
1637260928: New connection from 192.168.0.137 on port 1883.
1637260928: New client connected from 192.168.0.137 as dBmeter-e019 (c1, k15, u'openhab').
1637261040: Client dBmeter-e019 has exceeded timeout, disconnecting.
1637261040: Socket error on client dBmeter-e019, disconnecting.
1637261050: New connection from 192.168.0.137 on port 1883.
1637261050: New client connected from 192.168.0.137 as dBmeter-581d (c1, k15, u'openhab').
1637261143: Client dBmeter-581d has exceeded timeout, disconnecting.
1637261143: Socket error on client dBmeter-581d, disconnecting.
1637261160: New connection from 192.168.0.137 on port 1883.
1637261160: New client connected from 192.168.0.137 as dBmeter-53a7 (c1, k15, u'openhab').
1637261184: Client dBmeter-53a7 has exceeded timeout, disconnecting.
1637261184: Socket error on client dBmeter-53a7, disconnecting.
1637261221: New connection from 192.168.0.137 on port 1883.
1637261221: New client connected from 192.168.0.137 as dBmeter-e53e (c1, k15, u'openhab').
1637261273: Client dBmeter-e53e has exceeded timeout, disconnecting.
1637261273: Socket error on client dBmeter-e53e, disconnecting.
1637261282: New connection from 192.168.0.137 on port 1883.
1637261282: New client connected from 192.168.0.137 as dBmeter-ed77 (c1, k15, u'openhab').
1637261397: Client dBmeter-ed77 has exceeded timeout, disconnecting.
1637261397: Socket error on client dBmeter-ed77, disconnecting.
1637261403: New connection from 192.168.0.137 on port 1883.
1637261403: New client connected from 192.168.0.137 as dBmeter-4731 (c1, k15, u'openhab').
Have you ever checked it in your log file?
Is it a problem with code itself?