Skip to content

Raspberry Pi: CPU temperature and model not reported (apps show 0°C / N/A) #46

Description

@Kruton1122

On Raspberry Pi (and likely other ARM SBCs), the cpu_thermal hwmon sensor has no _label file for its single temp1_input entry, so CPU.get_temperatures() falls back to the raw key name temp1. Both the iOS and Android apps only look for Tctl (AMD) or Core N (matching per-cpu frequency indices) when building per-core temperature data, so a Pi's real temperature is silently dropped and the apps show 0°C / N/A.

Repro (Raspberry Pi 4, Debian 13, Docker):

curl http://<pi>:9090/api/status | jq .cpu.temperatures
# {"temp1": [51.608, null]}

No Core N or Tctl key exists, so server-status-ios's transformStatusJSON never populates CPUCore.temperatures, and the app displays 0°C for CPU temperature.

Second, related regression: CPU.get_cpu_info() in lib/machine/cpu.py only parses the model name field from /proc/cpuinfo, which doesn't exist on ARM (Raspberry Pi's /proc/cpuinfo instead has a Model line, e.g. Model : Raspberry Pi 4 Model B Rev 1.4). This fallback used to exist (commit 8fa823e, "machine: Detect Raspberry Pi CPU model name") but appears to have been lost during the backend rewrite (de2ec53). Current behavior: cpu.model is always null on ARM boards, apps show "N/A". Same rewrite also dropped populating cores on ARM since there's no cpu cores line either (stays hardcoded to 1).

Suggested fix (what I patched locally to unblock myself, happy to open a PR if useful):

  • In get_temperatures(), when the detected sensor is cpu_thermal and only one reading exists, alias it to Core 0..N-1 (using os.cpu_count()) so existing app-side parsing picks it up. Note the app's CPUCore.temperatures is typed as [Int], so the value must be rounded — the cpu_thermal sensor reports sub-degree precision (e.g. 51608 milli-°C) unlike many desktop sensors that only report whole-degree multiples, and an unrounded float fails Swift's strict JSON decode entirely (this actually broke the app's data loading altogether, not just the temperature display).
  • In get_cpu_info(), add back a Model line fallback for cpu_model, and fall back cores to os.cpu_count() when no cpu cores line is found.

Happy to share the small diff if it's useful, or open a PR directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions