Bug 466277

Summary: USB sensor devices name changes causes sensors not to be found on nearly every boot
Product: [Frameworks and Libraries] ksystemstats Reporter: Ville Aakko <ville.aakko>
Component: GeneralAssignee: KSysGuard Developers <ksysguard-bugs>
Status: REPORTED ---    
Severity: normal CC: ahiemstra, kde, nate, plasma-bugs, postix
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: A screenshot demonstrating the issue and cause

Description Ville Aakko 2023-02-23 00:39:27 UTC
Plasma System Monitor does not find the sensors on a USB monitoring device after a reboot.

This is because the name of the device in lmsensors changes every boot. It has a suffix in case of USB devices of the form -hid-X-Y (or similar), where X and Y change. In my case, the device is a Corsair Commander Pro.

Plasma System Monitor could be more intelligent in finding the right device. The devices have a name node in /sys/class/hwmon/hwmon?/name, but I'm not sure if this is exposed to System Monitor (does it use libsensors?).

This bug is very similar to the one I've reported against ksysguard: https://bugs.kde.org/show_bug.cgi?id=438031

STEPS TO REPRODUCE
1. Add sensors from a USB sensoring device into Plasma System Monitor
2. Reboot
3. Re-open Plasma System Monitor.

OBSERVED RESULT

More likely than not, the sensors have not been found (retry from step 2 if the bug didn't trigger by chance).

EXPECTED RESULT

The sensors should be found.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version:
Comment 1 Ville Aakko 2023-02-23 00:40:53 UTC
Created attachment 156627 [details]
A screenshot demonstrating the issue and cause
Comment 2 David Redondo 2023-02-23 08:24:47 UTC
> does it use libsensors?)

Yes. I don't know what we can do here tbh the name itself  is not very useful, it's not unique as far as I know.

For your use case you can use a hidden feature, you can configure sensors with regex. For example the default overview page does 
highPrioritySensorIds=["network/(?!all).*/download","network/(?!all).*/upload"]

You should find your page config ~/.local/share/plasma-systemmonitor, locate the sensor ids there and edit so it matches,in your case something like
"lmsensors/corsaircpro.*/temp1" 
and so on
Comment 3 Ville Aakko 2023-02-27 12:52:50 UTC
Hi David!

Wow, I didn't know there is such a nice workaround / hidden feature!

As a workaround, I've been running an in-place sed -command via my crontab @reboot (on the files you've mentioned). But I think this feature is more cleaner, though the sed works, too ;-).

Cheers!