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

Buster not reporting, status of payload sometimes "offline", sometimes "online" #129

Closed Firesphere closed 4 months ago

Firesphere commented 5 months ago

Checklist:

Release with the issue:

1.8.5

Last working release (if known):

I think 1.8.5, from before I re-installed the Pi

Hardware, Operating System, Python version:

$ neofetch
       _,met$$$$$gg.          pi@Caroline 
    ,g$$$$$$$$$$$$$$$P.       ----------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 10 (buster) aarch64 
 ,$$P'              `$$$.     Host: Raspberry Pi 4 Model B Rev 1.2 
',$$P       ,ggs.     `$$b:   Kernel: 5.10.103-v8+ 
`d$$'     ,$P"'   .    $$$    Uptime: 4 days, 13 hours, 16 mins 
 $$P      d$'     ,    $$P    Packages: 996 (dpkg) 
 $$:      $$.   -    ,d$$'    Shell: bash 5.0.3 
 $$;      Y$b._   _,d$P'      Terminal: /dev/pts/0 
 Y$$.    `.`"Y$$$$P"'         CPU: (4) @ 2.000GHz 
 `$$b      "-.__              Memory: 513MiB / 3795MiB 
  `Y$$
   `Y$$.                                              
     `$$b.
       `Y$$b.
          `"Y$b._
              `"""
$ python3 -V
Python 3.7.3

Description of problem:

Initially, at first run, it was reporting fine, but now it's not reporting anymore, despite the reporter running:

$ service isp-rpi-reporter status
● isp-rpi-reporter.service - RPi Reporter MQTT Client/Daemon
   Loaded: loaded (/opt/RPi-Reporter-MQTT2HA-Daemon/isp-rpi-reporter.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2024-01-18 21:13:18 NZDT; 1 day 14h ago
     Docs: https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon
 Main PID: 18269 (python3)
   Status: "Jan 20 11:40:21 - * NOTIFY: on_message() Topic=[home/nodes/command/rpi-caroline/status] payload=[b'online'] command=[status]."
    Tasks: 4 (limit: 4165)
   CGroup: /system.slice/isp-rpi-reporter.service
           └─18269 /usr/bin/python3 -u /opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py

Jan 18 21:13:13 Caroline systemd[1]: Starting RPi Reporter MQTT Client/Daemon...
Jan 18 21:13:18 Caroline systemd[1]: Started RPi Reporter MQTT Client/Daemon.

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

# SCRIPT genBugInfo v1.1 run 24/01/20-11:37:31
# ----------------------------------------------------------------------

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

deb http://deb.debian.org/debian buster main contrib non-free
deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free
deb http://deb.debian.org/debian buster-updates main contrib non-free

 ----

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

buster

 ----

# /bin/uname -r

5.10.103-v8+

 ----

# /bin/hostname -f

Caroline

 ----

# /usr/bin/uptime

 11:37:31 up 4 days, 13:14,  2 users,  load average: 1.21, 1.13, 1.10
0

 ----

# /sbin/ifconfig

eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether dc:a6:32:a0:d9:a7  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 44492  bytes 2351950 (2.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44492  bytes 2351950 (2.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.44  netmask 255.255.255.0  broadcast 192.168.178.255
        inet6 fe80::4237:2f60:7352:f1bb  prefixlen 64  scopeid 0x20<link>
        inet6 2406:e001:2:1b00:bfcd:8593:414d:842a  prefixlen 64  scopeid 0x0<global>
        ether dc:a6:32:a0:d9:a8  txqueuelen 1000  (Ethernet)
        RX packets 2207475  bytes 1446980819 (1.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1268153  bytes 188359409 (179.6 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 dc:a6:32:a0:d9:a7  txqueuelen 1000  (Ethernet)
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.44  netmask 255.255.255.0  broadcast 192.168.178.255
        ether dc:a6:32:a0:d9:a8  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    303    0        0 wlan0
192.168.178.0   0.0.0.0         255.255.255.0   U     303    0        0 wlan0

 ----

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

/bin/ls: cannot access '/var/log/dpkg.log.1': No such file or directory
-rw-r--r-- 1 root root 395900 Jan 15 22:35 /var/log/dpkg.log

 ----

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

/var/log/dpkg.log:2024-01-15 22:35:03 status installed man-db:arm64 2.8.5-2

 ----

# /bin/df -m

Filesystem                                                      1M-blocks   Used Available Use% Mounted on
/dev/root                                                           29082   3625     24247  14% /
devtmpfs                                                             1736      0      1736   0% /dev
tmpfs                                                                1898      0      1898   0% /dev/shm
tmpfs                                                                1898     19      1880   1% /run
tmpfs                                                                   5      1         5   1% /run/lock
tmpfs                                                                1898      0      1898   0% /sys/fs/cgroup
/dev/mmcblk0p1                                                        253     30       223  12% /boot
//192.168.178.1/treestore/Seagate_Expansion_Drive/RetroPie/roms    954274 715189    239085  75% /home/pi/RetroPie/roms
tmpfs                                                                 380      0       380   0% /run/user/1000

 ----

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

/dev/root                                                           29082   3625     24247  14% /
//192.168.178.1/treestore/Seagate_Expansion_Drive/RetroPie/roms    954274 715189    239085  75% /home/pi/RetroPie/roms

 ----

# 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 18792 Nov 30  2021 /usr/bin/vcgencmd

 ----

Python errors shown in the logs (if applicable):

None.

Additional information:

bsimmo commented 5 months ago

Debian64? PiOS64 ? and not RetroPi OS ?

Any error messages ? <- probably the important part. See https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon?tab=readme-ov-file#troubleshooting and General Debug.

On Fri, 19 Jan 2024 at 22:50, Simon Erkelens @.***> wrote:

Checklist:

  • I updated to the latest version available
  • I checked that my MQTT broker is otherwise working

Release with the issue:

1.8.5

Last working release (if known):

I think 1.8.5, from before I re-installed the Pi

Hardware, Operating System, Python version:

$ neofetch ,met$$$$$gg. @.*** ,g$$$$$$$$$$$$$$$P. ----------- ,g$$P" """Y$$.". OS: Debian GNU/Linux 10 (buster) aarch64 ,$$P' $$$. Host: Raspberry Pi 4 Model B Rev 1.2 ',$$P ,ggs.$$b: Kernel: 5.10.103-v8+ `d$$' ,$P"' . $$$ Uptime: 4 days, 13 hours, 16 mins $$P d$' , $$P Packages: 996 (dpkg) $$: $$. - ,d$$' Shell: bash 5.0.3 $$; Y$b. _,d$P' Terminal: /dev/pts/0 Y$$. ."Y$$$$P"' CPU: (4) @ 2.000GHz $$b "-.__ Memory: 513MiB / 3795MiB Y$$ Y$$. $$b. Y$$b. "Y$b._ `"""

$ python3 -V Python 3.7.3

Description of problem:

Initially, at first run, it was reporting fine, but now it's not reporting anymore, despite the reporter running:

$ service isp-rpi-reporter status ● isp-rpi-reporter.service - RPi Reporter MQTT Client/Daemon Loaded: loaded (/opt/RPi-Reporter-MQTT2HA-Daemon/isp-rpi-reporter.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2024-01-18 21:13:18 NZDT; 1 day 14h ago Docs: https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon Main PID: 18269 (python3) Status: "Jan 20 11:40:21 - * NOTIFY: on_message() Topic=[home/nodes/command/rpi-caroline/status] payload=[b'online'] command=[status]." Tasks: 4 (limit: 4165) CGroup: /system.slice/isp-rpi-reporter.service └─18269 /usr/bin/python3 -u /opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py

Jan 18 21:13:13 Caroline systemd[1]: Starting RPi Reporter MQTT Client/Daemon... Jan 18 21:13:18 Caroline systemd[1]: Started RPi Reporter MQTT Client/Daemon.

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

SCRIPT genBugInfo v1.1 run 24/01/20-11:37:31

----------------------------------------------------------------------

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

deb http://deb.debian.org/debian buster main contrib non-free deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free deb http://deb.debian.org/debian buster-updates main contrib non-free


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

buster


/bin/uname -r

5.10.103-v8+


/bin/hostname -f

Caroline


/usr/bin/uptime

11:37:31 up 4 days, 13:14, 2 users, load average: 1.21, 1.13, 1.10 0


/sbin/ifconfig

eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether dc:a6:32:a0:d9:a7 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 loop txqueuelen 1000 (Local Loopback) RX packets 44492 bytes 2351950 (2.2 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 44492 bytes 2351950 (2.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.178.44 netmask 255.255.255.0 broadcast 192.168.178.255 inet6 fe80::4237:2f60:7352:f1bb prefixlen 64 scopeid 0x20 inet6 2406:e001:2:1b00:bfcd:8593:414d:842a prefixlen 64 scopeid 0x0 ether dc:a6:32:a0:d9:a8 txqueuelen 1000 (Ethernet) RX packets 2207475 bytes 1446980819 (1.3 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1268153 bytes 188359409 (179.6 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 dc:a6:32:a0:d9:a7 txqueuelen 1000 (Ethernet) wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.178.44 netmask 255.255.255.0 broadcast 192.168.178.255 ether dc:a6:32:a0:d9:a8 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 303 0 0 wlan0 192.168.178.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0


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

/bin/ls: cannot access '/var/log/dpkg.log.1': No such file or directory -rw-r--r-- 1 root root 395900 Jan 15 22:35 /var/log/dpkg.log


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

/var/log/dpkg.log:2024-01-15 22:35:03 status installed man-db:arm64 2.8.5-2


/bin/df -m

Filesystem 1M-blocks Used Available Use% Mounted on /dev/root 29082 3625 24247 14% / devtmpfs 1736 0 1736 0% /dev tmpfs 1898 0 1898 0% /dev/shm tmpfs 1898 19 1880 1% /run tmpfs 5 1 5 1% /run/lock tmpfs 1898 0 1898 0% /sys/fs/cgroup /dev/mmcblk0p1 253 30 223 12% /boot //192.168.178.1/treestore/Seagate_Expansion_Drive/RetroPie/roms 954274 715189 239085 75% /home/pi/RetroPie/roms tmpfs 380 0 380 0% /run/user/1000


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

/dev/root 29082 3625 24247 14% / //192.168.178.1/treestore/Seagate_Expansion_Drive/RetroPie/roms 954274 715189 239085 75% /home/pi/RetroPie/roms


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 18792 Nov 30 2021 /usr/bin/vcgencmd


Python errors shown in the logs (if applicable):

None.

Additional information:

  • It's using Buster, because I want to run RetroPie, which doesn't support newer versions of Raspberry Pi Os
  • The previous installation worked, but i needed reinstall because RetroPie itself didn't work anymore
  • manually running does not cause it to turn up in MQTT
  • MQTT is running
  • Other Pis with the exact same configuration work fine
  • MQTT is working, no errors in the logs
  • Initially it worked, but then it... just didn't anymore.
  • I don't know when it "stopped"

— Reply to this email directly, view it on GitHub https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/issues/129, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYAXNYL4WYID7QUORCSEWLYPL2DVAVCNFSM6AAAAABCCUONISVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA4TCNJYGQ2DINQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Firesphere commented 5 months ago

Debian64? PiOS64 ? and not RetroPi OS ?

Yes, 64bit RPi OS (which is recognised as Debian by neofetch).

And I've set my groups:

$ groups daemon
daemon : daemon video

And no, absolutely nothing in the logs, except the expected for restarting, which is the strange thing.

Jan 18 21:13:13 Caroline systemd[1]: Stopping RPi Reporter MQTT Client/Daemon...
Jan 18 21:13:13 Caroline systemd[1]: isp-rpi-reporter.service: Main process exited, code=killed, status=15/TERM
Jan 18 21:13:13 Caroline systemd[1]: isp-rpi-reporter.service: Succeeded.
Jan 18 21:13:13 Caroline systemd[1]: Stopped RPi Reporter MQTT Client/Daemon.
Jan 18 21:13:13 Caroline systemd[1]: Starting RPi Reporter MQTT Client/Daemon...
Jan 18 21:13:18 Caroline systemd[1]: Started RPi Reporter MQTT Client/Daemon.

From what I can see, the reporter seems to "think" everything is fine. But it seems like nothing actually leaves the device, or reaches Mosquitto.

Maybe I should run wireshark on the IP, to see if anything is actually sent out.

bsimmo commented 5 months ago

Did you try the verbose logging (enables lots of print statement to put values and data into logs you can then look at) That under the General bit and then you can stream the log or hack it later. The part that includes

first stop the running daemon

sudo systemctl stop isp-rpi-reporter.service

now run the daemon with Debug and Verbose options enabled

python3 /opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py -d -v

Etc..

On Sun, 21 Jan 2024, 9:47 am Simon Erkelens, @.***> wrote:

Debian64? PiOS64 ? and not RetroPi OS ?

Yes, 64bit RPi OS (which is recognised as Debian by neofetch)

And I've set my groups:

$ groups daemon daemon : daemon video

And no, absolutely nothing in the logs, except the expected for restarting, which is the strange thing.

Jan 18 21:13:13 Caroline systemd[1]: Stopping RPi Reporter MQTT Client/Daemon... Jan 18 21:13:13 Caroline systemd[1]: isp-rpi-reporter.service: Main process exited, code=killed, status=15/TERM Jan 18 21:13:13 Caroline systemd[1]: isp-rpi-reporter.service: Succeeded. Jan 18 21:13:13 Caroline systemd[1]: Stopped RPi Reporter MQTT Client/Daemon. Jan 18 21:13:13 Caroline systemd[1]: Starting RPi Reporter MQTT Client/Daemon... Jan 18 21:13:18 Caroline systemd[1]: Started RPi Reporter MQTT Client/Daemon.

From what I can see, the reporter seems to "think" everything is fine. But it seems like nothing actually leaves the device, or reaches Mosquitto.

Maybe I should run wireshark on the IP, to see if anything is actually sent out.

— Reply to this email directly, view it on GitHub https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/issues/129#issuecomment-1902572355, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYAXNYOAI4W6MNTWHJHAOLYPTP3BAVCNFSM6AAAAABCCUONISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGU3TEMZVGU . You are receiving this because you commented.Message ID: @.***>

Firesphere commented 4 months ago

Apologies for the time it took me to get back, life got in the way.

The problem, as it turned out, was that the pi was reporting to hostname_2, for reasons entirely beyond me. And for further unknown reasons, HomeAssistant had not picked this up.

Today I cleared Mosquitto, restarted all services, and it popped up again.