-
Notifications
You must be signed in to change notification settings - Fork 3
2. Setting up Nfcpyr
- Download and copy the contents of the /python/nfcpyr folder to the raspberry
- Copy nfcpyr.config.json and nfcpyr.users.json from 'data_examples' to 'data'
- Edit the json files (see examples below)
- Start nfcpyr by running 'python2 nfcpyr.py'
- Repeat the steps for every raspberry/reader you want to set up
Edit the contents of nfcpyr.config.json to suit your needs.
{
# Id, user and pass are used to generate an apikey which identifies your 'group' of readers
# These should be identical for every raspberry/reader you set up
"nfcpyr_id":"YOUR_CUSTOM_ID",
"nfcpyr_user":"CUSTOM_USERNAME",
"nfcpyr_pass":"CUSTOM_PASSWORD",
# The url of the nfcpyr api. You can run it on your own server or use mine
"url_nfcpyrapi":"http://www.rejh.nl/nfcpyr/api/?",
# The configuration of this reader
"reader":{
"id":"nfcpi001", # a unique(!) id of this reader
"name":"Livingroom", # a human-readable name for this reader
"on_checkin":{
"checkin":[], # list of ids that also should be checked in
"checkout":[ # list of ids that should be checked out
"nfcpi002"
],
"url_requests":[ # list of urls, also see 'Config: Url requests' chapter below
"http://www.google.com"
],
"plugins":[ # list of plugins that should be called
"examplePlugin"
]
},
"on_checkout":{
"checkin":[],
"checkout":[],
"url_requests":[]
"plugins":[
"examplePlugin"
]
},
"on_scan":{
"checkin":[],
"checkout":[],
"url_requests":[]
"plugins":[
"examplePlugin"
]
}
},
"sounds":{
"enabled":true,
"checkin":"sound/snd.beeps01.ogg",
"checkout":"sound/snd.fail01.ogg"
}
}
Contains a list of user configs. A 'user entry' consists of a (unique!) username, human-readable name and a list of NFC tag id's that are associated with the user.
While every reader may have a nfcpyr.users.json file these do not have to incude all the users. At startup, Nfcpyr will update the users list with the centralized API.
A more sophisticated way to manage users is being worked on but not available at this time.
{"coming":"soon"}
on_checkin
Everything that is executed when a user checks in
on_checkout
Everything that is executed when a user checks out
on_scan
Always executed whether a user checks in or out
General
The 'url_requests' field may contain a list of urls that are requested when the parent event is fired. For example, it can call some Rest API request on a remote server.
Keywords
There are certain keywords you can use in a url request field that will be replaced by Nfcpyr:
Keyword | Description |
---|---|
##USER-USERNAME## | Current user's username |
##USER-FULLNAME## | Current user's full name |
##USER-EMAIL## | Current user's email (if provided) |
##READER-ID## | Current reader's id |
##READER-NAME## | Current reader's name |
##TIMESEC## | Current time in seconds (int) |
##TIMEMS## | Current time in milliseconds (int) |
Nfcpyr supports plugins, which are native python scripts that must implement a certain structure to be compatible. This enables users and other developers to extend on Nfcpyr's functionality without having to make changes in its code.
See https://github.com/rejhgadellaa/nfcpyr/wiki/3.-Plugins
..More coming soon...