]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
feat(ocpp20): add SetVariables handling with runtime + persistent var… (#1576)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 29 Oct 2025 21:34:04 +0000 (22:34 +0100)
committerGitHub <noreply@github.com>
Wed, 29 Oct 2025 21:34:04 +0000 (22:34 +0100)
commitc3d964087d7d0b5db5fed6a7c40c1f0b2a5f8b36
treee6ef9633fbc71b7e4840cb37c11ed1e02ef4139a
parenta047288fa24e8432a1ba24c6efe2e0e5c8772a5a
feat(ocpp20): add SetVariables handling with runtime + persistent var… (#1576)

* feat(ocpp20): add SetVariables handling with runtime + persistent variable support and tests

* refactor(ocpp20): unify validation messages and remove success reason codes

* feat(ocpp20): extend variable manager with EVSE support, runtime overrides + validation refactor

* chore(openspec): add EVSE AuthorizeRemoteStart support proposal and spec delta

* chore(openspec): mark EVSE AuthorizeRemoteStart tasks completed (except validation/archive)

* chore(openspec): archive add-evse-authorizeremotestart-support change

* chore(openspec): archive refactor-ocpp20-variable-proxy change

* refactor: drop resetRuntimeVariables\n\nBREAKING CHANGE: use resetRuntimeOverrides() instead

* refactor(config): enum comparisons with explicit string casting

* refactor(charging-station): conditionally reset OCPP 2.x runtime overrides

* refactor(tests): use date-fns helper for heartbeat interval conversion

* refactor(tests,config): replace manual heartbeat conversions and minor cleanups

* refactor: cleanup OCPP stack stop API

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* test(ocpp20): consolidate setVariables tests into main VariableManager suite

* refactor: variable namespace alignment

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* refactor(validation): simplify configuration value integer checks with Number.isInteger

* test(ocpp20): add edge case validation tests and rename trimmed variable

* refactor: cleanup configuration value validation

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* feat(validation): tighten positive integer checks for OCPP 2.0 variables

* test(ocpp20): simplify BootNotification interval

* feat(ocpp20): add variable metadata constraints

* refactor: cleanups variable value validation

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* refactor: ocpp2 spec alignment

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* fix: handle variables in a case incensitive way

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* feat(ocpp20): add Items/Bytes limits, ReportingValueSize, AuthCtrlr; adopt void tests

* refactor(ocpp20): wrap int parsing in VariableManager with tolerant toIntOrNaN

* refactor(ocpp20): use tolerant int parsing in IncomingRequestService for Items/Bytes limits

* refactor(ocpp20): centralize toIntOrNaN via shared util

* test(utils): add convertToIntOrNaN coverage and remove redundant aliases in OCPP20 services

* refactor: use getter to access configuration key

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* feat(ocpp20): integrate registry-driven characteristics & combined reboot logic in SetVariables

* refactor(ocpp20): restore variable manager logic; migrate to enums

* feat(ocpp20): add variable characteristics registry for enum-backed SetVariables

* refactor(ocpp20): migrate variable manager to unified registry and drop legacy metadata

* chore(lint): add JSDoc for variable registry helpers and whitelist deauthorize

* refactor(ocpp20): remove legacy alias/case-insensitive paths and relocate component variables

* refactor(ocpp20): harmonize variable metadata param naming (variableMetaData)

* refactor(ocpp20): standardize metadata identifier casing (variableMetadata)

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* test(ocpp20): adjust SetVariables propagation tests and HeartbeatInterval component

* feat(ocpp20): enhance variable registry, size limits, MinSet/MaxSet

- Add MinSet/MaxSet overrides and retrieval
- Refine ConfigurationValueSize/ValueSize effective limit logic
- Skip auto-create for unset size limit vars and instance-scoped persistent vars
- Enrich FullInventory report with registry variable data
- Improve integer validation and reason codes (decimal, zero, bounds)
- Persist measurementTimeSeries (CircularBuffer to array) safely
- Adjust persistence (OrganizationName non-overwrite, instance-scoped skip)
- Refactor has() and validateUUID for broader type safety
- Use valid WebSocket URLs for ConnectionUrl size tests
- Add public accessors for base report status and data

* feat(ocpp20): set 2500 max value length; use TooLargeElement reason

* feat(ocpp20): add absolute max constant; align truncation logic and persistence tests

* refactor(ocpp20): use OCPP_VALUE_ABSOLUTE_MAX_LENGTH constant for size limit metadata

* chore(tests,ui): normalize comments, centralize UI timeout and size limit references

* refactor: cleanup variable namespace

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* feat(ocpp20): flatten MessageAttemptInterval instance for persistent config key

* chore(ocpp20): add TODO for generic instance flattening handling

* refactor: revert incorrects changes

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* refactor: align variable namespace

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* refactor: remove unneeded public wrappers for UTs only purpose

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* refactor: cleanup code comments

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* feat(ocpp20,get-variables): accept empty Target (B06.FR.13) and add edge case tests\ndocs(ocpp20): add GetVariables gap analysis, mark B06.FR.13 conformant

* fix: silence linter issues

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* test: remove incorrect tests

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* docs(ocpp20): update GetVariables gap analysis and simplify lint-staged cache usage

* chore: revert lint-staged caching removal

* feat(ocpp20): add write-only variable, MinSet/MaxSet support and instance auto-create skip

* fix(ocpp20): remove MinSet/MaxSet from ConnectionUrl supportedAttributes for spec compliance

* docs(ocpp20): clarify removal of MinSet/MaxSet from ConnectionUrl variable

* fix(ocpp20): remove HeartbeatInterval MinSet/MaxSet

* fix(ocpp20): restrict GetBaseReport and variable registry to Actual attribute only

* docs(changelog): add unreleased section for ocpp20 attribute restriction fix

* chore(ocpp20): remove obsolete comments after attribute restriction refactor

* test(ocpp20): adjust MessageAttemptInterval & GetBaseReport to Actual-only validation

* chore(ocpp20): streamline variable registry comments and group sections

* feat(ocpp20): add missing ChargingStation vars AvailabilityState Available SupplyPhases

* fix: refine variable registry

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* refactor: use existing enum

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* test: add configuration utils tests

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* docs: removed outdated markdown

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* refactor: factor out common logic

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* refactor: use builtin helpers

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* refactor: remove unneeded comment

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
---------

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
44 files changed:
.serena/project.yml
AGENTS.md
README.md
eslint.config.js
opencode.jsonc [new file with mode: 0644]
src/charging-station/Bootstrap.ts
src/charging-station/ChargingStation.ts
src/charging-station/ConfigurationKeyUtils.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts
src/charging-station/ocpp/2.0/OCPP20VariableManager.ts
src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts [new file with mode: 0644]
src/charging-station/ocpp/OCPPIncomingRequestService.ts
src/types/ChargingStationOcppConfiguration.ts
src/types/ChargingStationWorker.ts
src/types/index.ts
src/types/ocpp/2.0/Requests.ts
src/types/ocpp/2.0/Variables.ts
src/utils/Configuration.ts
src/utils/Constants.ts
src/utils/MessageChannelUtils.ts
src/utils/Utils.ts
src/utils/index.ts
src/worker/WorkerFactory.ts
tests/ChargingStationFactory.ts
tests/charging-station/ConfigurationKeyUtils.test.ts [new file with mode: 0644]
tests/charging-station/Helpers.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-ClearCache.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetBaseReport.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetVariables.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-Reset.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-SetVariables.test.ts [new file with mode: 0644]
tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-HeartBeat.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-NotifyReport.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-StatusNotification.test.ts
tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts [new file with mode: 0644]
tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts
tests/utils/ErrorUtils.test.ts
tests/utils/Utils.test.ts
ui/web/src/composables/Constants.ts [new file with mode: 0644]
ui/web/src/composables/UIClient.ts
ui/web/start.js