hjelev / rpi-mqtt-monitor

Raspberry Pi MQTT Monitor gathers system information and sends it to a MQTT server.
GNU General Public License v3.0
176 stars 42 forks source link

Not all devices have a vendor in cpuinfo #94

Closed Deniom3 closed 5 months ago

Deniom3 commented 7 months ago

Hello

Thanks for the good tool, I was able to run it on my TV box running Armbian. But I had to make an edit because not all processors have vendor information in them; receiving the manufactory fails with an error.

Could you add a check for this situation or provide an alternative option for obtaining data, for example, use model name instead of vendor.

Below is the error trace:

Traceback (most recent call last): File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 711, in gather_and_send_info() File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 617, in gather_and_send_info print_measured_values(cpu_load, cpu_temp, used_space, voltage, sys_clock_speed, swap, memory, uptime_days, uptime_seconds, wifi_signal, wifi_signal_dbm, rpi5_fan_speed) File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 205, in print_measured_values """.format(config.version, check_model_name(), get_manufacturer(), get_os(), hostname, get_network_ip(), get_mac_address()) ^^^^^^^^^^^^^^^^^^ File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 143, in get_manufacturer pretty_name = pretty_name.split(':')[1].replace('\n', '')


IndexError: list index out of range
hjelev commented 5 months ago

Hi, I am using both vendor and model name, but added a check in version 0.8.9 to display unknown in case its missing. Let me know if it works on Armbian

Deniom3 commented 5 months ago

It works, thanks, now your solution is applicable to even more devices.