OKAI IoT Integration
Levy Fleets provides comprehensive support for OKAI ZK Series IoT devices, implementing 100% of the @Track Air Interface Protocol v80.56. This guide covers the complete integration, including supported commands, telemetry processing, and troubleshooting.
Protocol Version
Levy Fleets implements the ZK Series @Track Air Interface Protocol version 80.56, providing full coverage of all 77 documented commands.
Overview
OKAI IoT devices communicate with Levy Fleets through a secure API endpoint that processes telemetry data, location reports, and vehicle control commands. The integration supports:
- Real-time GPS tracking with location history
- Battery monitoring including charging status
- Lock/unlock control with status confirmation
- Speed limiting for zone enforcement
- Alarm and alert handling for security events
- Diagnostic data for maintenance and troubleshooting
Device Configuration
Server Settings
Configure your OKAI device to communicate with Levy Fleets using these settings:
| Setting | Value |
|---|---|
| Server IP/Domain | Your Levy Fleets IoT endpoint |
| Port | As provided during setup |
| Protocol | HTTPS/TCP |
Authentication
OKAI devices authenticate via API key. Ensure your IoT devices are configured with the correct API key in the x-api-key header.
API Key Security
Keep your IoT API key confidential. This key authenticates all device-to-server communication. Contact support if you need to rotate your API key.
Device Identification
Devices are identified by their IMEI number. When a device connects:
- The IMEI is extracted from the message
- The system looks up the vehicle linked to that IMEI
- Telemetry is associated with the correct vehicle
- If no vehicle is found, the message is logged as "unmatched"
Supported Commands
Levy Fleets implements complete coverage of the OKAI protocol. Commands are organized into functional categories:
Location & Telemetry
| Command | Code | Description |
|---|---|---|
| Fixed Report Interval | GTFRI | Periodic GPS location reports |
| Event Report Interval | GTERI | Event-triggered location reports |
| Real-Time Operation | GTRTO | On-demand location request response |
| Real-Time Location | GTRTL | Immediate location response |
Status & Information
| Command | Code | Description |
|---|---|---|
| Status Report | GTSTT | Current vehicle status |
| Device Information | GTINF | Hardware/software information |
| Version Information | GTVER | Firmware versions |
| Cell ID/Network | GTCID | Cellular network information |
| Alive Status | GTALI | Device heartbeat/alive check |
| Query Response | GTQRY | Configuration query response |
| Serial Number | GTQSN | Device serial number query |
Battery Management
| Command | Code | Description |
|---|---|---|
| Battery Status | GTBAT | Main battery level and voltage |
| Battery Low | GTBPL | Low battery alert |
| Battery Manager Info | GTBMI | Detailed battery management data |
ECU (Electronic Control Unit)
| Command | Code | Description |
|---|---|---|
| ECU Status | GTECU | ECU operational status |
| ECU State Change | GTECS | ECU state transition events |
| ECU Error Code | GTCFU | ECU error/fault codes |
| ECU Shutdown | GTCSD | Abnormal ECU shutdown event |
| ECU Firmware Lost | GTCFL | ECU firmware error |
Lock Operations
| Command | Code | Description |
|---|---|---|
| Lock Status | GTLCK | Current lock state |
| Lock State Change | GTLKS | Lock state transition |
| Lock Successful | GTLOC | Lock command confirmed |
| Lock Failed | GTLOF | Lock command failed |
| Unlock Successful | GTULS | Unlock command confirmed |
| Unlock Failed | GTULF | Unlock command failed |
| Lock Request | GTLOR | ECU lock request |
| Mechanical Lock | GTMLS | Mechanical lock status change |
Motion & Alarms
| Command | Code | Description |
|---|---|---|
| Motion Detection | GTJDR | Jamming/motion detected |
| Motion Start | GTJDS | Motion detection triggered |
| Alarm | GTALM | General alarm event |
| SOS Alarm | GTSOS | Emergency/SOS alert |
| Overturn | GTBOV | Scooter overturned |
| Recovery | GTBRN | Recovered from overturn |
| Alarm List | GTALS | List of active alarms |
Speed & Geofencing
| Command | Code | Description |
|---|---|---|
| Throttle Status | GTSPD | Speed/throttle state |
| Speed Alarm | GTSPA | Speed limit exceeded |
| Geofence Event | GTGEO | Generic geofence trigger |
| Geofence Entry | GTGEI | Entered geofence zone |
| Geofence Exit | GTGEX | Exited geofence zone |
System & Network
| Command | Code | Description |
|---|---|---|
| Heartbeat | GTHBD | Keep-alive signal |
| Diagnostic Report | GTDGN | Device diagnostics |
| Error Report | GTERR | Error information |
| Network Connection | GTNCN | New server connection |
| Watchdog Reboot | GTDOG | Device reboot by watchdog |
Power Events
| Command | Code | Description |
|---|---|---|
| Power On | GTPNA | Vehicle powered on |
| Power On (Fixed) | GTPNL | Power on with fixed report |
| Power Off | GTPFA | Vehicle powered off |
| Charging Start | GTSCE | Battery charging started |
| Charging Stop | GTPCE | Battery charging stopped |
| Backup Charging Start | GTBTC | Backup battery charging |
| Backup Charging Stop | GTSTC | Backup battery charge complete |
| Main Power | GTEPN | Main power supply event |
| Backup Power | GTEPF | Backup power supply event |
Configuration
| Command | Code | Description |
|---|---|---|
| All Configuration | GTALC | Full device configuration |
| GPS Configuration | GTCGP | GPS settings |
| CAN Version | GTCVR | CAN bus version |
| CAN Version II | GTCVI | Extended CAN version |
| CAN Transparent | GTCAT | CAN transparent command |
NFC & Service
| Command | Code | Description |
|---|---|---|
| NFC Event | GTNFC | NFC card/tag interaction |
| Service Request | GTRSS | Request to stop service |
| Reservation | GTRES | Reservation event |
| Wireless Charging | GTWLC | Wireless charging status |
| Helmet Box | GTHLM | Helmet box unlock event |
Binding & Bluetooth
| Command | Code | Description |
|---|---|---|
| Binding Info | GTBND | Device binding report |
| Beacon Info | GTBEI | Bluetooth beacon data |
Data Collection
| Command | Code | Description |
|---|---|---|
| Motion Data | GTMDR | Motion/movement data |
| Acceleration Data | GTADR | Accelerometer readings |
Telemetry Processing
Location Reports
When the device sends a location report (GTFRI, GTERI, or GTRTO), Levy Fleets:
- Parses GPS coordinates (latitude, longitude)
- Extracts speed, heading, and altitude
- Updates the vehicle's current position
- If an active ride exists, stores the location in ride history
- Triggers zone enforcement if coordinates have changed
Battery Updates
Battery status messages include:
- Battery Level - Percentage (0-100%)
- Battery Voltage - Actual voltage reading
- Charging Status - Whether the vehicle is charging
- IoT Battery - Backup/IoT module battery (if separate)
The system uses battery level to:
- Update vehicle availability (low battery = unavailable)
- Filter vehicles in the dashboard by battery status
- Trigger low battery alerts
Lock Status
Lock state changes update the vehicle record:
| Event | Vehicle Status |
|---|---|
GTLOC (Lock Success) | lock_status: 'locked' |
GTULS (Unlock Success) | lock_status: 'unlocked' |
GTLOF (Lock Failed) | Status unchanged, error logged |
GTULF (Unlock Failed) | Status unchanged, error logged |
Zone Enforcement
After processing location updates during an active ride:
- The vehicle's coordinates are checked against all zones
- If the vehicle enters a speed limit zone, a throttle command is sent
- If the vehicle enters a no-go zone, the throttle is disabled
- If the vehicle exits the service area, an alert is triggered
- Ride statistics are recalculated
Vehicle Identity Resolution
OKAI integration uses intelligent caching for vehicle lookups:
Lookup Process
- Check cache - First, look for IMEI in the vehicle identity cache
- Cache hit - Return cached vehicle UUID and number
- Cache miss - Query database for vehicle with matching
iot_imei - Store in cache - Cache the result for 1 hour
- Return identity - Provide vehicle UUID for telemetry association
Unmatched Devices
If no vehicle is found for an IMEI:
- The message is still processed for logging
- The device is recorded in the "unmatched devices" table
- Operators can view unmatched devices in the dashboard
- Once the device is registered, future messages are properly associated
Active Ride Detection
For each incoming message, the system checks for active rides:
- Query rides with status
activeorpaused - Filter by
vehicle_uuidmatching the identified vehicle - If found, associate telemetry with the ride
- Location data is added to ride history
- Ride statistics (distance, duration) are updated
Legacy Ride Support
For backwards compatibility with older ride records:
- If no ride is found by UUID, search by
vehicle_number - If a legacy ride is found, normalize the identifiers
- Backfill the
vehicle_uuidfield for future queries
Sending Commands to Devices
IoT Password
Commands to OKAI devices require the correct password. Set this in:
Settings > Vehicles > IoT Passwords > Okai
Default password: zk200
Available Commands
From the vehicle detail page, you can send:
| Command | Action |
|---|---|
| Lock | Engage wheel lock, disable throttle |
| Unlock | Release wheel lock, enable throttle |
| Sound | Play alert sound on vehicle |
| Locate | Flash lights to help find vehicle |
Command Flow
- Operator clicks command button in dashboard
- Command is queued for the device
- Device receives command on next heartbeat (or immediately if online)
- Device executes command and sends confirmation
- Dashboard updates with new status
Command Delivery
Commands are delivered within seconds for online devices. If a device is offline, commands will be delivered when it reconnects.
Troubleshooting
Device Not Reporting Location
Symptoms: Vehicle shows no location or stale location data
Solutions:
- Check device power - ensure battery is charged
- Verify GPS antenna - must have clear sky view
- Check cellular connectivity - device needs network access
- Review device configuration - verify server settings
- Check for GPS fix - new installations may need 5-10 minutes
Lock/Unlock Commands Not Working
Symptoms: Commands sent but vehicle doesn't respond
Solutions:
- Verify IoT password is correct in Settings
- Confirm device is online (check last seen timestamp)
- Check for ECU errors in telemetry
- Verify vehicle has sufficient battery
- Try power cycling the vehicle
Battery Not Updating
Symptoms: Battery level stays at same value
Solutions:
- Check reporting interval configuration
- Verify device is actually reporting (check last seen)
- Some devices only report battery on specific events
- Review telemetry logs for GTBAT messages
Geofence Not Triggering
Symptoms: Vehicle enters zone but no enforcement happens
Solutions:
- Verify zone is properly configured and active
- Check that zone type supports enforcement
- Confirm ride is active (zone enforcement only applies during rides)
- Review location accuracy - GPS may be imprecise
- Check zone boundaries for gaps
Device Shows as Unmatched
Symptoms: Device reporting but appears in unmatched list
Solutions:
- Register the device in IoT Devices section
- Verify IMEI matches exactly (no spaces/dashes)
- Link device to a vehicle
- Clear cache if recently added (cache updates hourly)
Data Storage
Telemetry Table
All OKAI messages are stored in the vehicle_telemetry table with:
vehicle_uuid- Associated vehicleimei- Device identifierraw_payload- Complete message data as JSONmessage_type- Command type (e.g., "GTFRI")timestamp- Message timestampbattery_level,speed,latitude,longitude- Extracted values
Retention
Telemetry data is retained according to your plan's data retention policy. Contact support for information about extended retention options.
API Reference
Endpoint
POST /api/iot/okai
Headers
x-api-key: your-iot-api-key
Content-Type: application/json
Request Body
{
"imei": "867648045123456",
"message": "+RESP:GTFRI,...",
"timestamp": "2025-12-25T12:00:00Z"
}
Response
{
"success": true,
"imei": "867648045123456",
"messageType": "+RESP",
"command": "GTFRI",
"processed": true
}
Health Check
GET /api/iot/okai
Returns service status and list of supported commands.
Technical Support
For OKAI integration issues, contact support@levyelectric.com with:
- Device IMEI
- Timestamp of the issue
- Description of expected vs. actual behavior
- Any error messages from the dashboard