Skip to content

Fall back to psutil for network interfaces LibreHardwareMonitor has no sensors for#1037

Open
axectly wants to merge 1 commit into
mathoudebine:mainfrom
axectly:pr/lhm-net-psutil-fallback
Open

Fall back to psutil for network interfaces LibreHardwareMonitor has no sensors for#1037
axectly wants to merge 1 commit into
mathoudebine:mainfrom
axectly:pr/lhm-net-psutil-fallback

Conversation

@axectly

@axectly axectly commented Jul 25, 2026

Copy link
Copy Markdown

Problem

With HW_SENSORS: LHM (or AUTO on 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 no Data or Throughput sensor 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 the Disk class in this file, which already reads everything from psutil.

  • The fallback triggers on the absence of Data/Throughput sensors, 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).
  • Rates are computed from the time elapsed between two psutil samples, so they stay correct regardless of the configured INTERVAL.
  • Interface names need no translation: configure.py fills the ETH/WLO fields from psutil.net_if_addrs(), so the name in config.yaml is 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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant