Force inverter status update after programming, show debug status on dashboard, add power flow refresh button#3575
Merged
springfall2008 merged 4 commits intomainfrom Mar 15, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve post-programming UX by triggering a quicker inverter data refresh (so power-flow updates sooner) and by making dashboard/MCP status reads respect the configured prefix rather than hardcoding predbat.status.
Changes:
- Use
prefix + ".status"instead of hardcodedpredbat.statusin MCP status tool and runtime health checks. - Update the web dashboard status section to pull
status/detail/debugdirectly from the status entity (and expose debug as a tooltip). - Force an earlier “quick inverter data update” by adjusting
inverter_data_last_fetchat the end ofupdate_pred().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| apps/predbat/web_mcp.py | Switch status entity lookup toward prefixed entity IDs for MCP get_status. |
| apps/predbat/web.py | Dashboard status rendering now reads status/detail/debug from the status entity and adds debug tooltip support. |
| apps/predbat/predbat.py | Forces a quick inverter refresh shortly after a full update cycle; updates is_running() to use prefixed status entity. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+487
to
+498
| status_entity = self.prefix + ".status" | ||
| last_updated = self.get_state_wrapper(status_entity, attribute="last_updated", default=None) | ||
| status = self.get_state_wrapper(status_entity, default="Unknown") | ||
| detail = self.get_state_wrapper(status_entity, attribute="detail", default="") | ||
| debug = self.get_state_wrapper(status_entity, attribute="debug", default="") | ||
| status_full = status + " " + detail | ||
| debug_escaped = str(debug).replace("&", "&").replace("<", "<").replace(">", ">").replace('"', """) | ||
| debug_title = ' title="{}"'.format(debug_escaped) if debug else "" | ||
| if status and (("Warn:" in status) or ("Error:" in status)): | ||
| text += "<tr><td>Status</td><td bgcolor=#ff7777>{}</td></tr>\n".format(status) | ||
| text += "<tr><td>Status</td><td bgcolor=#ff7777{}>{}</td></tr>\n".format(debug_title, status_full) | ||
| elif not is_running: | ||
| text += "<tr><td colspan='2' bgcolor='#ff7777'>{} (unhealthy)</td></tr>\n".format(status) | ||
| text += "<tr><td colspan='2' bgcolor='#ff7777'{}>{} (unhealthy)</td></tr>\n".format(debug_title, status_full) |
Comment on lines
+1095
to
+1097
| # Schedule inverter update for 30 seconds time to allow the inverter to process the changes we just made before we fetch the data again | ||
| # This allows the power flow to update for the user more quickly. | ||
| self.inverter_data_last_fetch = datetime.now() - timedelta(seconds=INVERTER_QUICK_UPDATE_SECONDS) + timedelta(seconds=30) |
Comment on lines
+1093
to
+1094
| status_entity = self.prefix + ".status" | ||
| last_updated = self.base.get_state_wrapper(status_entity, attribute="last_updated", default=None) |
apps/predbat/web.py
Outdated
| text += "<tr><td colspan='2' bgcolor='#ff7777'{}>{} (unhealthy)</td></tr>\n".format(debug_title, status_full) | ||
| else: | ||
| text += "<tr><td>Status</td><td>{}</td></tr>\n".format(status) | ||
| text += "<tr><td>Status</td><td{}>{}</td></tr>\n".format(debug_title, status) |
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.
No description provided.