Skip to content

D6: PMIC temperature reading (Raspberry Pi 4/5) #56

Description

@LarsLaskowski

Epic: More Metrics

Why

The Raspberry Pi SoC exposes only a single physical die sensor — cpu-thermal / thermal_zone0 and vcgencmd measure_temp read the same sensor (CPU and GPU share the die, so the existing GPUTemperature reading is not a distinct physical sensor). The Pi 4 and Pi 5, however, carry a separate Power-Management IC (PMIC) with its own temperature sensor, readable via vcgencmd measure_temp pmic. This is the only genuinely additional on-board sensor available without extra hardware, and it is useful for spotting power-delivery / board-level heat issues distinct from the SoC.

Scope

When vcgencmd is available, additionally run vcgencmd measure_temp pmic and expose the result as a separate, optional reading. Output has the same temp=NN.N'C form as measure_temp, so the existing parser can be reused. On boards without a PMIC sensor (Pi 3 and earlier) the command fails or returns nothing — treat that as "not present" and omit the field, exactly like the current GPU-temp fallback.

Reuse & touch points

  • internal/collector/temperature.go — reuse vcgencmdPath discovery (NewTemperatureCollector, line 88) and the existing parseVcgencmdTemp (line 132); add a readVcgencmdTemp-style call with the pmic argument.
  • internal/collector/types.go — new optional PMICTemperature field on the snapshot (omitempty), mirroring GPUTemperature.
  • Wire into the snapshot assembly in collector.go, next to the temperature/GPU handling.
  • Dashboard: optionally surface it in the Temperature card (internal/web/assets/index.html / app.js).

API & config impact

Additive pmic_temperature object in the snapshot (omitempty); no breaking change. No new runtime dependency (reuses vcgencmd, like the current GPU reading).

Acceptance criteria

  • parseVcgencmdTemp (reused) decodes a temp=NN.N'C PMIC fixture correctly.
  • When the pmic command fails or is unsupported, the field is omitted and collection does not fail (same graceful-degradation pattern as the GPU reading).
  • Off-Pi / no vcgencmd: field absent, no error.

Relationship to D7

Complementary, not overlapping: the PMIC temperature is a vcgencmd-only value and is not exposed through the sysfs hwmon interface on Raspberry Pi OS, so the generic hwmon collector (D7) will not pick it up. This issue covers the vcgencmd path; D7 covers the sysfs path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions