Fall back to psutil for network interfaces LibreHardwareMonitor has no sensors for#1037
Open
axectly wants to merge 1 commit into
Open
Fall back to psutil for network interfaces LibreHardwareMonitor has no sensors for#1037axectly wants to merge 1 commit into
axectly wants to merge 1 commit into
Conversation
LibreHardwareMonitor reports some adapters without any Data or Throughput sensor: no value is ever assigned, so Net.stats() silently returns zeros and the network widgets stay empty. This happens for example with a Wi-Fi adapter that LHM does enumerate (it is listed at startup) but exposes no counters for. Fall back to psutil for those interfaces, like the Disk class in this file already does for data LHM does not provide. Interfaces LHM does report sensors for keep using LHM, so the counters displayed there are unchanged. The fallback is selected on the absence of network sensors rather than on values being zero, so an idle interface is not switched over, and rates are computed from the elapsed time between two samples. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With
HW_SENSORS: LHM(orAUTOon Windows), the network widgets stay empty for some adapters.LibreHardwareMonitor does enumerate the interface — it is listed at startup as
Found Network interface: <name>— but exposes noDataorThroughputsensor for it.Net.stats()therefore never assigns a value and silently returns(0, 0, 0, 0): upload/download rates, totals and the network line graphs all render nothing, with no error anywhere.Reproduced on Windows 11 / Python 3.13 with a Wi-Fi adapter, where
psutil.net_io_counters(pernic=True)reports correct traffic for the very same interface name.Changes
Net.stats()now falls back to psutil for interfaces LibreHardwareMonitor has no network sensors for, in the same spirit as theDiskclass in this file, which already reads everything from psutil.Data/Throughputsensors, not on the values being zero. An interface that LHM does support keeps using LHM even while idle, so its "Data Uploaded/Downloaded" totals (counted from program start) are not silently replaced by psutil's counters (counted from boot).INTERVAL.configure.pyfills the ETH/WLO fields frompsutil.net_if_addrs(), so the name inconfig.yamlis already a psutil key.Tested on a Turing 5" (rev C) with Windows 11 and Python 3.13: the Wi-Fi interface now displays correct rates and totals, and an interface with LHM sensors keeps using LHM.
🤖 Generated with Claude Code