Skip to main content

Charge Tracker

The charge_tracker module records charging sessions. Charging sessions are stored in a compact binary format and can be retrieved in this format or processed as a PDF document.

charge_tracker/state

State of the charge tracker

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/charge_tracker/state
{ "tracked_charges": 206, "first_charge_timestamp": 28090609 }

28090609 * 60 = 1685436540 = 2023-05-30T08:49:00+00:00

NameDescription
tracked_charges
int

Total number of recorded charging sessions.

first_charge_timestamp
int (min)

A Unix timestamp in minutes indicating the start time of the first charging session. 0 if no time synchronization was available at start time.




charge_tracker/last_charges

The last (up to) 30 recorded charging sessions

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/charge_tracker/last_charges
[
{
"timestamp_minutes": 28568514,
"charge_duration": 27479,
"user_id": 0,
"energy_charged": 39.83935547
},
{
"timestamp_minutes": 28572916,
"charge_duration": 37806,
"user_id": 0,
"energy_charged": 33.81298828
},
{
"timestamp_minutes": 28574252,
"charge_duration": 27915,
"user_id": 0,
"energy_charged": 34.23388672
}
]
IndexDescription
[0..29]
object

A tracked charging session

NameDescription
timestamp_minutes
int (min)

A Unix timestamp in minutes indicating the start time of the charging session. 0 if no time synchronization was available at start time.

charge_duration
int (s)

Duration of the charging session.

user_id
int

ID of the user who started the charging session. 0 if authorization was granted without user assignment.

energy_charged
float (kWh)

Energy charged. null if no meter was available at start or end time.




charge_tracker/current_charge

Information about the currently running charging session. If no charging session is running, user_id has the value -1

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/charge_tracker/current_charge
{
"user_id": 0,
"meter_start": 886.1900024,
"evse_uptime_start": 786598059,
"timestamp_minutes": 28577341,
"authorization_type": 0,
"authorization_info": null
}
NameDescription
user_id
int

ID of the user who started the charging session. 0 if authorization was granted without user assignment. -1 if no charging session is currently running.

meter_start
float (kWh)

Meter reading at the start of the charging session. null if no meter was available at start time.

evse_uptime_start
int (s)

Uptime of the charge controller at the start of the charging session. To calculate how long the charging session has been running, the current uptime from evse/low_level_state can be used.

timestamp_minutes
int (min)

A Unix timestamp in minutes indicating the start time of the charging session. 0 if no time synchronization was available at start time.

authorization_type
int

Indicates how the charging session was authorized.

  • 0 - User authorization disabled, charging session was authorized when vehicle was connected. authorization_info is null.
  • 1 - Authorization type was lost because the ESP restarted during the charging session. authorization_info is null.
  • 2 - Charging session was authorized by NFC tag. NFC tag was physically held to the WARP Charger. authorization_info contains tag_id and tag_type.
  • 3 - Charging session was authorized by NFC tag. NFC tag was spoofed via nfc/inject_tag. authorization_info contains tag_id and tag_type.
authorization_info
None

Additional information about user authorization. Format depends on authorization_type.




charge_tracker/remove_all_charges

Deletes all recorded charging sessions and the username history. Cannot be undone! A restart is automatically performed afterwards.

Example
# $HOST e.g. warp-AbCd

Write

curl http://$HOST/charge_tracker/remove_all_charges -d '{ "do_i_know_what_i_am_doing": false }'
NameDescription
do_i_know_what_i_am_doing
bool

Indicates whether the deletion should be performed

  • true - Delete all recorded charging sessions and the username history
  • false - Perform no action



charge_tracker/charge_log

Returns all recorded charging sessions in the following binary format. Entries each correspond to one charging session, are 16 bytes long and are output sequentially. The following indices are byte offsets relative to the start of a recorded charging session. All values are in little-endian format.

Example
# $HOST e.g. warp-AbCd
curl http://$HOST/charge_tracker/charge_log
offset      timestamp | kwh_start | id | duration | kwh_end
0x00000000: c2eb b301 | 3bf8 8c45 | 00 | 57 6b00 | f236 8e45
0x00000010: f4fc b301 | 2738 8e45 | 00 | ae 9300 | a846 8f45
0x00000020: 2c02 b401 | df46 8f45 | 00 | 0b 6d00 | be58 9045

Dieses Beispiel enthält die selben Ladevorgänge wie das charge_tracker/last_charges-Beispiel

IndexDescription
[0..3]
int (min)

A Unix timestamp in minutes indicating the start time of the charging session. 0 if no time synchronization was available at start time.

[4..7]
float (kWh)

Meter reading at the start of the charging session. NaN if no meter was available at start time.

[8]
int

ID of the user who started the charging session. 0 if authorization was granted without user assignment.

[9..11]
int (s)

Duration of the charging session.

[12..15]
float (kWh)

Meter reading at the end of the charging session. NaN if no meter was available at end time.




charge_tracker/config

The charge tracker configuration.

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/charge_tracker/config
{ "electricity_price": 3381 }

Write

curl http://$HOST/charge_tracker/config -d '{ "electricity_price": 3381 }'

or abbreviated:

curl http://$HOST/charge_tracker/config -d '3381'
NameDescription
electricity_price
int (ct/kWh/100)

Electricity price used in the web interface and charge log to calculate charging costs