Wiki - eIntranet.net

Deutsch flag Čeština flag English flag Español flag Slovenčina flag Magyar flag Polski flag

Work Attendance - Chip/Fingerprint Reader Module

1. Module Overview

1.1 Module Purpose

The Work Attendance - Chip/Fingerprint Reader module (WorkAttendanceChips) is designed for automated recording of employee work attendance using physical chip cards (RFID/NFC), biometric fingerprint readers, or artificial intelligence-based facial recognition.

The module eliminates the need for manual entry of arrival and departure times, increases accuracy of records, and provides control mechanisms against abuse (e.g., photos during check-in, minimum break duration, automatic workday closure).

1.2 Key Features

  • Chip Card Configuration - Registration of RFID/NFC chip security codes for each employee
  • Fingerprint Reader - Biometric identification using fingerprints (optional)
  • Facial Recognition - AI face detection using face-api.js (requires RasPi terminal with camera)
  • RasPi Attendance Terminal - Physical terminal for on-site attendance recording
  • IP Restriction - Whitelist of allowed IP addresses for readers (security)
  • Configurable Buttons - Types of attendance available on the terminal (doctor, business trip, etc.)
  • Automatic Closure - Automatic workday termination (3 modes)
  • Photo on Entry - Security photos from terminal to detect card misuse
  • Manual Edit Prevention - Strict chip-only mode with exception possibilities (vacation, sick leave)
  • Minimum Break - Enforcement of minimum break duration
  • Dashboard Buttons - Virtual arrival/departure directly in the system without physical card

1.3 Target Audience

This documentation is intended for:

  • System Administrators - Module configuration, reader management, security settings
  • HR Personnel - User rights management, chip code configuration, photo verification
  • IT Administrators - RasPi terminal installation, network configuration, firmware updates
  • Managers - Attendance verification, exception approval
Important: To access module settings, users must have either administrator rights (admin=1) or be listed in the AdminToModules_ser_arr field with the value dochazka_cipy.

2. Setup and Configuration

2.1 Module Settings

Settings Path: Settings → Work Attendance - Chip/Fingerprint Reader

The module uses the following configuration parameters stored in the Company and User database tables:

Company Table Parameters

Parameter Type Description Default Value
wa_RasPi_Face boolean Enable facial recognition (requires RasPi with camera) 0 (disabled)
wa_RasPi_TakePhoto boolean Take photos during terminal check-in 0 (disabled)
wa_chip_allowed_ips_ser_arr array Allowed reader IP addresses (serialized array) ['all']
wa_chip_show_active boolean Display status (presence) of others on reader 0 (disabled)
wa_chip_use_WDT_14 boolean Allow recording Lunch separately from Breaks 0 (disabled)
wa_chip_buttons_on_dashboard boolean Display Arrival/Departure buttons on main dashboard 0 (disabled)
wa_chip_WritePause boolean Record break after return on the same day 0 (disabled)
wa_chip_AutoCloseInLastDay boolean Warning and closure of previous day's attendance 0 (disabled)
wa_chip_ChiporFaceDetect string Primary detection mode ('c' = chip, 'f' = face) 'c' (chip)

User Table Parameters

Parameter Type Description Default Value
wa_chip_code string Employee chip security hash code NULL
wa_chip_last_inout enum Current employee status ('in', 'out') 'out'
wa_chip_minimal_pause_min int Minimum break duration in minutes NULL
wa_chip_last_poznamka string Last note during check-in NULL
wa_chip_AllowManualType_ser_arr array Allowed attendance types for manual entry (serialized array) []
rights_workattendance enum Attendance rights ('1' = chip only, '2' = manual entry allowed) '2'
FingerPrints_ser_arr array Stored fingerprints (serialized array) []

2.2 User Rights

To access module settings, one of the following conditions must be met:

  • Administrator Rights: $Logged_User->admin == 1
  • Module Administrator: in_array('dochazka_cipy', $Logged_User->AdminToModules_ser_arr)
Security Warning: Without these rights, access to the module is denied by calling the DieUnauthorized() function.

3. User Interface

3.1 Tab Overview

The module user interface is divided into 5 main tabs:

  1. User Rights - Configuration of chip codes, fingerprints, manual edit prevention
  2. Allowed IP Addresses - IP address whitelist for readers
  3. Additional Allowed Buttons - Terminal button configuration
  4. Other Settings - General module settings
  5. Registered Readers - Overview of RasPi terminals
Note: The currently displayed tab is stored in the session variable $_SESSION['nastaveni_dochazka_cipy']['Show'].

3.2 Tab: User Rights

Main tab for configuring employee access to the attendance system.

User Detection

The system supports 3 methods of employee identification:

Method Description Requirements Status
By Chip (RFID/NFC) Standard chip card RFID/NFC reader Always enabled
By Face AI facial recognition using face-api.js RasPi terminal with camera, wa_RasPi_Face=1 Optional
By Fingerprint Biometric fingerprint reader RasPi with fingerprint reader, FingerPrintReader=1 Optional

Employee Table

The table contains the following columns:

Column Description Actions
ID Employee ID in the system -
Last Name, First Name Full name with link to user details Click to open employee details
Chip Code Chip security hash code
  • Enter in text field
  • Changes auto-save (onChange)
  • Clipboard icon copies API URL
Fingerprint Indicator of whether employee has stored fingerprints Displays 0/1 based on sizeofSafe($User->FingerPrints_ser_arr)
Prevent Edits Checkbox to prevent manual attendance edits
  • When checked, sets rights_workattendance='1'
  • Displays button to allow exceptions
Minimum Break Duration Number of minutes for minimum break Enter number (e.g., 30), changes auto-save
Actions Special actions for employee
  • If status is "in", displays Reset (for arrival) button
  • Resets status to "out"

Button: Manually can record only attendance type...

This button appears only for employees who have Prevent work time edits checked.

Function: Opens modal window to select attendance types that the employee can record manually despite the manual edit restriction.

Typical Use:

  • Vacation (employee can enter vacation manually)
  • Sick Leave (employee can enter sick leave manually)
  • Home Office (employee can enter home office manually)
Tip: This mechanism enables strict attendance control (chip only), while providing flexibility for special absence types.

3.3 Tab: Allowed IP Addresses

This tab is used to configure the security whitelist of IP addresses from which readers can connect to the system.

Main Checkbox

Allow reader access only from IP addresses listed below

  • Checked: System validates request IP address against whitelist
  • Unchecked: Access allowed from all IP addresses (wa_chip_allowed_ips_ser_arr = ['all'])

Dynamic IP Address Fields

After checking the main checkbox, IP address entry fields appear:

  • Each IP address has its own text field
  • After filling in, another empty field automatically appears
  • Changes are saved automatically (AJAX)
  • Always at least 2 empty fields visible to add more IPs

Example Configuration:

192.168.1.100
192.168.1.101
10.0.0.50
Important: If you enable IP whitelist and don't enter any IP addresses, readers won't be able to connect! Make sure you have the correct IP addresses entered before activation.

3.4 Tab: Additional Allowed Buttons

Configuration of additional buttons on the attendance terminal for special attendance types (doctor, business trip, etc.).

Button: Add Button

Opens modal window to add a new button:

  1. Select Attendance Type from dropdown list (only loads types with chip_buttons_available=1)
  2. Click Save
  3. Button appears on terminal and in table

Buttons Table

Displays all configured buttons with the following columns:

Column Description Options
Button Attendance type name E.g., "Doctor", "Business Trip"
Automatic termination to daily working hours System calculates end based on daily workload
  • Radio button
  • Saves autoclose_user_hour_day=1
  • Example: 8h workload, arrival 7:00 → auto end 15:00
Automatic termination at specified time Fixed termination time
  • Radio button + time field (HH:MM)
  • Saves autoclose_user_hour_day=0
  • Saves autoclose_at_time (e.g., "15:30:00")
  • Example: Always terminate at 16:00
Fixed duration in minutes Specific number of minutes
  • Radio button + numeric field
  • Saves autoclose_user_hour_day=2
  • Saves autoclose_at_length (minutes)
  • Example: Doctor = 60 min
Actions Delete button
  • Remove Button button
  • Sets delete=1
  • Button disappears from terminal

Automatic Termination Modes - Detailed

1. To Daily Working Hours

How it works:

  1. System loads employee's daily workload (e.g., 8 hours)
  2. On arrival check-in, records time (e.g., 7:00)
  3. Automatically calculates end: 7:00 + 8h = 15:00
  4. If employee doesn't check out by midnight, system automatically terminates at 15:00

Example Use: Business trip - employee leaves for trip, system terminates time automatically based on their workload.

2. At Specified Time

How it works:

  1. Administrator sets fixed termination time (e.g., 15:30)
  2. On arrival check-in, records time (e.g., 7:00)
  3. If employee doesn't check out by midnight, system automatically terminates at 15:30

Example Use: Conference - all participants have fixed end at 16:00.

3. Fixed Duration

How it works:

  1. Administrator sets number of minutes (e.g., 60)
  2. On arrival check-in, records time (e.g., 9:00)
  3. System automatically terminates after 60 minutes: 9:00 + 60 min = 10:00

Example Use: Doctor - employee goes to doctor, system terminates after 60 minutes.

Note: If departure is not checked by midnight, system applies automatic termination according to selected mode. Condition is implemented in the attendance closure function.

3.5 Tab: Other Settings

General module settings affecting the entire system behavior.

Setting Description Default Value
Display status (presence) of others on reader On the terminal, a list of all employees with their current status (present/absent) will be displayed.

Database Column: wa_chip_show_active
Disabled (0)
Allow recording Lunch separately from Breaks Employee can distinguish between general break and lunch (special break type) on terminal.

Database Column: wa_chip_use_WDT_14
Attendance Type: WDT_14 (Lunch)
Disabled (0)
Display Arrival/Departure buttons on main dashboard after login Each employee will see buttons on dashboard after login for check-in arrival/departure without physical card.

Database Column: wa_chip_buttons_on_dashboard
Use: Suitable for employees working from home or without terminal access
Disabled (0)
Record break after return on same day If employee checks out departure and then checks in arrival again on same day, system automatically records the time between as break.

Database Column: wa_chip_WritePause
Example: Departure 12:00, Arrival 12:30 → Break 30 min
Disabled (0)
Photo during attendance entry from terminal With each check-in from RasPi terminal, employee photo is taken. Serves to detect card misuse (verification that card is used by actual owner).

Database Column: wa_RasPi_TakePhoto
Requirements: RasPi terminal with camera
Disabled (0)
Warning and closure of previous day's attendance If employee forgets to check out yesterday and today records new arrival, system displays warning and requires completion of yesterday's departure with supervisor.

Database Column: wa_chip_AutoCloseInLastDay
Purpose: Prevention of "hanging" records in attendance
Disabled (0)
Recommended settings for increased security:
  • Enable Photo on Entry - detects card misuse
  • Enable Warning and Closure from Previous Day - prevents errors in attendance
  • Set Minimum Break Duration (e.g., 30 min) - enforces lunch break

3.6 Tab: Registered Readers

Overview of all RasPi terminals registered in the system.

Readers Table

Column Description
ID Unique reader identifier in database (idRasPi)
Purchase Date Reader installation/registration date (BuyDate)
Installed FW Version Firmware version installed on RasPi (Version)
Last Check Date and time of last communication with reader (LastCheck)
Information: Readers automatically register on first contact with server. Reader data is loaded from the RasPi database table by Company_idCompany.

Reader Diagnostics

Based on the Last Check column, you can diagnose problems:

  • Green: Reader reported within last hour - everything OK
  • Yellow: Reader hasn't reported for more than an hour - possible network issue
  • Red: Reader hasn't reported for more than a day - serious problem (powered off, network, hardware)
Troubleshooting:
  • Check RasPi network connection
  • Verify that RasPi IP address is in whitelist ("Allowed IP Addresses" tab)
  • Check if RasPi is powered on and running
  • Try restarting RasPi

4. Basic Operations

4.1 Setting Employee Chip Code

Goal: Assign employee a chip security code so they can record attendance.

  1. Open Settings → Work Attendance - Chip/Fingerprint Reader
  2. Go to User Rights tab
  3. In the employee table, find the desired employee (you can use search)
  4. In the Chip Code column, enter security hash code (recommended minimum 16 characters, random)
  5. System automatically saves change when leaving field (onChange event)
  6. Optional: Click clipboard icon (fa-clipboard) to copy API URL for testing
Example API URL:
https://your-domain.com/?w=wa_chip_inout&idUser=123&hash=abc123xyz789def456

4.2 Preventing Manual Attendance Edits

Goal: Set strict mode for employee where they can only record attendance via chip.

  1. In the User Rights tab, find the employee
  2. In the employee row, check the checkbox Prevent work time edits in attendance
  3. System sets rights_workattendance='1'
  4. Green button Manually can record only attendance type... appears
  5. Click the button
  6. In the modal window, check allowed types (e.g., Vacation, Sick Leave, Home Office)
  7. Click Save

Result: Employee can no longer manually edit attendance, but can manually enter selected absence types.

Technical Details: Allowed types are saved in the serialized array wa_chip_AllowManualType_ser_arr. When attempting manual entry, system checks if the type is allowed.

4.3 Setting Minimum Break

Goal: Enforce minimum break duration (e.g., lunch minimum 30 minutes).

  1. In the User Rights tab, find the employee
  2. In the Minimum Break Duration (minutes) column, enter number of minutes (e.g., 30)
  3. System automatically saves change

How it works:

  • Employee checks in break (e.g., 12:00 - 12:10 = 10 minutes)
  • System checks wa_chip_minimal_pause_min (e.g., 30)
  • If break is shorter, automatically extends to minimum (10 min → 30 min)
  • In attendance record, a 30-minute break appears
Warning: Automatic break extension may surprise employees. We recommend informing employees about the minimum break setting.

4.4 Resetting Arrival/Departure Status

Goal: Reset "hanging" status of employee who forgot to check out.

  1. In the User Rights tab, find the employee
  2. If employee is in "in" status (present), Reset (for arrival) button appears
  3. Click the button
  4. System changes status to "out" (absent)
  5. Employee can now check in arrival again

When to use:

  • Employee forgot to check out yesterday
  • System is "hanging" in "in" status and doesn't allow new arrival
  • You need to quickly unblock employee
Note: Reset only changes status wa_chip_last_inout='out'. Doesn't fix missing attendance record - that must be added manually in the Attendance module.

5. Advanced Features

5.1 Adding Button to Reader

Goal: Add special attendance type (e.g., Doctor, Business Trip) as button on RasPi terminal.

  1. Go to Additional Allowed Buttons on Chip Reader tab
  2. Click green button Add Button
  3. In modal window, select Attendance Type from dropdown list
  4. Click Save
  5. Button appears in table
  6. Set automatic termination mode (see below)

Setting Automatic Termination

After adding button, select one of 3 modes:

A) To Daily Working Hours
  • Check radio button in Automatic termination to daily working hours column
  • System calculates end based on employee's daily workload
  • Example: Business trip - employee has 8h workload, leaves at 9:00 → auto end 17:00
B) At Specified Time
  • Check radio button in Automatic termination at specified time column
  • Enter time in time field below (e.g., 15:30)
  • Example: Training - everyone has fixed end at 16:00
C) Fixed Duration
  • Check radio button in Fixed duration in minutes column
  • Enter number of minutes in numeric field below (e.g., 60)
  • Example: Doctor - automatically terminate after 60 minutes
Recommendations:
  • Business Trip → To working hours
  • Training/Conference → At specified time
  • Doctor/Office → Fixed duration (60-120 min)

5.2 Removing Button

  1. In the buttons table, find the row with the button you want to remove
  2. Click red button Remove Button
  3. Button is removed from database and disappears from terminal

5.3 IP Address Restriction

Goal: Allow API access only from trusted IP addresses (readers).

  1. Go to Allowed IP Addresses from Which Reader Can Connect tab
  2. Check Allow reader access only from IP addresses listed below
  3. In the first empty field, enter reader IP address (e.g., 192.168.1.100)
  4. After entering, another empty field automatically appears
  5. Repeat for all readers
  6. Changes are saved automatically

Security check in code:

// System checks USER_IP against wa_chip_allowed_ips_ser_arr
if (!in_array(USER_IP, $Company->wa_chip_allowed_ips_ser_arr)
    && $Company->wa_chip_allowed_ips_ser_arr[0] != 'all') {
    DieUnauthorized();
}
Critical Warning: If you enable IP whitelist without entering reader IP addresses, all readers will be blocked! First enter IP addresses, then enable whitelist.

5.4 Enabling Facial Recognition

Goal: Allow employees to check in attendance using face without chip.

Requirements:

  • RasPi terminal with camera
  • Employee photos in system (minimum 1 photo per employee)
  • JavaScript library face-api.js (part of system)

Activation Procedure:

  1. Go to User Rights tab
  2. In table header, check By Face (our reader required)
  3. System sets wa_RasPi_Face=1
  4. Camera and face detection activate on RasPi terminal

How it works:

  1. Employee approaches RasPi camera
  2. System loads all stored employee photos
  3. Face-api.js detects face in live video
  4. Compares detected face with stored photos (threshold 0.4)
  5. On match, automatically records attendance
Technical Details:
  • Library: face-api.js v0.22.2
  • Model: SsdMobilenetv1 (fast, accurate)
  • Threshold: 0.4 (40% match = recognition)
  • Photos: Loaded from /UserFaceRecognitionShow/{hash}-{photoID}.png

5.5 Displaying Status of Others

Goal: Display on terminal who is present and who is not.

  1. Go to Other Settings tab
  2. Check Display status (presence) of others on reader
  3. System sets wa_chip_show_active=1

Result: On RasPi terminal, list of all employees is displayed:

  • Green: Present (wa_chip_last_inout='in')
  • Red: Absent (wa_chip_last_inout='out')
Advantages:
  • Employees see who is at work
  • Quick orientation for visitors
  • Attendance transparency

5.6 Dashboard Buttons

Goal: Allow employees to check in attendance directly from web interface without physical card.

  1. Go to Other Settings tab
  2. Check Display Arrival/Departure buttons on main dashboard after login
  3. System sets wa_chip_buttons_on_dashboard=1

Result: After login, each employee sees on dashboard:

  • Green "Arrival" button (if status is 'out')
  • Red "Departure" button (if status is 'in')

Use:

  • Home Office - employee doesn't have access to reader
  • Mobile employees - check-in from mobile/tablet
  • Administration - backup entry method
Security Note: Dashboard buttons don't verify physical presence. We recommend combining with photos on entry or using only for trusted employees.

5.7 Photo on Entry

Goal: Take security photo with each check-in to detect card misuse.

  1. Go to Other Settings tab
  2. Check Photo during attendance entry from terminal
  3. System sets wa_RasPi_TakePhoto=1

How it works:

  1. Employee places chip on reader
  2. RasPi camera takes photo
  3. Photo is uploaded to server
  4. Saved in Files table with link to attendance record
  5. Administrator can check photos in Attendance module

Misuse Detection:

  • Photo shows different person than card owner → misuse
  • Photo is blurry/empty → attempt to bypass system
  • Repeated photos of same person with someone else's card → regular misuse
Recommendation: Enable photography for maximum security. Inform employees that photos are only for verification and are not publicly accessible.

6. Integration

6.1 Connected Modules

Module Relationship Description
Attendance Data Entry Automatic entry of arrival/departure times into Workattendance table.
If wa_chip_WritePause=1 is enabled, break duration is also recorded.
Users Employee Link Loading user data (cUser class):
- Chip code (wa_chip_code)
- Fingerprints (FingerPrints_ser_arr)
- Attendance rights (rights_workattendance)
- Minimum break (wa_chip_minimal_pause_min)
RasPi Terminals Physical Reader RasPi device management (cRasPi class):
- Firmware version (Version)
- Last check (LastCheck)
- Fingerprint reader (FingerPrintReader)
- API endpoint (GetUrl())
Attendance Types Reader Buttons Loading attendance types (cWorkattendance_days_type):
- Type name (day_name_cs)
- Reader availability (chip_buttons_available)
- Linked via Workattendance_chip_buttons table
Files Photos on Entry Storing photos from terminal:
- Files table
- Link to attendance record
- Access via Attendance module

6.2 Data Flows

Flow 1: Chip Check-in from RasPi Terminal

1. Employee places chip on RasPi reader
   ↓
2. RasPi reads chip code from RFID/NFC
   ↓
3. RasPi calls API endpoint:
   GET /?w=wa_chip_inout&idUser=123&hash=abc123xyz
   ↓
4. inc/wa_chip_inout.php processes request:
   - Verifies hash against User.wa_chip_code
   - Verifies IP address against wa_chip_allowed_ips_ser_arr
   - Checks wa_chip_last_inout status
   ↓
5. Entry to Workattendance table:
   - Arrival: Creates new record with time_start
   - Departure: Fills time_end in existing record
   ↓
6. Update User.wa_chip_last_inout:
   - 'in' → 'out' or 'out' → 'in'
   ↓
7. If wa_RasPi_TakePhoto=1:
   - RasPi takes photo
   - Uploads to server
   - Saves to Files table
   ↓
8. Response to RasPi terminal:
   - HTML page with confirmation
   - Display of entry time
   - List of present employees (if wa_chip_show_active=1)

Flow 2: Check-in from Dashboard (Web Interface)

1. Employee clicks "Arrival" button on dashboard
   ↓
2. JavaScript calls AJAX:
   $.get('/?w=wa_chip_inout&idUser='+idUser+'&hash='+hash)
   ↓
3. inc/wa_chip_inout.php processes same as RasPi
   ↓
4. Entry to Workattendance
   ↓
5. Update wa_chip_last_inout
   ↓
6. AJAX response:
   - Dashboard refreshes
   - Displays new status ("Departure" instead of "Arrival")

Flow 3: Facial Recognition (Face Recognition)

1. Employee approaches RasPi camera
   ↓
2. RasPi streams video to server
   ↓
3. JavaScript face-api.js:
   - Loads all employee photos
   - Creates FaceMatcher with stored faces
   - Detects face in live video
   - Compares with stored faces
   ↓
4. On match (threshold > 0.4):
   window.location.replace('?w=wa_chip_inout&FaceDetection='+hash)
   ↓
5. Server processes FaceDetection parameter:
   - Finds idUser by hash
   - Loads wa_chip_code
   - Records attendance
   ↓
6. Same flow as Flow 1 (steps 5-8)

6.3 Dependencies

Component Dependency Required
RasPi Terminal Physical device with RFID/NFC reader Yes
Attendance Module Must be active for data entry Yes
Users Employees must have attendance rights Yes
RasPi with Camera For facial recognition and photos Optional
Fingerprint Reader For biometric identification Optional
face-api.js Library for facial recognition Optional
Network Connection RasPi must have server access Yes

7. API Endpoint

7.1 Main Endpoint

URL Format:

https://your-domain.com/?w=wa_chip_inout&idUser={ID}&hash={HASH}

7.2 Parameters

Parameter Type Required Description
w string Yes Endpoint identifier
Value: wa_chip_inout
idUser int Yes Employee ID in system
Example: 123
hash string Yes Chip security hash code
Corresponds to: User.wa_chip_code
Example: abc123xyz789def456
idWorkattendance_chip_buttons int No Reader button ID (special attendance type)
Example: 5 (Doctor)
FaceDetection string No Recognized face hash
Format: {userHash}-{photoID}
Example: abc123-1
FingerID int No Recognized fingerprint ID
Example: 7
wa_chip_action string No Specific action (e.g., manual note selection)
Values: note, pause

7.3 Security Checks

The API endpoint performs the following security checks:

  1. Hash Verification:
    if ($User->wa_chip_code != $_GET['hash']) {
        DieUnauthorized();
    }
  2. IP Address Check:
    if (!in_array(USER_IP, $Company->wa_chip_allowed_ips_ser_arr)
        && $Company->wa_chip_allowed_ips_ser_arr[0] != 'all') {
        DieUnauthorized();
    }
  3. User Existence Check:
    $User = new cUser();
    $User->load($_GET['idUser']);
    if ($User->idUser == 0) {
        DieUnauthorized();
    }
  4. Active Account Check:
    if ($User->active != 1 || $User->deleted != 0) {
        DieUnauthorized();
    }

7.4 API Response

API returns HTML page with the following information:

  • Time and Date: Current time and date (JavaScript clock)
  • Entry Confirmation: "Arrival recorded" / "Departure recorded"
  • Entry Time: Exact check-in time
  • List of Present: If wa_chip_show_active=1
  • Photo: If wa_RasPi_TakePhoto=1, photo preview is displayed

7.5 Call Examples

Example 1: Regular Arrival

GET https://company.com/?w=wa_chip_inout&idUser=45&hash=x7k9mN2pQ5rT8vW1

Example 2: Departure to Doctor (Button ID=3)

GET https://company.com/?w=wa_chip_inout&idUser=45&hash=x7k9mN2pQ5rT8vW1&idWorkattendance_chip_buttons=3

Example 3: Facial Recognition

GET https://company.com/?w=wa_chip_inout&FaceDetection=abc123def456-1

Example 4: Fingerprint

GET https://company.com/?w=wa_chip_inout&idUser=45&hash=x7k9mN2pQ5rT8vW1&FingerID=7

8. RasPi Terminal

8.1 Device Description

RasPi (Raspberry Pi) terminal is a credit card-sized compact computer that serves as a physical attendance reader.

Hardware Components

Component Description Required
Raspberry Pi Main board (recommended RPi 4 or newer) Yes
RFID/NFC Reader Module for reading chip cards (e.g., RC522) Yes
Display Touchscreen display for showing buttons and status Yes
Camera Pi Camera for photography and facial recognition Optional
Fingerprint Reader Biometric fingerprint reader (e.g., R307) Optional
Network Connection Ethernet or WiFi for server communication Yes

8.2 Terminal Functions

Basic Functions

  • Chip Reading: Automatic RFID/NFC card detection
  • Time Display: Current time and date
  • Attendance Type Buttons: Arrival, Departure, Break, Lunch + configurable buttons
  • Entry Confirmation: Visual and audio signal of successful entry
  • List of Present: Display of who is at work (if enabled)

Advanced Functions (Optional)

  • Facial Recognition: AI detection using camera and face-api.js
  • Fingerprint Reading: Biometric identification using fingerprints
  • Photography: Security photo capture with each check-in
  • Video Stream: Live video from camera for facial recognition

8.3 Terminal Management

Registering New Terminal

  1. Physically connect RasPi to network (Ethernet or WiFi)
  2. Run installation script on RasPi
  3. RasPi automatically registers with server:
POST https://company.com/RestAPI/RasPi.php
{
    "action": "register",
    "hash": "E5tlu8Jg44ZwwlBQgSbCE3lU7RSRvMXa"
}
  1. New terminal appears in administration in Registered Readers tab

Checking Terminal Status

Terminal reports to server regularly (every 5 minutes):

GET https://company.com/RestAPI/RasPiCheck.php?hash={hash}

Server updates LastCheck column in RasPi table.

Firmware Update

  1. Log in to RasPi via SSH
  2. Run command: sudo /home/pi/UpdateFromeIntranetServer
  3. Script downloads latest version from: https://company.com/Apps/RasPiUpdate/
  4. Automatically restarts services
  5. Version updates in database (Version column)

8.4 Terminal API URL

Each RasPi terminal has a unique API URL:

https://company.com/RasPi/{HASH}/RFID/WorkAttenDance

Where {HASH} is the terminal security identifier (e.g., E5tlu8Jg44ZwwlBQgSbCE3lU7RSRvMXa).

Usage:

  • RasPi reads chip with code 12345
  • RasPi calls: https://company.com/?w=wa_chip_inout&idUser=45&hash=12345
  • Server verifies and records attendance
  • RasPi displays confirmation

8.5 Problem Diagnostics

Problem: Terminal Not Reporting

Symptoms: In "Registered Readers" tab, old time in "Last Check" column

Solution:

  1. Check RasPi network connection (ping server)
  2. Verify that RasPi IP address is in whitelist
  3. Check logs on RasPi: /var/log/eintranet/
  4. Restart RasPi: sudo reboot

Problem: Reader Not Reading Chips

Symptoms: Placing chip triggers no response

Solution:

  1. Check physical reader connection to RasPi
  2. Verify reader service is running: sudo systemctl status rfid
  3. Restart service: sudo systemctl restart rfid
  4. Check that chip is compatible (RFID/NFC 13.56 MHz)

Problem: Facial Recognition Not Working

Symptoms: Camera doesn't display video or doesn't recognize faces

Solution:

  1. Verify that it's enabled in settings: wa_RasPi_Face=1
  2. Check camera connection to RasPi
  3. Verify employees have uploaded photos in system
  4. Check JavaScript console in browser for errors
  5. Try lowering threshold: adjust minConfidence = 0.3 (instead of 0.4)

9. Tips and Tricks

9.1 Copying API URL

Tip: In the "User Rights" tab, click the clipboard icon (fa-clipboard) next to chip code. URL is copied to clipboard.

Use: You can open URL in browser for manual check-in testing without physical reader.

9.2 Testing Without RasPi Terminal

Procedure:

  1. Copy employee API URL
  2. Open URL in browser
  3. System records attendance as from RasPi
Warning: If you have IP whitelist enabled, you must add your IP address, otherwise access will be denied.

9.3 Bulk Reset of "Hanging" Statuses

Situation: Multiple employees forgot to check out and system is in "in" status.

SQL Query Solution:

UPDATE User
SET wa_chip_last_inout='out'
WHERE Company_idCompany=123
AND wa_chip_last_inout='in';

Note: This only resets statuses, doesn't fix missing attendance records.

9.4 Setting Minimum Break for All

Situation: You want to set 30-minute minimum break for all employees.

SQL Query Solution:

UPDATE User
SET wa_chip_minimal_pause_min=30
WHERE Company_idCompany=123
AND active=1
AND deleted=0;

9.5 Exporting Chip Codes

Procedure:

  1. In "User Rights" tab, use DataTables export
  2. Click "Excel" or "CSV" button
  3. File with all chip codes downloads

9.6 Automatic Button for Home Office

Recommendation: Add "Home Office" button with automatic termination to working hours.

Advantage: Employee records home office, system automatically terminates based on their workload.

9.7 Combining Chip and Face

Option: Enable both facial recognition and chip simultaneously.

Advantage:

  • Employee can use chip (fast)
  • Or face (if forgot card)
  • System supports both

9.8 Photos as Evidence

Tip: If you have attendance disputes, use terminal photos as evidence.

Access:

  1. Attendance Module
  2. Record Details
  3. Photo taken during check-in is displayed

9.9 Mobile Application as Alternative

Information: System also supports mobile application for attendance check-in.

Advantage:

  • Employee doesn't need chip
  • Check-in from phone anywhere
  • GPS location on entry (optional)

9.10 Regular Cleanup of Old Photos

Tip: Photos take up server space. Set automatic deletion older than 3 months.

Cron Job:

DELETE FROM Files
WHERE table_name='Workattendance'
AND created < DATE_SUB(NOW(), INTERVAL 3 MONTH);

10. Troubleshooting

10.1 Chip Not Working

Symptoms: Placing chip on reader triggers no response or displays error.

Possible Causes and Solutions:

Cause Solution
Incorrect or empty chip code Check that Chip Code is filled in "User Rights" tab.
Must exactly match code in chip.
Reader IP address not in whitelist Go to "Allowed IP Addresses" tab.
Add RasPi terminal IP address.
Or disable IP whitelist (unchecked).
Reader not reading chip Check physical reader connection to RasPi.
Restart RFID service: sudo systemctl restart rfid
Incompatible chip Verify chip is RFID/NFC 13.56 MHz (e.g., Mifare).
System doesn't support 125 kHz chips.
Network problem Check RasPi network connection.
Ping server: ping your-domain.com

Testing: Copy API URL (clipboard icon) and open in browser. If it works, problem is in RasPi/reader. If it doesn't work, problem is in system settings.

10.2 Employee Cannot Record Manually

Symptoms: When attempting manual entry in Attendance module, "Not Authorized" error appears.

Possible Causes and Solutions:

Cause Solution
"Prevent Edits" checked In "User Rights" tab, uncheck Prevent work time edits checkbox.
Or click Manually can record only attendance type... and allow specific types.
Attendance type not allowed Click Manually can record only attendance type...
Check required type (e.g., Vacation, Sick Leave).
Click Save.
No attendance rights In user administration, check that employee has rights_workattendance set.
Must be '1' or '2' (not NULL or 0).

10.3 Break Automatically Extends

Symptoms: Employee records 15-minute break, but 30 minutes appears in system.

Cause: Minimum break duration is set.

Solution:

  1. In "User Rights" tab, find employee
  2. In Minimum Break Duration (minutes) column, delete value or decrease (e.g., from 30 to 15)
  3. System automatically saves

Note: Break extension is an intended feature, not a bug. Serves to enforce lunch break.

10.4 Photos Not Being Taken

Symptoms: In Attendance module, records are missing photos even though feature is enabled.

Possible Causes and Solutions:

Cause Solution
Not enabled in settings In "Other Settings" tab, check Photo during attendance entry from terminal.
Verify that wa_RasPi_TakePhoto=1.
RasPi doesn't have camera Verify that Pi Camera is physically connected to RasPi.
Check camera cable connection.
Run camera test: raspistill -o test.jpg
Camera service not running Check status: sudo systemctl status camera
Restart: sudo systemctl restart camera
Error uploading to server Check RasPi logs: /var/log/eintranet/camera.log
Verify network connection and server write permissions.
Check-in from dashboard Photos are only taken when checking in from RasPi terminal.
Dashboard buttons don't take photos (no camera).

10.5 Terminal Not Reporting

Symptoms: In "Registered Readers" tab, "Last Check" column shows old date/time (more than an hour).

Possible Causes and Solutions:

Cause Solution
RasPi is powered off Check that RasPi is connected to power and LED is lit.
Try physically restarting (disconnect and reconnect power).
Network problem Check Ethernet cable or WiFi connection.
Ping server from RasPi: ping your-domain.com
Check firewall and router.
IP address not in whitelist In "Allowed IP Addresses" tab, add RasPi IP address.
Check that RasPi IP address hasn't changed (DHCP).
We recommend setting static IP.
Check service didn't start SSH to RasPi.
Check status: sudo systemctl status eintranet-check
Restart: sudo systemctl restart eintranet-check
Error in configuration file Check configuration: /etc/eintranet/config.json
Verify correct server URL and hash.

10.6 Facial Recognition Not Working

Symptoms: Camera displays video, but system doesn't recognize any employee.

Possible Causes and Solutions:

Cause Solution
Not enabled in settings In "User Rights" tab, check By Face (our reader required).
Verify that wa_RasPi_Face=1.
Missing employee photos In user administration, check that employees have uploaded photos.
Minimum 1 photo per employee.
Photos must be frontal, well-lit, without glasses/hat.
Poor lighting conditions Ensure adequate lighting in front of reader.
Avoid backlighting and dark areas.
Ideal is even daylight.
Threshold too high In file inc/wa_chip_inout.php lower minConfidence:
let minConfidence = 0.3 (instead of 0.4)
Warning: Lower threshold = more false recognitions.
JavaScript errors Open JavaScript console in browser (F12).
Check error messages.
Try different browser (Chrome recommended).
Face-api.js not loaded Check that file exists:
/_components/face-api.js-0.22.2/dist/face-api.min.js
Check network connection (API loads models from CDN).

10.7 Dashboard Buttons Not Visible

Symptoms: After logging into dashboard, Arrival/Departure buttons are missing.

Possible Causes and Solutions:

Cause Solution
Not enabled in settings In "Other Settings" tab, check Display Arrival/Departure buttons on main dashboard.
Verify that wa_chip_buttons_on_dashboard=1.
Browser cache Refresh page with cache clear: Ctrl + F5 (Windows) or Cmd + Shift + R (Mac).
Or clear cookies and cache in browser settings.
No chip code filled In "User Rights" tab, check that employee has filled Chip Code.
Buttons only display for users with chip code.
JavaScript error Open JavaScript console (F12).
Check error messages.
Try different browser.

10.8 Automatic Termination Not Working

Symptoms: Employee checks in special type (e.g., Doctor), but attendance doesn't automatically terminate.

Possible Causes and Solutions:

Cause Solution
Mode not set In "Additional Allowed Buttons" tab, check button.
One of 3 radio buttons must be checked (to hours, time, or duration).
If not, check and set value.
Employee checked out manually Automatic termination only applies if employee did NOT check out by midnight.
If checked out manually, automatic mode doesn't apply.
Cron job not running Automatic termination is performed by cron job (e.g., at 00:01).
Check that it's running: crontab -l
Look for line with wa_chip_autoclose.php (or similar).
Incorrect time setting For "At specified time" mode, check time format: HH:MM
Must be valid time (e.g., 15:30, not 25:00).

10.9 Minimum Break Not Applied

Symptoms: Employee has 30-min minimum break set, but system accepts shorter breaks.

Possible Causes and Solutions:

Cause Solution
Value not filled In "User Rights" tab, check Minimum Break Duration column.
Must be numeric value (e.g., 30), not empty field.
Manual attendance entry Minimum break only applies when checking in from terminal.
Manual entry in Attendance module doesn't perform check.
Logic not implemented Check that code in inc/wa_chip_inout.php contains minimum break check.
Look for line with wa_chip_minimal_pause_min.

10.10 IP Whitelist Blocks Legitimate Access

Symptoms: Reader doesn't work even though correctly configured. Log shows "Unauthorized" error.

Possible Causes and Solutions:

Cause Solution
IP address not in list In "Allowed IP Addresses" tab, add reader IP address.
Find actual RasPi IP address: hostname -I
Dynamic IP address (DHCP) RasPi IP address may have changed after restart.
We recommend setting static IP address in router settings or on RasPi.
NAT/Proxy server If RasPi is behind NAT/proxy, server sees different IP.
Check what IP server sees: echo USER_IP in log.
Add this IP to whitelist.
IP address format Check correct format: 192.168.1.100
Not: 192.168.1.100:80 or http://192.168.1.100
Quick IP Problem Diagnostics:
  1. Temporarily disable IP whitelist (uncheck checkbox)
  2. Try checking in from reader
  3. If it works → problem is in IP whitelist
  4. Check server logs for what IP it sees
  5. Add correct IP to whitelist
  6. Re-enable whitelist