MicroOcpp icon indicating copy to clipboard operation
MicroOcpp copied to clipboard

[WIP] Fix smart charger OCTT test cases

Open razvanphp opened this issue 2 months ago • 1 comments

This PR makes all those tests pass:

  • TC_056 Central Smart Charging - TxDefaultProfile
  • TC_066_CS - Get Composite Schedule
  • TC_067_CS - Clear Charging Profile
  • TC_072_CS - Stacking Charging Profiles
Screenshot 2025-10-20 at 09 55 28

BUT, it will only work for v1.1.0 and v1.2.0, it is not compatible with the upcoming develop/remodel-api branch. I think there @matth-x already fixed those bugs.

We should also have the max A of the charging station and number of phases as configuration variables probably, as OCTT expects a positive value there instead of -1 when there is no Profile installed.

I could/should also add unit tests for this...

closes #360

razvanphp avatar Oct 20 '25 17:10 razvanphp

I will add unit tests for the other 3 TC so we can easily port the fixes to the v2.x branch.

Also, according to GetCompositeScheduleResponse schema for chargingSchedulePeriod, looks like this:

            "chargingSchedulePeriod": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "startPeriod": {
                            "type": "integer"
                        },
                        "limit": {
                            "type": "number",
                            "multipleOf" : 0.1
                        },
                        "numberPhases": {
                            "type": "integer"
                        }
                    },
                    "additionalProperties": false,
                    "required": [
                        "startPeriod",
                        "limit"
                        ]
                }
            },

... so we cannot (or should not) return -1 for limit and numberPhases.

BUT, to keep the library CP agnostic, after discussion with @matth-x we agreed to make those configurable as defines MO_, still -1, but with the possibility for implementers to set this to the right value without overriding the framework.

razvanphp avatar Nov 03 '25 11:11 razvanphp