!! zaptec charger
charger id: 5273dba1-4e80-49ae-ac44-9420ae596ad3
cmds:
506 - stop/pause charging (requires firmware > 3.2)
507 - resume charging (requires firmware > 3.2)
10001 - deauthorize and stop charging.
!Get the bearer token
curl -vs -X POST https://api.zaptec.com/oauth/token -H "content-type: application/x-www-form-urlencoded" --data-raw 'grant_type=password&username=harry.metske%40gmail.com&password=<url-encoded password>'
Or better:
{{{
export TOKEN=$(curl -s -X POST https://api.zaptec.com/oauth/token -H "content-type: application/x-www-form-urlencoded" --data-raw 'grant_type=password&username=harry.metske%40gmail.com&password=<url-encoded password>' | jq -r .access_token)
}}}
!Stop/pause the charger
{{{
curl -X POST "https://api.zaptec.com/api/chargers/5273dba1-4e80-49ae-ac44-9420ae596ad3/sendCommand/506" -H "accept: */*" -H "Authorization: Bearer $TOKEN" -d ""
}}}
!Resume charging
{{{
curl -X POST "https://api.zaptec.com/api/chargers/5273dba1-4e80-49ae-ac44-9420ae596ad3/sendCommand/507" -H "accept: */*" -H "Authorization: Bearer $TOKEN" -d ""
}}}
! Get the current state of the charger
{{{
curl -s "https://api.zaptec.com/api/chargers/5273dba1-4e80-49ae-ac44-9420ae596ad3/state" -H "accept: */*" -H "Authorization: Bearer $TOKEN"
}}}
This will return an array of these:
{{{
"ChargerId": "5273dba1-4e80-49ae-ac44-9420ae596ad3",
"StateId": -2,
"Timestamp": "2023-06-09T13:35:24.583",
"ValueAsString": "1"
}}}
This requires [all the zaptec constants|https://api.zaptec.com/api/constants] to interpret the StateId's. \\
To format them in a kind of table, use this jq expression: {{{'.\[] | (.StateId|tostring) + " = " + .ValueAsString'}}}