diff --git a/demo-scripts/charging-profile-0.json b/demo-scripts/charging-profile-0.json new file mode 100644 index 00000000..226b9678 --- /dev/null +++ b/demo-scripts/charging-profile-0.json @@ -0,0 +1,52 @@ +{ + "chargingProfileKind": "Absolute", + "chargingProfilePurpose": "TxProfile", + "chargingSchedule": [ + { + "chargingRateUnit": "W", + "chargingSchedulePeriod": [ + { + "limit": 22.5, + "startPeriod": 0, + "numberPhases": 3 + }, + { + "limit": 20.0, + "startPeriod": 3600, + "numberPhases": 3 + } + ], + "id": 1, + "minChargingRate": 5.0, + "salesTariff": { + "id": 1, + "numEPriceLevels": 2, + "salesTariffDescription": "Standard Tariff", + "salesTariffEntry": [ + { + "relativeTimeInterval": { + "start": 0, + "duration": 3600 + }, + "consumptionCost": [ + { + "cost": [ + { + "amount": 15, + "costKind": "RelativePricePercentage" + } + ], + "startValue": 10.0 + } + ] + } + ] + } + } + ], + "id": 1, + "stackLevel": 0, + "transactionId": "12345", + "validFrom": "2024-06-07T10:00:00Z", + "validTo": "2024-06-07T18:00:00Z" + } \ No newline at end of file diff --git a/demo-scripts/charging-profile-1.json b/demo-scripts/charging-profile-1.json new file mode 100644 index 00000000..5bfe0ce5 --- /dev/null +++ b/demo-scripts/charging-profile-1.json @@ -0,0 +1,75 @@ +{ + "chargingProfileKind": "Recurring", + "chargingProfilePurpose": "TxDefaultProfile", + "chargingSchedule": [ + { + "chargingRateUnit": "A", + "chargingSchedulePeriod": [ + { + "limit": 30.0, + "startPeriod": 0, + "numberPhases": 1 + }, + { + "limit": 25.0, + "startPeriod": 1800, + "numberPhases": 1 + }, + { + "limit": 15.0, + "startPeriod": 3600, + "numberPhases": 1 + } + ], + "id": 2, + "minChargingRate": 10.0, + "salesTariff": { + "id": 2, + "numEPriceLevels": 3, + "salesTariffDescription": "Discount Tariff", + "salesTariffEntry": [ + { + "relativeTimeInterval": { + "start": 0, + "duration": 1800 + }, + "consumptionCost": [ + { + "cost": [ + { + "amount": 10, + "costKind": "RelativePricePercentage" + } + ], + "startValue": 5.0 + } + ] + }, + { + "relativeTimeInterval": { + "start": 1800, + "duration": 3600 + }, + "consumptionCost": [ + { + "cost": [ + { + "amount": 12, + "costKind": "RelativePricePercentage" + } + ], + "startValue": 7.0 + } + ] + } + ] + } + } + ], + "id": 2, + "stackLevel": 1, + "transactionId": "67890", + "validFrom": "2024-06-08T08:00:00Z", + "validTo": "2024-06-08T20:00:00Z" +} + \ No newline at end of file diff --git a/demo-scripts/maeve-set-charging-profile.sh b/demo-scripts/maeve-set-charging-profile.sh index c0aaca53..a3dd7138 100644 --- a/demo-scripts/maeve-set-charging-profile.sh +++ b/demo-scripts/maeve-set-charging-profile.sh @@ -1,18 +1,13 @@ #!/bin/bash -if [ "$#" -ne 1 ]; then - echo "Usage: $0 " +if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then + echo "Usage: $0 " exit 1 fi CS=$1 - -echo "setChargingProfile called with Charging Station: ${CS}" - -curl -X POST \ - "http://localhost:9410/api/v0/cs/${CS}/setchargingprofile" \ - -H "Content-Type: application/json" \ - -d '{ +JSON_FILE=$2 +JSON_DATA='{ "chargingProfileKind": "Absolute", "chargingProfilePurpose": "TxProfile", "chargingSchedule": [ @@ -64,3 +59,19 @@ curl -X POST \ "validFrom": "2024-06-07T10:00:00Z", "validTo": "2024-06-07T18:00:00Z" }' + +# Read JSON file and do some error handling +if [ -n "$JSON_FILE" ]; then + if [ ! -f "$JSON_FILE" ]; then + echo "Error: JSON file '$JSON_FILE' not found!" + exit 1 + fi + JSON_DATA=$(cat "$JSON_FILE") +fi + +echo "setChargingProfile called with Charging Station: ${CS}" + +curl -X POST \ + "http://localhost:9410/api/v0/cs/${CS}/setchargingprofile" \ + -H "Content-Type: application/json" \ + -d "$JSON_DATA"