Skip to content

feat: add thermostat temperature history - #174

Open
matt-thepie wants to merge 2 commits into
Pyhass:devfrom
matt-thepie:feat/temperature-history
Open

matt-thepie wants to merge 2 commits into
Pyhass:devfrom
matt-thepie:feat/temperature-history

Conversation

@matt-thepie

Copy link
Copy Markdown
Contributor

Summary

Adds thermostat temperature history, requested in #34.

  • HiveApiAsync.get_heating_history and HiveApi.get_heating_history(node_id, start, end, time_unit="HOURS", rate=1) call /history/heating/<id> with start/end in milliseconds since the epoch. operation is fixed to AVG, the only value Hive accepts. Both layers are coded by hand since unasync does not cover the API modules.
  • Climate.get_temperature_history(device, start, end, time_unit="HOURS", rate=1) returns [{"date": <int ms>, "temperature": <float>}, ...] sorted by date. Hive returns dates as strings; they are cast to int. Returns [] in file mode, on HiveApiError, and for malformed responses, so callers never see an exception for a zone without history.
  • camelCase alias getTemperatureHistory on HeatingCompatMixin.
  • README snippet.

Home Assistant impact

Additive only. Nothing in the HA hive integration calls these methods; climate.py on dev uses getClimate, setMode, setTargetTemperature and setBoostOn/Off only. No existing method, return shape or device.status key changes.

Testing

  • Full suite: 1072 passed, coverage 100%. ruff, mypy, pylint 10/10, bandit clean.
  • Live against a heating zone: 24 hourly rows over the last day and 7 daily rows over the last week, values matching the Hive app's graph. Both the product ID and its boilermodule parent ID work; the thermostatui and hub IDs return 404.
  • trvcontrol zones return 404 ({"error": "NOT_FOUND"}), which the getter turns into [] with a warning. Hot water history was not tried; I have a combi boiler.

Note: running against the live service today also needs #169, since the Hive SSO login page changed on 2026-10-20.

Closes #34

🤖 Generated with Claude Code

Adds get_heating_history to both API layers (async and sync), calling
/history/heating/<id> with start/end in ms since epoch, timeUnit and rate,
always with operation=AVG (the only value Hive accepts).

Adds Climate.get_temperature_history(device, start, end, time_unit, rate),
which returns [{"date": <int ms>, "temperature": <float>}, ...] sorted by
date, with int-cast dates (Hive returns them as strings). Returns [] in
file mode, on HiveApiError (Hive answers 404 for zones with no history,
including TRVs) and for malformed responses. camelCase alias
getTemperatureHistory included.

Verified live against a heating zone: 24 hourly rows over a day and 7 daily
rows over a week. TRV zones return 404 as noted in the issue.

Closes Pyhass#34

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (dev@0294877). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff           @@
##             dev     #174   +/-   ##
======================================
  Coverage       ?   99.96%           
======================================
  Files          ?       30           
  Lines          ?     2672           
  Branches       ?      313           
======================================
  Hits           ?     2671           
  Misses         ?        0           
  Partials       ?        1           
Flag Coverage Δ
unittests 99.96% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/api/hive_api.py 100.00% <100.00%> (ø)
src/api/hive_async_api.py 100.00% <100.00%> (ø)
src/devices/heating.py 100.00% <100.00%> (ø)
src/helper/compat_aliases.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

[FEATURE] Add thermostat temperature history

1 participant