-
Notifications
You must be signed in to change notification settings - Fork 115
Active bat control: update power_limit_mode #3169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,7 @@ | |
|
|
||
| class UpdateConfig: | ||
|
|
||
| DATASTORE_VERSION = 119 | ||
| DATASTORE_VERSION = 120 | ||
|
|
||
| valid_topic = [ | ||
| "^openWB/bat/config/bat_control_permitted$", | ||
|
|
@@ -3045,3 +3045,16 @@ def upgrade(topic: str, payload) -> None: | |
| return {component_topic: config_payload} | ||
| self._loop_all_received_topics(upgrade) | ||
| self._append_datastore_version(119) | ||
|
|
||
| def upgrade_datastore_120(self) -> None: | ||
| def upgrade(topic: str, payload) -> Optional[dict]: | ||
| if re.search("^openWB/bat/config/power_limit_mode$", topic) is not None: | ||
| mode = decode_payload(payload) | ||
| if mode == "no_limit" or mode == "limit_stop": | ||
| mode = "mode_no_discharge" | ||
| return {topic: mode} | ||
| elif mode == "limit_home_consumption": | ||
| mode = "mode_discharge_home_consumption" | ||
| return {topic: mode} | ||
|
Comment on lines
+3049
to
+3058
|
||
| self._loop_all_received_topics(upgrade) | ||
| self._append_datastore_version(120) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration introduces new mapping behavior for
openWB/bat/config/power_limit_mode, but there is no test covering the conversion (and especially that already-valid modes are left unchanged). Please add a pytest case similar to existing datastore upgrade tests to prevent regressions.