Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added in support for MaEVe scp to take in json file #59

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions demo-scripts/charging-profile-0.json
Original file line number Diff line number Diff line change
@@ -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"
}
75 changes: 75 additions & 0 deletions demo-scripts/charging-profile-1.json
Original file line number Diff line number Diff line change
@@ -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"
}

29 changes: 20 additions & 9 deletions demo-scripts/maeve-set-charging-profile.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
#!/bin/bash

if [ "$#" -ne 1 ]; then
echo "Usage: $0 <chargingStation>"
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
echo "Usage: $0 <chargingStation> <jsonFile>"
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": [
Expand Down Expand Up @@ -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"