This page (revision-5) was last changed on 27-Jun-2023 11:24 by Harry Metske

This page was created on 12-Jun-2023 06:59 by Harry Metske

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
5 27-Jun-2023 11:24 4 KB Harry Metske to previous
4 27-Jun-2023 11:27 4 KB Harry Metske to previous | to last
3 27-Jun-2023 11:27 1 KB Harry Metske to previous | to last
2 12-Jun-2023 07:01 835 bytes Harry Metske to previous | to last
1 12-Jun-2023 06:59 788 bytes Harry Metske to last

Page References

Incoming links Outgoing links
Zaptec...nobody

Version management

Difference between version and

At line 14 added 5 lines
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)
}}}
At line 21 added one line
{{{
At line 23 added one line
}}}
At line 26 added one line
{{{
At line 28 added 16 lines
}}}
! 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'}}}