AgentSkillsCN

geotab

Geotab 车队管理开发的完整指南。无论您需要处理 Geotab API、MyGeotab 插件、Zenith 风格定制,还是进行 Ace AI 查询,此技能都将为您提供全方位的支持。它整合了 Python API、JavaScript 插件、React 组件,以及自然语言车队查询功能。

SKILL.md
--- frontmatter
name: geotab
description: Complete guide for Geotab fleet management development. Use for any task involving the Geotab API, MyGeotab Add-Ins, Zenith styling, or Ace AI queries. This unified skill covers Python API, JavaScript Add-Ins, React components, and natural language fleet queries.
license: Apache-2.0
metadata:
  author: Felipe Hoffa (https://www.linkedin.com/in/hoffa/)
  version: "2.0"

Geotab Development Guide

This is the unified skill for all Geotab fleet management development. Navigate to the specific reference you need based on your task.

Quick Navigation

TaskReferenceDescription
Connect to APIAPI_QUICKSTART.mdPython authentication, fetching data, entity types
Build Add-InsADDINS.mdCreate custom MyGeotab pages (vanilla JS)
Style with ZenithZENITH_STYLING.mdReact components matching MyGeotab look
AI QueriesACE_API.mdNatural language fleet queries via Geotab Ace

Reference Files

Core Development

ReferenceWhen to Use
API_QUICKSTART.mdStarting with Geotab API, fetching devices/trips/drivers, Python development
ADDINS.mdBuilding custom pages in MyGeotab, JavaScript Add-Ins
ZENITH_STYLING.mdUpgrading Add-Ins to professional React UI
ACE_API.mdNatural language queries, trend analysis, AI insights

Data Analysis

ReferenceWhen to Use
SPEED_DATA.mdWorking with vehicle speed data, LogRecord queries
TRIP_ANALYSIS.mdAnalyzing trip data, fuel efficiency, distance calculations

Add-In Development

ReferenceWhen to Use
EMBEDDED.mdNo-hosting Add-In deployment, inline JSON config
EXAMPLES.mdComplete working Add-In code examples
INTEGRATIONS.mdNavigation, email, maps, external APIs
SECURE_BACKEND.mdSecuring Cloud Functions called by Add-Ins
STORAGE_API.mdPersisting Add-In data with AddInData
TROUBLESHOOTING.mdDebugging common Add-In issues

Zenith Components

ReferenceWhen to Use
ZENITH_COMPONENTS.mdDetailed Zenith component API reference
ZENITH_EXAMPLE.mdComplete React + Zenith Add-In example

Common Patterns

Authentication (Python)

python
import mygeotab
from dotenv import load_dotenv
import os

load_dotenv()

api = mygeotab.API(
    username=os.getenv('GEOTAB_USERNAME'),
    password=os.getenv('GEOTAB_PASSWORD'),
    database=os.getenv('GEOTAB_DATABASE'),
    server=os.getenv('GEOTAB_SERVER', 'my.geotab.com')
)
api.authenticate()

Fetching Data (Python)

python
from datetime import datetime, timedelta

# Get all vehicles
devices = api.get('Device')

# Get trips from last 7 days
trips = api.get('Trip',
    fromDate=datetime.now() - timedelta(days=7),
    toDate=datetime.now()
)

# Get drivers
drivers = api.get('User', search={'isDriver': True})

Add-In Structure (JavaScript)

javascript
geotab.addin["your-addin-name"] = function() {
    var apiRef = null;

    return {
        initialize: function(api, state, callback) {
            apiRef = api;
            // Setup code
            callback();  // MUST call!
        },
        focus: function(api, state) {
            // Refresh data
        },
        blur: function(api, state) {
            // Cleanup
        }
    };
};

API Call (JavaScript)

javascript
api.call("Get", { typeName: "Device" }, function(devices) {
    console.log("Found " + devices.length + " vehicles");
}, function(error) {
    console.error("Error:", error);
});

Critical Rules

  1. Never use typeName: "Driver" - Use User with search: { isDriver: true }
  2. Always use date ranges for trips - Never fetch all trips without time bounds
  3. Test credentials once before loops - Failed auth locks account 15-30 min
  4. External CSS for Add-Ins - Inline <style> tags may be stripped
  5. ES5 JavaScript only - No arrow functions, const/let, template literals in Add-Ins
  6. Call callback() in initialize - Or Add-In will hang

Entity Types Quick Reference

TypeDescriptionCommon Use
DeviceVehicles/assetsFleet inventory
TripCompleted journeysRoute analysis
UserUsers and driversDriver management
DeviceStatusInfoCurrent location/statusLive tracking
LogRecordGPS breadcrumbsHistorical routes
StatusDataSensor readingsEngine diagnostics
ExceptionEventRule violationsSafety monitoring
FaultDataEngine fault codesMaintenance
ZoneGeofencesLocation monitoring
GroupOrganizational hierarchyVehicle grouping

See API_QUICKSTART.md for the complete list of 34 entity types.

Getting Started

  1. Create demo account: my.geotab.com/registration.html (click "Create a Demo Database")
  2. Set up .env file: Store credentials safely
  3. Install dependencies: pip install mygeotab python-dotenv
  4. Read your first skill: Start with API_QUICKSTART.md

Resources