giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.11k stars 1.37k forks source link

Exclude external batteries from sensors_battery #2305

Open RodoMa92 opened 10 months ago

RodoMa92 commented 10 months ago

Summary

Description

The single check for battery in powersupply was causing sometimes to grab external device battery statuses since they have the form of hid\<mac>_battery, which match the bat filter.

However they do not have an ACPI path to the system itself.

This takes into account that detail and properly exclude them from being included as an internal battery.