Repository navigation
Add hvac-predict: steer a thermostat's setpoints ahead of the weather - #1
Open
dannysauer wants to merge 3 commits into
Open
dannysauer wants to merge 3 commits into
dannysauer wants to merge 3 commits into
Conversation
hvac-predict is a command line tool for a Home Assistant thermostat that is left in auto mode. It chooses the heating and cooling setpoints from the weather forecast and a thermal model of the house, and never changes the mode. It lives in hvac_predict/ and touches nothing else. - train fits a small thermal model to the sensor history in VictoriaMetrics: a bounded least-squares fit of the rate of change, with terms for heat stored in the walls. It checks the model against the newest fifth of the history and does not write one that does no better than assuming no change. - decide predicts the house with the equipment off and picks a pair of setpoints for the comfort setting the thermostat's schedule has reached: heat at the target, or cool at the target, a differential apart. After a change of target the house gets coast_minutes to reach it unaided before the equipment drives it there. Nothing is set without --apply. - The tool leaves the thermostat alone when it is not in heat_cool mode, holds another preset such as a vacation, has no configured target, is on a hold the tool has no record of placing, or the enable entity is off. - State between runs is a small JSON file, read and written under a lock. Data from both services is treated as untrusted. The design is written down in the trellis layout under hvac_predict/docs/: an architecture overview with the checks to make against the real system, requirements HVP-001 to HVP-024 traced to tests, six decision records (two accepted, four proposed), and evidence receipts. docs/planning/follow-up.md lists the concerns that remain and the results of the simulation testing. Nothing here has run against a real Home Assistant, ecobee or VictoriaMetrics. In simulation the tool reaches a new target sooner than a thermostat left on one pair and does not save energy. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jc6x3jsgxX6aQk6rRgNmHp
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. If you do not manage the paying account, contact this repository's admins. |
pre-commit.ci is installed on this repository and reports "error during ci config" on a pull request. The repository had no .pre-commit-config.yaml, and pre-commit can't run without one: `pre-commit run --all-files` stops with "InvalidConfigError: .pre-commit-config.yaml is not a file". The new configuration runs `ruff check` and `ruff format --check` on hvac_predict/ only, at the ruff version hvac_predict pins. The older scripts are left out because they fail both. The hooks are local, so pre-commit.ci's scheduled update has no version to move away from that pin, and they only report, so nothing is pushed to a pull request's branch. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jc6x3jsgxX6aQk6rRgNmHp
The owner's code-quality review found three pieces of the rules in advisor.py, where a test of the rules alone could not reach them: the time a house is given to reach a new target, the limit on a drift's idle setpoint (HVP-018), and the check that the thermostat still holds the tool's choice. decide() now takes what the state file remembers, a Change and a Choice, and applies all three itself. Settling, Standing and the two functions that built them are gone, and a Goal refuses a reach that would not bound its drift pair. Also from that review: - outlook.py takes the prediction of the house left alone out of advisor.py. - tests/test_advisor.py, at 994 lines, becomes test_advise.py, test_steer.py and test_outlook.py, with what they share in advising.py. - thermal._Dynamics keeps the history its runs start from, training.py calls fit and backtest through typed helpers in place of partials, and the keys of `decide --json` are listed once. What the tool does is unchanged. The tests of advise and steer pass with their assertions untouched, 120,000 random decisions and two trained models match the old code exactly, and the ten-day simulation prints the same output. The receipt of 2026-11-19 under docs/planning/evidence has the checks. Two reviews of the restructuring added tests, and two things they found that were already true are now open questions 25 and 26: a reading's age is counted from the newest five-minute mark, and the model file is believed as written. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jc6x3jsgxX6aQk6rRgNmHp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
hvac_predict/is a new, self-contained project. It's a command line tool for a Home Assistant thermostat that is left in auto mode: it chooses the heating and cooling setpoints from the weather forecast and a thermal model of the house, and never changes the mode.trainfits the model to the sensor history in VictoriaMetrics.decidepredicts the house with the equipment off, and picks one of two pairs of setpoints for the comfort setting the thermostat's schedule has reached, or a wider third pair while the house drifts to a new target. It doesn't change the thermostat unless you pass--apply; it writes its state file either way.hvac_predict/README.mdis the operator's guide.The PR has three commits:
.pre-commit-config.yamlat the root. pre-commit.ci is installed on this repository and reported an error on this PR while the repository had no configuration for it. The file has it runruff checkandruff format --checkonhvac_predict/and on nothing else. If you'd rather take pre-commit.ci off this repository, drop that commit.advisor.pyintodecision.py, moves the prediction intooutlook.py, and splits a 994-line test file. It changes nothing the tool does.Status: not yet run against anything real
The tool has only met simulated houses and stand-ins for Home Assistant and VictoriaMetrics. Everything it assumes about the ecobee comes from reading the source of Home Assistant's ecobee integration.
So this PR is for review, not for use. A review with access to Home Assistant and the metrics is planned before the tool steers the real thermostat, and
docs/planning/follow-up.mdis written for it. That file lists what still needs checking and gives the simulation results.Where to start reading
docs/planning/follow-up.mdfor the concerns and the simulation results.docs/architecture/overview.mdfor how a decision is made, what the code assumes about Home Assistant, and ten checks to make against the real system. Two of those checks change the thermostat and need the owner's go-ahead, and so does the firstdecide --apply.docs/adrs/for the decisions. Two are Accepted, because the owner stated them: leave the thermostat in auto mode, and give the house a fixed time to reach a new target unaided. Four are Proposed and are the implementer's choices.How it was tested
ruffandmypyare clean. The tests fit the model to simulated houses and run both commands against stand-ins for the two services. Only the tworuffcommands run on this PR, through pre-commit.ci; the tests andmypyran locally.thermo-nuclear-code-quality-reviewfollowed, and did not approve the code as it stood; the third commit answers it. Two more reviews, of that commit alone, found no change in behaviour. The fixes from the last round of each have tests behind them and no independent review yet.Things a reviewer should know
homeassistant.enable_entityconfigured, which the example configuration leaves out.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jc6x3jsgxX6aQk6rRgNmHp