Fix/gecloud reset readonly#3997
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a “last started” timestamp surfaced via the web dashboard, and adjusts the GE Cloud Direct integration so the one-shot “enable default options” reset is skipped while Predbat is in read-only mode (with accompanying tests).
Changes:
- Publish a new
predbat.last_startedtimestamp sensor on startup and display it on the status dashboard. - Track whether GE Cloud “default options” have been applied, and gate the one-shot reset behind the read-only switch.
- Add unit tests covering the read-only skip behavior and subsequent first non-read-only run behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| apps/predbat/web.py | Displays the new last_started sensor in the Status table. |
| apps/predbat/tests/test_ge_cloud.py | Adds run() mocks and tests ensuring defaults reset is skipped in read-only and runs after read-only is disabled. |
| apps/predbat/predbat.py | Captures startup time and publishes it via a new output sensor; bumps version. |
| apps/predbat/output.py | Adds publish_last_started() to publish the startup timestamp sensor. |
| apps/predbat/gecloud.py | Adds default_options_done and skips default-reset when read-only is enabled. |
Comment on lines
+1066
to
1069
| if not self.default_options_done and self.get_state_wrapper(f"switch.{self.prefix}_set_read_only", default="off") != "on": | ||
| self.default_options_done = True | ||
| for device in self.device_list: | ||
| await self.enable_default_options(device, self.settings[device]) |
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.