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

Available os updates are only shown for 1/4 raspberries #112

Open luebbe opened 8 months ago

luebbe commented 8 months ago

Checklist:

Release with the issue: v1.8.5

Last working release (if known):

Hardware, Operating System, Python version: I have four raspberries all running version 1.8.5 of RPi-Reporter:

Description of problem:

Only on one of them, the 3B, RPi-Reporter returns the number of available OS updates.

grafik

Json of the "monitor" topic of pi-sprinkler (ux_pdates=0)

{"info": {"timestamp": "2023-10-09T10:16:08+02:00", "rpi_model": "RPi 1 ModelB+r1.2", "ifaces": "e", "host_name": "pi-sprinkler", "fqdn": "pi-sprinkler", "ux_release": "bullseye", "ux_version": "6.1.21+", "ux_updates": 0, "up_time": "36 days,  14:35", "up_time_secs": 3162900, "last_update": "2023-10-09T11:14:00+02:00", "fs_total_gb": 32, "fs_free_prcnt": 93, "fs_used_prcnt": 7, "networking": {"eth0": {"mac": "b8:27:eb:72:b6:ff", "rx_data": 0, "tx_data": 0}, "wlan0": {"IP": "192.168.0.76", "mac": "00:13:ef:20:29:7d", "rx_data": 32481, "tx_data": 20152}}, "drives": {"root": {"size_gb": 32, "used_prcnt": 7, "device": "/dev/root", "mount_pt": "/"}}, "memory": {"size_mb": 429, "free_mb": 326, "size_swap": 100, "free_swap": 95}, "mem_used_prcnt": 24, "cpu": {"hardware": "BCM2835", "model": "ARMv6-compatible processor rev 7 (v6l)", "number_cores": 2, "bogo_mips": "697.95", "serial": "000000000c72b6ff", "load_1min_prcnt": 5.5, "load_5min_prcnt": 16.5, "load_15min_prcnt": 17.5}, "throttle": ["throttled = 0x0", "Not throttled"], "temperature_c": 34.2, "temp_gpu_c": 34.2, "temp_cpu_c": 34.7, "reporter": "ISP-RPi-mqtt-daemon v1.8.5", "reporter_releases": "v1.8.5,v1.7.2,v1.7.3,v1.7.4,v1.8.3,v1.8.4", "report_interval": 5}}

Output of "sudo apt update" on pi-sprinkler

pi@pi-sprinkler:/opt/RPi-Reporter-MQTT2HA-Daemon $ sudo apt update
Get:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease [15.0 kB]
Get:2 http://archive.raspberrypi.org/debian bullseye InRelease [23.6 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages [13.2 MB]
Get:4 http://archive.raspberrypi.org/debian bullseye/main armhf Packages [314 kB]
Get:5 http://raspbian.raspberrypi.org/raspbian bullseye/non-free armhf Packages [106 kB]
Fetched 13.7 MB in 39s (347 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
40 packages can be upgraded. Run 'apt list --upgradable' to see them.

So in theory RPi-reporter should report 40 available OS updates. I guess it's a configuration problem, but I can't spot it. There is no obvious difference in the config.ini files between the machines. Only the mqtt hostname, base_topic and sensor_name are defined. All other options are at their default values (commented out). Maybe a permission problem?

Python errors shown in the logs (if applicable):

There are no erros shown on any of the devices.

Additional information:

luebbe commented 8 months ago

OK, that seems to be a bit more complicated. I just updated the raspberry 3B. Sudo apt update reported 44 available updates instead of the 29 shown by RPI-reporter. Now after running sudo apt upgrade, RPi-reporter still shows 29 available updates. Where does it get this value from?

bsimmo commented 8 months ago

https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/blob/4951bc918c4d889467c3386794d9e0730add4ed6/ISP-RPi-mqtt-daemon.py#L546 https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/blob/4951bc918c4d889467c3386794d9e0730add4ed6/ISP-RPi-mqtt-daemon.py#L1119 https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/blob/4951bc918c4d889467c3386794d9e0730add4ed6/ISP-RPi-mqtt-daemon.py#L1160

and here https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/blob/4951bc918c4d889467c3386794d9e0730add4ed6/ISP-RPi-mqtt-daemon.py#L1189

and right at the start where it checks for apt and a bit later where it sends.

Look at the bottom of the readme and run it in debug mode to see what it is seeing.

luebbe commented 8 months ago

Thanks. I'll keep an eye on it. It still looks inconsistent here.