Emonhub - breaking change for paho mqtt

Accidentally came across this. @TrystanLea @glyn.hudson

paho-mqtt-2.0.0 client issue · Issue #814 · eclipse/paho.mqtt.python (github.com)

It looks like paho_mqtt has just been updated to V2 with lots of changes to the API.

Migrations — Eclipse paho-mqtt documentation

image

On a fresh install of emonhub (I’m getting other errors) but I am seeing this

Feb 15 22:07:40 emon-pulse systemd[1]: Starting emonHub data multiplexer...
Feb 15 22:07:40 emon-pulse systemd[1]: Started emonHub data multiplexer.
Feb 15 22:07:51 emon-pulse emonhub[4183]: Exception ignored in: <function Client.__del__ at 0xb5d6b4a8>
Feb 15 22:07:51 emon-pulse emonhub[4183]: Traceback (most recent call last):
Feb 15 22:07:51 emon-pulse emonhub[4183]:   File "/home/pi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 874, in __del__
Feb 15 22:07:51 emon-pulse emonhub[4183]:     self._reset_sockets()
Feb 15 22:07:51 emon-pulse emonhub[4183]:   File "/home/pi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
Feb 15 22:07:51 emon-pulse emonhub[4183]:     self._sock_close()
Feb 15 22:07:51 emon-pulse emonhub[4183]:   File "/home/pi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1119, in _sock_close
Feb 15 22:07:51 emon-pulse emonhub[4183]:     if not self._sock:
Feb 15 22:07:51 emon-pulse emonhub[4183]: AttributeError: 'Client' object has no attribute '_sock'

[edit]
Immediate solution is to modify the emonhub install script to

pip install --upgrade paho-mqtt==1.6.1

As pip is not routinely updated on the upodate script, I don’t think there should be an immediate issue to existing installs.

1 Like

Thanks @borpin does this impact on update or just a new install?

Do we ever run a pip update command on the update scripts. I didn’t check as I wasn’t sure we did.

As long as we don’t, it won’t affect existing installs (I think). If we do do updates then yes, it would break existing installs as we just specify the package so by default it picks up the latest version.

Having said that, I think we should update pip packages when we do system updates. Unfortunately, you have to do it on each package individually.

A VENV would help with this as you can specify the packages for the VENV I think.

1 Like