feat: add rate adjust indicators to JSON plan#3662
Merged
springfall2008 merged 2 commits intomainfrom Mar 26, 2026
Merged
Conversation
The JSON raw plan data was missing the rate adjust type that the legacy HTML plan used to show estimated/replicated rates (? symbols, italic). Both the built-in web UI and SaaS frontend consume the JSON plan but had no way to indicate which rates are confirmed vs estimated. Adds import_rate_adjust and export_rate_adjust fields to each JSON row, and updates the web UI renderer to display italic text with the appropriate symbol (matching output.py adjust_symbol behaviour). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds rate-adjustment metadata to the JSON plan output so the built-in web UI (and external consumers) can display the same “rate source/adjustment” indicators that previously only existed in the legacy HTML plan.
Changes:
- Add
import_rate_adjust/export_rate_adjustfields to each JSON plan row (plan_html.attributes.raw.rows). - Update the built-in JSON plan renderer JS to display the corresponding symbol (matching
Output.adjust_symbol) and italicize adjusted/replicated rates.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| apps/predbat/output.py | Emits per-row rate-adjust “type” fields into the JSON raw plan output. |
| apps/predbat/web_helper.py | Renders the new adjust-type fields in the web UI plan table via symbol mapping + italics. |
1. Rename import_rate_adjust/export_rate_adjust to import_rate_adjust_type/ export_rate_adjust_type to avoid confusion with numeric *_rate_adjusted fields 2. Omit adjust_type keys when None to reduce HA state attribute bloat (16KB limit on plan_html attributes) 3. Add test_plan_json_rate_adjust unit test validating adjust_symbol mapping, field presence when adjusted, and key omission when not adjusted Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
import_rate_adjustandexport_rate_adjustfields to each row in the JSON raw plan data (plan_html.attributes.raw)adjust_symbol()behaviour from the legacy HTML plan:?for copied,? ⚖for future rates,? ⅆfor offset,=for user-set,ȣfor manual,±for increment,$for saving sessionsThe JSON plan was missing this information — the legacy HTML plan showed it via
adjust_symbol()but the JSON rows only had the rate values. Both the built-in web UI and external consumers (SaaS frontend) now have access to the adjust type.Test plan
?symbol in the web UI plan tableplan_html.attributes.rawJSON rows containimport_rate_adjust/export_rate_adjustfields🤖 Generated with Claude Code