-
Python2.7
-
Node.js + npm
-
Clone the repository on your pc
-
Run
pip install -r requirements.txt
-
Run
npm install
-
To run the script, use
npm run start
If it doesn't work, check
package.json
under the scripts section to see the run command. -
If the script is complaining about electron not installed, you might have to run
npm install -g electron
There are two parts you would have to debug. The Python script and the Node.js browser window.
To debug this, you just need to run python rfid_reader.py
with the RFID reader attached to your pc. Scan your badge and see what it returns. It should return a JSON object with {ok: true, ...}
or {ok:false, ...}
.
Most likely the problem is here, as the script interfaces between the USB reader and the server.
To debug this, you would can open the Dev Tools Ctrl + Alt + I
. Then it would be like a normal Chrome browser with console.log.
If you don't want to have it open full screen by default you can turn it off somewhere in index.js
or in the app
folder.
If any changes were made to the AP server, it wouldn't affect this part as the python script provides that layer of abstraction already.
Debug this part if you want to change the display colors or show a time clock, or other GUI type stuff.
You need to be careful when following guides on the internet as some code runs in the browser and some on the Node.js side. The confusion arises because both sides uses JavaScript so you would need to understand which part of the script belongs where. With the Django app you wouldn't run into this issue as the server side script is in Python and the browser side is in JavaScript. So just this one little note in case you get stuck or some functions seem to only fail on your PC.
You check this out for more info https://electronjs.org/docs/tutorial/application-debugging#main-process
I can't really remember the exact names of files and commands but hopefully this will give you enough info to get started