This project is now obsolete. Please see shackles
The whole project code is stored under https://github.com/makefu/attendance
This is the documentation for the attendance infrastructure formerly deployed in the shackspace. The project consists of different parts which will be described in detail on this page.
It creates the possibility for the shack members to „log into“ the shackspace and provide a way for other members to see who is currently in the shackspace. The Project is an 'opt-in', nobody has to use the infrastructure.
The project can be separated in the following parts:
The NFC Gateway creates the possibility for shack members to physically log into shackspace. It provides an usb nfc reader and a 2x20 character dotmatrix display. It is also part of and implemented in the Minikrebs Project as NFC Gateway
The NFC Gateway consists of the following parts:
I am using the MR3020 as a platform because it provides Wifi AND a directly usable TTL Port where the pins are already attached on the PCB.
This is an nfc reader which „just works“ with libnfc-bin. The reader reads quite a lot of 13mhz cards.
The LCD is connected directly to the MR3020 Ports. The VFD RX is connected to MR3020 TX. 5V is connected to the MR3020 USB Power and GND is connected to the MR3020 Switch GND:
The NFC Gateway is running on OpenWRT with the NFC Gateway Profile of Minikrebs. The profile provides the following capabilities:
We write raw display strings to the Serial Port and we use it for all the fancy stuff
The software is using a very simple (→ easy to maintain) polling mechanism which uses nfc-list to look if someone has put an nfc card in front of the nfc reader. The script is running as daemon via /etc/rc.local .
The basic idea:
When the nfc gateway is not used for logging in it shows funny fortune cookies in an interval. The script is running as a daemon started by /etc/rc.local.
See github nfc_login code for the daemon code.
git clone git@github.com:krebscode/minikrebs.git cd minikrebs ./prepare nfc_gateway ./upgrade <ip-addr-of-mr3020>
For a detailed description, see github minikrebs
The user suppository server is the backend of the NFC Gateway. For Storage it uses the Shack provided redis storage G.L.A.D.O.S. The user suppository is essentially a python http server which talks to the redis db to store online and offline status of the users.
The implemenation is an HTTP Server which provides a number of API calls:
// all returns are json ident=[0-9A-Z]+ //the unique user id - currently from RFID chips /user/online - returns all online users /user/list - returns all users /user/<ident>/online - returns if user with 'ident' is online /user/<ident>/name - returns name of user with ident /user/<ident>/login - logs user with 'ident' in /user/<ident>/logout -logs out user /user/<ident> - returns cool info about user with 'ident' /user/create/<ident>/<name> - creates a new user with 'ident' with 'name'
See the current API in github.
The user suppository server stores the state of the shack users.
## Scheme - always correct scheme in 'users.config' { "users": { "<uid>": { "history": " the login-logout history", "name": "the nick name", "online": "user online -expires after 1 day" }, "all": "contains all available user hashes", "config" : "this text" } }
git clone https://github.com/shackspace/user_suppository # Install python3, python-flask, python-redis cd server # edit init.py for hostnames,etc python3 ./init.py
To autostart use autostart/user_suppository.conf for supervisor. add the user usersupp to your environment
The IRC bot is currently the only way to know if a user is logged in or not. The irc bot is connected to irc.freenode.com to channel #shackspace. Also the irc bot will write to the IRC channel if a user has logged into the shack by sending a channel query.
The IRC bot implementation used is pyfibot, two modules are written to implement the
# write in #shackspace channel .online
After opening a socket on port 1234 it takes arbitrary messages and sends them to the IRC. The module opens a tcp listen socket via twisted and listens for messages. each message will be written to the irc.
The irc bot is using python-requests to query the user_suppository server online users (see user_suppository API).
see pyfibot installation.
the clone url is: https://github.com/krebscode/pyfibot
no additional software is required.
To autostart use autostart/onbot.conf for supervisor. add the user usersupp to your environment