Skip to content

Force inverter status update after programming, show debug status on dashboard, add power flow refresh button#3575

Merged
springfall2008 merged 4 commits intomainfrom
fixes28
Mar 15, 2026
Merged

Force inverter status update after programming, show debug status on dashboard, add power flow refresh button#3575
springfall2008 merged 4 commits intomainfrom
fixes28

Conversation

@springfall2008
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 15, 2026 19:46
@springfall2008 springfall2008 changed the title Force inverter status update after programming, show debug status n dashboard Force inverter status update after programming, show debug status on dashboard Mar 15, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 hardcoded predbat.status in MCP status tool and runtime health checks.
  • Update the web dashboard status section to pull status/detail/debug directly from the status entity (and expose debug as a tooltip).
  • Force an earlier “quick inverter data update” by adjusting inverter_data_last_fetch at the end of update_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("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace('"', "&quot;")
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)
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)
@springfall2008 springfall2008 changed the title Force inverter status update after programming, show debug status on dashboard Force inverter status update after programming, show debug status on dashboard, add power flow refresh button Mar 15, 2026
@springfall2008 springfall2008 merged commit 4645ada into main Mar 15, 2026
1 check passed
@springfall2008 springfall2008 deleted the fixes28 branch March 15, 2026 20:19
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.

2 participants