ironsheep / RPi-Reporter-MQTT2HA-Daemon

Linux service to collect and transfer Raspberry Pi data via MQTT to Home Assistant (for RPi Monitoring)
GNU General Public License v3.0
441 stars 62 forks source link

Positional argument missing #146

Closed Firesphere closed 3 months ago

Firesphere commented 3 months ago

Checklist:

Release with the issue:

latest git master

Last working release (if known):

Also latest git master

Hardware, Operating System, Python version:

$ neofetch
  `.::///+:/-.        --///+//-:``    pi@Killarney 
 `+oooooooooooo:   `+oooooooooooo:    ------------ 
  /oooo++//ooooo:  ooooo+//+ooooo.    OS: Raspbian GNU/Linux 12 (bookworm) armv7l 
  `+ooooooo:-:oo-  +o+::/ooooooo:     Host: Raspberry Pi 2 Model B Rev 1.1 
   `:oooooooo+``    `.oooooooo+-      Kernel: 6.6.20+rpt-rpi-v7 
     `:++ooo/.        :+ooo+/.`       Uptime: 7 days, 16 hours, 49 mins 
        ...`  `.----.` ``..           Packages: 744 (dpkg) 
     .::::-``:::::::::.`-:::-`        Shell: bash 5.2.15 
    -:::-`   .:::::::-`  `-:::-       Terminal: /dev/pts/0 
   `::.  `.--.`  `` `.---.``.::`      CPU: BCM2835 (4) @ 900MHz 
       .::::::::`  -::::::::` `       Memory: 94MiB / 920MiB 
 .::` .:::::::::- `::::::::::``::.
-:::` ::::::::::.  ::::::::::.`:::-                           
::::  -::::::::.   `-::::::::  ::::                           
-::-   .-:::-.``....``.-::-.   -::-
 .. ``       .::::::::.     `..`..
   -:::-`   -::::::::::`  .:::::`
   :::::::` -::::::::::` :::::::.
   .:::::::  -::::::::. ::::::::
    `-:::::`   ..--.`   ::::::.
      `...`  `...--..`  `...`
            .::::::::::
             `.-::::-`
$ python3 --version
Python 3.11.2
$ pip3 --version
pip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.11)

Description of problem:

One of the pis in my network throws this error:

Mar 24 11:34:00 Killarney python3[23752]: Exception ignored in: <function Client.__del__ at 0x75dbef78>
Mar 24 11:34:00 Killarney python3[23752]: Traceback (most recent call last):
Mar 24 11:34:00 Killarney python3[23752]:   File "/usr/local/lib/python3.11/dist-packages/paho/mqtt/client.py", line 874, in __del__
Mar 24 11:34:00 Killarney python3[23752]:     self._reset_sockets()
Mar 24 11:34:00 Killarney python3[23752]:   File "/usr/local/lib/python3.11/dist-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
Mar 24 11:34:00 Killarney python3[23752]:     self._sock_close()
Mar 24 11:34:00 Killarney python3[23752]:   File "/usr/local/lib/python3.11/dist-packages/paho/mqtt/client.py", line 1119, in _sock_close
Mar 24 11:34:00 Killarney python3[23752]:     if not self._sock:
Mar 24 11:34:00 Killarney python3[23752]:            ^^^^^^^^^^
Mar 24 11:34:00 Killarney python3[23752]: AttributeError: 'Client' object has no attribute '_sock'
Mar 24 11:34:00 Killarney python3[23752]: Traceback (most recent call last):
Mar 24 11:34:00 Killarney python3[23752]:   File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 1286, in <module>
Mar 24 11:34:00 Killarney python3[23752]:     mqtt_client = mqtt.Client()
Mar 24 11:34:00 Killarney python3[23752]:                   ^^^^^^^^^^^^^
Mar 24 11:34:00 Killarney python3[23752]: TypeError: Client.__init__() missing 1 required positional argument: 'callback_api_version'
Mar 24 11:34:01 Killarney systemd[1]: isp-rpi-reporter.service: Main process exited, code=exited, status=1/FAILURE

It worked fine up until this morning, so I'm a bit stumped, I didn't change anything.

Run our report script 'genBugInfo' on your failing device and include the output here:

# SCRIPT genBugInfo v1.1 run 24/03/24-11:37:09
# ----------------------------------------------------------------------

# /bin/cat /etc/apt/sources.list | /bin/egrep -v '#'

deb [ arch=armhf ] http://raspbian.raspberrypi.com/raspbian/ bookworm main contrib non-free rpi

 ----

# /bin/cat /etc/apt/sources.list | /bin/egrep -v '#' | /usr/bin/awk '{ print $3 }' | /bin/grep . | /usr/bin/sort -u | head -1

arch=armhf

 ----

# /bin/uname -r

6.6.20+rpt-rpi-v7

 ----

# /bin/hostname -f

Killarney

 ----

# /usr/bin/uptime

 11:37:09 up 7 days, 16:48,  2 users,  load average: 0.96, 1.02, 0.94

 ----

# /sbin/ifconfig

eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:01:65:56  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 96  bytes 8575 (8.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 96  bytes 8575 (8.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.29  netmask 255.255.255.0  broadcast 192.168.178.255
        inet6 2406:e001:2:1b00:e7fc:82eb:a9a:2010  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::773c:aa0b:5573:b1a4  prefixlen 64  scopeid 0x20<link>
        ether e8:4e:06:19:c0:fa  txqueuelen 1000  (Ethernet)
        RX packets 3571019  bytes 1005366572 (958.7 MiB)
        RX errors 0  dropped 614301  overruns 0  frame 0
        TX packets 2270206  bytes 324394260 (309.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 ----

# /sbin/ifconfig | /bin/egrep 'Link|flags|inet|ether' | /bin/egrep -v -i 'lo:|loopback|inet6|\:\:1|127\.0\.0\.1'

eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:01:65:56  txqueuelen 1000  (Ethernet)
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.29  netmask 255.255.255.0  broadcast 192.168.178.255
        ether e8:4e:06:19:c0:fa  txqueuelen 1000  (Ethernet)

 ----

# /sbin/route

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         fritz.box       0.0.0.0         UG    600    0        0 wlan0
192.168.178.0   0.0.0.0         255.255.255.0   U     600    0        0 wlan0

 ----

# /bin/ls -l /var/log/dpkg.log /var/log/dpkg.log.1 2>/dev/null

-rw-r--r-- 1 root root 25088 Mar 16 18:50 /var/log/dpkg.log
-rw-r--r-- 1 root root 35715 Feb 27 22:25 /var/log/dpkg.log.1

 ----

# /bin/grep 'status installed' /var/log/dpkg.log /var/log/dpkg.log.1 2>/dev/null | sort | tail -1

/var/log/dpkg.log:2024-03-16 18:50:15 status installed libc-bin:armhf 2.36-9+rpt2+deb12u4

 ----

# /bin/df -m

Filesystem     1M-blocks  Used Available Use% Mounted on
udev                 327     0       327   0% /dev
tmpfs                 93     1        92   2% /run
/dev/mmcblk0p2     28851  3245     24124  12% /
tmpfs                461     0       461   0% /dev/shm
tmpfs                  5     1         5   1% /run/lock
/dev/mmcblk0p1       510    96       415  19% /boot/firmware
tmpfs                 93     0        93   0% /run/user/1000

 ----

# /bin/df -m | /usr/bin/tail -n +2 | /bin/egrep -v 'tmpfs|boot'

udev                 327     0       327   0% /dev
/dev/mmcblk0p2     28851  3245     24124  12% /

 ----

# ls -l /opt/vc/bin/vcgencmd /usr/bin/vcgencmd

ls: cannot access '/opt/vc/bin/vcgencmd': No such file or directory
-rwxr-xr-x 1 root root 5672 Jan 17 02:51 /usr/bin/vcgencmd

 ----

<

Firesphere commented 3 months ago

Additional info: This is the only Pi2 left in my network, All pi2s have been replaced with either Pi0W or a Pi3. All other (14 in total) Pis are working just fine, all running Buster/Bookworm/Bullseye as core os.

bsimmo commented 3 months ago

I would guess mqtt-paho was updated somehow. See other issues on that.

(since it's mqtt module that is throwing the error, the last few lines

python3[23752]: Traceback (most recent call last): Mar 24 11:34:00 Killarney python3[23752]: File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 1286, in <module> Mar 24 11:34:00 Killarney python3[23752]: mqtt_client = mqtt.Client() Mar 24 11:34:00 Killarney python3[23752]: ^^^^^^^^^^^^^ Mar 24 11:34:00 Killarney python3[23752]: TypeError: Client.__init__() missing 1 required positional argument: 'callback_api_version'

Firesphere commented 3 months ago

Duplicate of #138