Skip to content

Generalize the last_reading staleness-timestamp pattern beyond outdoor temperature #200

Description

@andrew-blake

Motivation

PR #173 adds a last_reading timestamp attribute to the outdoor-temperature sensor
because its value comes from a trendsummary report that updates on its own
independent cadence, separate from the coordinator's main poll — so the displayed
value can go stale relative to when it was actually read (the subject of the earlier
outdoor-temp staleness investigation, #152). The same staleness risk applies to
other sensors that don't come from the main context poll.

Sensors affected

The coordinator's 60s poll (UPDATE_INTERVAL) only calls get_user_context().
Everything below runs on an independent cadence and has no staleness signal today:

  • Energy (API_TELEMETRY_ENERGY, 30 min cadence): ATA energy; ATW
    energy_consumed, energy_produced, cop
  • Telemetry (get_telemetry_actual, 60 min cadence — and notably only requests
    a 4-hour lookback window and keeps the latest point in it, so a reading can
    already be old on arrival): all 8 ATW flow/return temperature sensors, plus ATW
    wifi_signal

Sensors reading straight from the main context payload (room/zone/tank temperature,
operation status, ATA/ATW rssi from context) are poll-fresh already and don't need
this — HA's built-in last_updated covers them.

Proposal

Once #173 merges, extract its last_reading/timestamp-parsing logic into a shared
helper or mixin rather than copy-pasting the attribute across four more sensor
groups, and apply it to the energy and telemetry sensors listed above.

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