Support saving state-of-charge schedules to sensors with % unit#1996
Support saving state-of-charge schedules to sensors with % unit#1996
Conversation
Documentation build overview
Show files changed (7 files in total): 📝 7 modified | ➕ 0 added | ➖ 0 deleted
|
- Add _build_soc_schedule() helper in StorageScheduler to handle % unit conversion using soc-max as capacity; skip with warning if soc-max is missing or zero - Add additional_sensor_units parameter to VariableQuantityField to allow sensors with extra units (e.g. %) beyond to_unit-compatible ones - Allow % sensors for state_of_charge field in StorageFlexModelSchema and DBStorageFlexModelSchema - Fix _validate_energy_fields in DBStorageFlexModelSchema to accept % sensors for state_of_charge - Update STATE_OF_CHARGE metadata description to document % unit support - Add test_save_state_of_charge_percent_sensor covering both save and skip - Add changelog entry Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
- Make _build_soc_schedule a @staticmethod (no instance state used) - Add defensive isinstance(soc_max, Sensor) guard against future VariableQuantityField usage for soc-max - Improve additional_sensor_units docstring to clarify intended use Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
% unit
Flix6x
left a comment
There was a problem hiding this comment.
Besides the review comments, I also noticed:
- the openapi-specs.json where not updated, which surprises me given the update to a flex-model field description
- the agent environment setup failed on some error (copilot-setup-steps.yml)
- no agent instructions were updated with lessons learned
- the sessions shows the coordinator ran, but it does not look like its recommendations were fully followed up on
- Fix PR number in changelog (2002 → 1996) - Regenerate openapi-specs.json to include updated STATE_OF_CHARGE field description - Redesign test_save_state_of_charge_percent_sensor to verify specific SOC percentage values: starting full with 50% storage efficiency gives idle-decay pattern 100→50→25→12.5%, plus soc-minima at t+60min=8% forces charging and confirms the conversion math - Split into two focused test functions: positive case with value assertions and a separate skip-when-zero-soc-max case - Drop redundant resolution=timedelta(0) from search_beliefs() call (sensor has event_resolution=0, so no resampling occurs either way) Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Signed-off-by: F.N. Claessen <claessen@seita.nl>
|
Context: - PR #1996 ran generate-openapi-specs hook in agent dev environment - Hook introduced two unintended regressions alongside the intentional change: 1. Version field changed from '0.31.0' to '0.1.dev4' (setuptools_scm generated a dev version because the agent checkout lacked full tag history) 2. 'Asia/Brunei' was dropped from the timezone enum (pytz version mismatch) - Repo owner had to manually commit a fix (830d0e4) to revert these regressions Change: - Added 'generate-openapi-specs Hook: Known Regressions' section to the Pre-commit Hooks checklist with the two known regression types, a concrete diff-inspection workflow, and a cross-reference in the Domain Knowledge entry
…able Context: - PR #1996 showed the Environment Setup section only pointed to .github/workflows/copilot-setup-steps.yml without providing concrete commands an agent can run — agents had to open and interpret the workflow YAML themselves, which led to incomplete or incorrect setup Change: - Added 'Concrete setup steps for the agent environment' block with the four commands that translate the workflow: apt-get dependencies, make install-for-test, environment variable exports, and pre-commit install - Added a note clarifying that PostgreSQL/Redis are started automatically by the GitHub Actions runner; local developers must start them manually
…terns Context: - PR #1996 coordinator review (not captured in agent instructions) recommended: 1. Making _build_soc_schedule a @staticmethod (commit e03e91a) 2. Adding isinstance(soc_max, Sensor) guard against future VariableQuantityField usage (commit e03e91a) 3. These patterns apply broadly to Scheduler and DataGenerator subclasses - Agent files were not updated after the refactor, so the lessons were lost Change: - Added '@staticmethod for Methods Without Instance State' pattern under the flex-model checklist: when a method doesn't use self/cls, propose @staticmethod - Added 'Defensive isinstance() Guards for flex-model Fields' pattern: flex-model fields using VariableQuantityField can be Sensor or plain value; always guard with isinstance(field_value, Sensor) before numeric comparisons - Extended flex-context checklist with a VariableQuantityField guard item
Done in commits
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…ontext Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
% unitSigned-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…ules' into copilot/support-saving-soc-schedules
Signed-off-by: F.N. Claessen <claessen@seita.nl>
convert_unitsneeds a capacity argument for the MWh→% conversion, and that capacity was never extracted from the flex model.scheduling.rsttest_save_state_of_charge_percent_sensortest_save_state_of_charge_percent_sensor_skipped_when_zero_soc_maxPlease note that copilot kept updating the PR description with every iteration, see https://github.com/orgs/community/discussions/187027.