Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EVSE add get set clear targets support (#31407)
* De-alphabetize list of files to avoid breaking GH action * Semi-realphabetize? * Restore strangely dropped events * Better BitMask handling * Change min/max on electrical measurements to be decimal instead of hex * Rename meas-and-sense to measurement-and-sensing.xml * Remove seemingly superfluous attribute requirements on Descriptor cluster on Electrical Measurement * Updates to electrical-power-measurement-server based on comments * Remove defaults from MeasurementAccuracyRangeStruct to match spec update * Restore side="server" to events * Move common enums and bitmaps to detail:: instead of detail::Enums and detail::Bitmaps; remove superfluous using statement * Assign ID to Electrical Sensor device type * Removed EPM and EEM from Root Node Device * Restyled formatting is different than clang-format * Re-add FeatureMap to attributeAccessInterfaceAttributes for EEM and EPM * Regen after merge * Added electrical-energy-measurement-server to CMakelist to fix linker issue. * Lock client on Electrical Sensor device type * Remove unneeded using statement now that Enums are in detail:: * Check for null iterators and error * Switch to ResourceExhausted from CHIP_ERROR_INTERNAL * Re-enabled EEM in energy management app and regen all after previous merge * Some refactoring to add EPM Instance into the EVSEManufacturer class to clean up containment. Added ability to fake voltage, power and current to the TE triggers. * Missed one file. * Fixed crash due to unassigned dg pointer. Power/Voltage/Current faking working too. * Touch file since restyled crashed * Restyled by gn * Restyled by isort * Add stub for EPM cluster * Reverted whitespace change * Did regen_all after merge from master to resolve conflicts. * Put back line of clusters which somehow got deleted accidentally. * Remerged ZAP file and regen all after resolving conflicts. * Fixes for Python tests * Correct name for Ember init callback * Formatting * Sync optional attributes list with .zap file for EPM * Add missing features to EPM stub * Revert FeatureMap in attributeAccessInterfaceAttributes * Allow FeatureMap in EEM constructor; add all-clusters-app EEM stub * Forgot zcl-with-test-extensions * Unregister EEM attribute access in destructor * Remove redundant returns to keep clang-tidy happy * Fix for issue mentioned in code review on EEM cluster limiting the number of endpoints it allows. * Refactoring to have a common EvseMain across all platforms to avoid making changes in multiple places * Added electrical-power-measurement-server to ESP32 CMakeLists.txt * Updated Matter device types to add EVSE * Open and saved energy-management-app.zap and regen_all * Removed duplicate ElectricalEnergyMeasurment class which was accidentally merged in. Fixed issue raised about ElectricalEnergyMeasurement array size not working on bridges. * Added support for test event triggers and handling of reading events into matter_testing_support. * Made TC_EEVSE_Utils.py use the matter_testing_support instead of its own local copy. * Restyled by isort * Cherry pick from Tweaks to EVSE Test plans (Issue #31460) * Changed the random value generation to make the values +/- and handle sign conversion to avoid compile warnings * Enabled cumulativeEnergyExported in Energy-management-app. * Added initial electrical power measurement 2.2 test case * Changed copyright date * Code review comment fixes. * Changed to c++ style cast * Fixed trailing whitepace * Added support for testing read of EEM attributes and change of values * Corrected EPM references in TC_EEM_2_2. Added TC_EEM_2_3 * Added periodic energy reporting, and new cumulativeEnergyReset attribute into energy-management-app.zap * Added periodic energy reading support and TC_EEM_2_3 to 2_5. * Python removed unused logging and EventChangeCallback * Updates to align to test plan PR #3949 * Added initial EEM_2_1 test script. * Added example of setting EEM Accuracy and EEM CumulativeEnergyReset structure - TC_EEM_2_1 now passes * Restyled by whitespace * Restyled * Removed extra spaces in TC_EEM_2_1.py * Removed unused EnergyManagementManager.cpp/.h * Fixed PowerMode = kAc * Initial TC_EPM_2_1.py script * Restyled by isort * Merged TC_EEVSE tests back in * Initialized NumberOfMeasurementTypes * Added EEM 2.1,2.2,2.3,2.4,2.5 and EPM 2.1,2.2 into CI workflow tests.yaml * Interim state - partially refactored how Measurement Structs are encoded similar to how ModeBase clusters are implemented. Needs tidy up. Will break all-clusters for now * Removed SetNumberOfMeasurementTypes since this can be derived from the ArraySize(kMeasurementAccuracies). Added more stringent checking in test script of measurementTypes and ranges. * Completed TC_EPM_2_1.py script * Corrected test plan spec reference. * Test EPM_2_1 now runs and passes. Allows checking that attributes are supported, and skips test if not. Validation of values ignores Nulls (which are allowed). Turned on Ranges attribute. * Revert unintended change to tests.yaml * Python test case code-review updates * Removed old range iterator. * Fixed lint issues and adjusted timings to match the test plan pr. * Fixed all-clusters electrical-power-measurement cluster by using the energy-management-app/common Delegate * Implemented HarmonicCurrents and HarmonicStructs (to return empty list for now) * Updated TC_EEVSE_2_3.py from more up to date branch. * Added basic set/get/clear targets framework based on earlier work. Not working * Removed files that were recently deleted upstream * Corrected PICS in TC_EEVSE_2_3.py and copyright date * Interim checkin with GetTargets not working * Initial GetTargets working with a constant static array to demonstrate the command response can be encoded ok * Removed unused EnergyEvseManager.cpp, Added EnergyEvseTargetStore.cpp * Added EVSETargets to DefaultStorageKeyAllocator.h * Reverted incorrect removal of EnergyEvseManager.cpp * Added override into EnergyEvseDelegate which resulted in strange errors on some platforms. * Added basic infrastructure for storing targets and reading them back. Compiles and runs * Store working * Store and Load seem to work. * Fixed Status change caused by upstream changes * Added helper function to compute day of week bitmap * Fix to evse-stub in all-clusters to add gEvseTargetsDelegate * Fixed build error on some platforms: cast of dayOfWeek to uint8_t * Refactoring of GetTargets command to build the response using dynamic memory * Updated evse-server.cpp/.h * Tidy up of unused CommonIterator in electrical-power-measurement-server.h * Get Targets reading back from file working * Starting to clean up - ran through Valgrind to check for memory leaks. * More clean up * Added Clear Targets support and initial implementation of SetTargets * Fixed crash when erasing entries - test reported PASS! * Attempt to fix Darwin complaint about unsigned int cast * Added logging of get targets response * Fixed platform specific logging compilation issue * Clean up of unused code * More clean up * Removed unused variable - Darwin check * clang checker updates * Refactored code to fix missing added energy since the TargetSoC could be optional and calling Next() would skip AddedEnergy * Added checking of GetTargetsResponse - PASSES * Almost working but need to resolve the Charging current and start time calculation in some scenarios. * Fixed PEP8 lint errors in TC_EVSE_2_3.py and TC_EEVSE_Utils.py taking advantage of new TestStep 3rd arg * Restyled by isort * Fixed ChipLogDetail %d errors on some platforms with a static_cast * Fixes in EVSE FindTargets to remove signed/unsigned comparison. Calculation of charging time was out by factor of 10. * Fixed TC_EEVSE_2_3.py to match test plan. Fixed EVSE FindNextTarget to handle targets if searching for future days. Now passes tests. * Fixed FindNextTarget to use epoch_s for NextChargeTargetTime and NextChargeStartTime with associated TC_EEVSE_2_3.py changes. Fixed bug when TargetSoC = 100% caused start time to be reported incorrectly. * Fix: When EVSE is not plugged in, or not enabled for charge we shouldn't compute a schedule. Also add callbacks to update schedule if the state changes. * Updated TC_EEM, TC_EPM, TC_EEVSE to take advantage of the new TestStep 3rd element. * Address comments from Boris Zbarsky * Fix lint error by adding entry for src/app/clusters/energy-evse-server/energy-evse-server.h * Revert "Fix lint error by adding entry for src/app/clusters/energy-evse-server/energy-evse-server.h" This reverts commit 7a60876. * Rework HandleGetTargets following #33736 * Address comments from Boris Zbarsky * Update TC_EEVSE_2_3 to align with latest test spec * Remove the use of vector * Get all targets building again * Catch up from master + fix some lint and build errors * Restyled by whitespace * Restyled by clang-format * Restyled by autopep8 * Restyled by isort * Fixing regession-build error * Restyled by clang-format * Fixing regession-build error * Changed logic to not return NextChargeRequiredEnergy if not plugged in or not enabled for charging. * Removed max 80A current limit which aligns to the spec. Who knows how many Amps chargers will have in the future! * Bug fix - When disabling the mMaximumChargingCurrentLimitFromCommand was not being updated, so we didn't get attribute updates for MaximumChargeCurrent when toggling Enable-Disable-Enable. * Being into line with latest EVSE test spec although TODOs around the time of use trigger * Load the targets in EnergyEvseInit() * Made EvseTargetsEntryType -> evseTargetsEntryType (since it is a variable not a type) * Reformatting and correcting the cluster PICS to be EEVSE not DEM. * Reverted changes to python test cases which don't belong in this PR - See PR#34243 (makes this PR 10 files smaller). * Address review comments from James Harrow * Address review comments from James Harrow * Add energy unit tests * Fix test case to align with PR10027 * Move the EVSE targets key to be a private member of EnergyEvseTargetsStore * Move EvseTargetStore test harness to examples/energy-management-app/energy-management-common/tests * Move example tests to examples/BUILD.gn * Restyled by clang-format * Restyled by gn * Add a mechanism to enable the targets persistent data to be delete when the last fabric is deleted * Fix unused variable compilation issues * Restyled by whitespace * Restyled by clang-format * Adde TC_EEVSE_2_3.py to CI testing. * Added new test-runner info to top of Python TC_EEVSE_2_3.py * Remove assert from BUILD.gn so test harness can build * Put BEGIN CI TEST ARGUMENTS around runner test arguments * Fix compilation problem in unit test * Try and fix the zephyr build problems * Restyled by gn * Try and fix the zephyr build problems * Try and fix the zephyr build problems * Try and fix the zephyr build problems * Restyled by gn * Start addressing comments from Andrei * Continuing addressing comments from Andrei * Continuing addressing comments from Andrei * Restyled by clang-format * Fix a problem with the return code spotted by Boris * Update examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp Co-authored-by: Andrei Litvin <[email protected]> * Update examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp Co-authored-by: Andrei Litvin <[email protected]> * Update examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp Co-authored-by: Andrei Litvin <[email protected]> * Update with further review comments from Andrei * Update with further review comments from Andrei * Update with further review comments from Andrei * Get all targets building * Restyled by whitespace * Restyled by clang-format * Update with further review comments from Andrei * Address further review comments from Andrei * Restyled by clang-format * Complete rename of Reset to ChargingTargetsMemMgr::PrepareDaySchedule * Fix potential memory leak * Add check in ChargingTargetsMemMgr::PrepareDaySchedule against a bad chargingTargetSchedulesIdx * Restyled by clang-format * Address final comments from Andrei * Restyled by gn * Removed whitespace in openiotsdk/CMakelists.txt * Fix merge issue * Fix CI build issue --------- Co-authored-by: Hasty Granbery <[email protected]> Co-authored-by: Restyled.io <[email protected]> Co-authored-by: pcoleman <[email protected]> Co-authored-by: PeterC1965 <[email protected]> Co-authored-by: Andrei Litvin <[email protected]>
- Loading branch information