Skip to content

Bug: a legitimate 0.0 °C reading renders as "n/a"; API cannot distinguish 0 °C from a failed sensor #64

Description

@LarsLaskowski

Source: Full code review 2026-07-17 (docs/reviews/2026-07-17-full-code-review.md), finding F7.
Category: bug · Severity: low · Effort: small (frontend) / medium (API)

Problem

  • The dashboard uses a falsy check — if (snap.temperature && snap.temperature.celsius) (internal/web/assets/app.js:184-190) — so an exact 0 °C (plausible for a Pi in an unheated/outdoor enclosure) shows "n/a".
  • Root cause is the API shape: Snapshot.Temperature is always marshaled (internal/collector/types.go:118-134), and a failed collection yields {"zone": "", "celsius": 0}, so 0 is overloaded.

Suggested fix

  • Within v1 (non-breaking): frontend keys off temperature.zone !== '' (a successful reading always carries a zone) instead of the value's truthiness.
  • Longer term: make the field a pointer (*Temperature, omitted on failure like gpu_temperature) — a breaking change that would have to wait for /api/v2/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions