Skip to main content

NFC Charge Authorization

Requires the "nfc" feature.

nfc/seen_tags

The NFC tags most recently seen by the charger.

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/nfc/seen_tags
[
{ "tag_type": 2, "tag_id": "04:E3:B2:27:39:AD:FE", "last_seen": 22724083 },
{ "tag_type": 0, "tag_id": "", "last_seen": 0 },
{ "tag_type": 0, "tag_id": "", "last_seen": 0 },
{ "tag_type": 0, "tag_id": "", "last_seen": 0 },
{ "tag_type": 0, "tag_id": "", "last_seen": 0 },
{ "tag_type": 0, "tag_id": "", "last_seen": 0 },
{ "tag_type": 0, "tag_id": "", "last_seen": 0 },
{ "tag_type": 0, "tag_id": "", "last_seen": 0 },
{ "tag_type": 0, "tag_id": "01:23:AB:3D", "last_seen": 10753 }
]
IndexDescription
[0..7]
object

A seen NFC tag

NameDescription
tag_type
int

Type of the tag

  • 0 - Mifare Classic
  • 1 - NFC Forum Type 1
  • 2 - NFC Forum Type 2
  • 3 - NFC Forum Type 3
  • 4 - NFC Forum Type 4
tag_id
string

ID of the tag. Depending on tag type, up to 10 hex bytes separated by ':'. e.g. 01:23:AB:3D

last_seen
int (ms)

Time in milliseconds since the tag was last seen.

[8]
object

The tag spoofed by nfc/inject_tag

NameDescription
tag_type
int

Type of the tag

  • 0 - Mifare Classic
  • 1 - NFC Forum Type 1
  • 2 - NFC Forum Type 2
  • 3 - NFC Forum Type 3
  • 4 - NFC Forum Type 4
tag_id
string

ID of the tag. Depending on tag type, up to 10 hex bytes separated by ':'. e.g. 01:23:AB:3D

last_seen
int (ms)

Time in milliseconds since the tag was last seen.




nfc/inject_tag

Pretends that a tag was detected by the NFC reader. This can be used to start or stop a charging session for a specific user via the API. Analogous to the physical use of a tag, the charging session is alternately authorized or blocked with each API call. See nfc/inject_tag_start and nfc/inject_tag_stop for more precise control. The spoofed tag is always the last entry in nfc/seen_tags

Example
# $HOST e.g. warp-AbCd

Write

curl http://$HOST/nfc/inject_tag -d '{ "tag_type": 0, "tag_id": "01:23:AB:3D" }'
NameDescription
tag_type
int

Type of the tag.

  • 0 - Mifare Classic
  • 1 - NFC Forum Type 1
  • 2 - NFC Forum Type 2
  • 3 - NFC Forum Type 3
  • 4 - NFC Forum Type 4
tag_id
string

ID of the tag. Depending on tag type, up to 10 hex bytes separated by ':'. e.g. 01:23:AB:3D




nfc/inject_tag_start

Pretends that a tag was detected by the NFC reader. The tag is only used to start a charging session. The spoofed tag is always the last entry in nfc/seen_tags

Example
# $HOST e.g. warp-AbCd

Write

curl http://$HOST/nfc/inject_tag_start -d '{ "tag_type": 0, "tag_id": "01:23:AB:3D" }'
NameDescription
tag_type
int

Type of the tag.

  • 0 - Mifare Classic
  • 1 - NFC Forum Type 1
  • 2 - NFC Forum Type 2
  • 3 - NFC Forum Type 3
  • 4 - NFC Forum Type 4
tag_id
string

ID of the tag. Depending on tag type, up to 10 hex bytes separated by ':'. e.g. 01:23:AB:3D




nfc/inject_tag_stop

Pretends that a tag was detected by the NFC reader. The tag is only used to stop a charging session. The spoofed tag is always the last entry in nfc/seen_tags

Example
# $HOST e.g. warp-AbCd

Write

curl http://$HOST/nfc/inject_tag_stop -d '{ "tag_type": 0, "tag_id": "01:23:AB:3D" }'
NameDescription
tag_type
int

Type of the tag.

  • 0 - Mifare Classic
  • 1 - NFC Forum Type 1
  • 2 - NFC Forum Type 2
  • 3 - NFC Forum Type 3
  • 4 - NFC Forum Type 4
tag_id
string

ID of the tag. Depending on tag type, up to 10 hex bytes separated by ':'. e.g. 01:23:AB:3D




nfc/config

The NFC configuration.

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/nfc/config
{
"authorized_tags": [
{ "user_id": 1, "tag_type": 2, "tag_id": "04:E3:B2:27:39:AD:FE" },
{ "user_id": 2, "tag_type": 0, "tag_id": "01:23:AB:3D" }
]
}

Write

curl http://$HOST/nfc/config -d '{
"authorized_tags": [
{ "user_id": 1, "tag_type": 2, "tag_id": "04:E3:B2:27:39:AD:FE" },
{ "user_id": 2, "tag_type": 0, "tag_id": "01:23:AB:3D" }
]
}'
NameDescription
deadtime_post_start
int (s)

Allows stopping a charging session with an NFC tag only after this time to avoid accidental operation.

authorized_tags
object[16]

A list of authorized tags.

  • [0..15] - An authorized NFC tag
NameDescription
user_id
int

ID of the user this tag is assigned to, or 0 if it is not assigned to any user.

tag_type
int

Type of the tag.

  • 0 - Mifare Classic
  • 1 - NFC Forum Type 1
  • 2 - NFC Forum Type 2
  • 3 - NFC Forum Type 3
  • 4 - NFC Forum Type 4
tag_id
string

ID of the tag. Depending on tag type, up to 10 hex bytes separated by ':'. e.g. 01:23:AB:3D