Skip to main content

Python wrapper for the DroneMobile API for Firstech/Compustar remote start systems.

Project description

drone_mobile-python

Upload Python Package PyPI version Python Versions License: MIT

A modern, fully-typed Python wrapper for the DroneMobile API. Control your Firstech/Compustar remote start system from Python.

⚠️ Disclaimer

The code here is based off of an unsupported API from DroneMobile and is subject to change without notice. The authors claim no responsibility for damages to your vehicle by use of the code within.

✨ Features

  • 🔐 Secure Authentication - Automatic token management with secure storage
  • 🚗 Vehicle Control - Start/stop engine, lock/unlock doors, and more
  • 📊 Status Monitoring - Get detailed vehicle status information
  • 🎯 Type Safe - Full type hints for better IDE support
  • 🧪 Well Tested - Comprehensive test suite
  • 🛠️ CLI Tool - Command-line interface for quick operations
  • 🔄 Context Manager - Clean resource management
  • 📝 Detailed Logging - Debug and track API interactions

📦 Installation

pip install drone_mobile

For development:

pip install drone_mobile[dev]

🚀 Quick Start

Basic Usage

from drone_mobile import DroneMobileClient

# Create a client and authenticate
client = DroneMobileClient("your_email@example.com", "your_password")

# Get all vehicles
vehicles = client.get_vehicles()

# Work with the first vehicle
vehicle = vehicles[0]
print(f"Vehicle: {vehicle.name}")

# Get status
status = vehicle.get_status()
print(f"Running: {status.is_running}")
print(f"Locked: {status.is_locked}")
print(f"Battery: {status.battery_percent}%")

# Control the vehicle
vehicle.start()  # Start the engine
vehicle.unlock()  # Unlock doors
vehicle.lock()  # Lock doors
vehicle.stop()  # Stop the engine

Using Context Manager

from drone_mobile import DroneMobileClient

# Automatically handles cleanup
with DroneMobileClient("email@example.com", "password") as client:
    vehicles = client.get_vehicles()
    for vehicle in vehicles:
        status = vehicle.get_status()
        print(f"{vehicle.name}: {'Running' if status.is_running else 'Stopped'}")

Error Handling

from drone_mobile import DroneMobileClient
from drone_mobile.exceptions import (
    AuthenticationError,
    CommandFailedError,
    VehicleNotFoundError
)

try:
    client = DroneMobileClient("email@example.com", "password")
    vehicle = client.get_vehicle("vehicle_id")
    vehicle.start()
except AuthenticationError:
    print("Invalid credentials")
except CommandFailedError as e:
    print(f"Command failed: {e}")
except VehicleNotFoundError:
    print("Vehicle not found")

🖥️ Command Line Interface

The package includes a CLI tool for quick operations:

# List all vehicles
drone-mobile-demo user@example.com password list

# Show vehicle status
drone-mobile-demo user@example.com password status

# Send commands
drone-mobile-demo user@example.com password cmd start
drone-mobile-demo user@example.com password cmd lock
drone-mobile-demo user@example.com password cmd unlock
drone-mobile-demo user@example.com password cmd stop

# Use verbose logging
drone-mobile-demo -v user@example.com password status

📚 API Reference

DroneMobileClient

Main client for interacting with the DroneMobile API.

Methods

  • get_vehicles() -> List[Vehicle] - Get all vehicles
  • get_vehicle(vehicle_id: str) -> Vehicle - Get specific vehicle
  • get_vehicle_status(vehicle_id: str) -> VehicleStatus - Get vehicle status
  • send_command(device_key: str, command: str) -> CommandResponse - Send command

Vehicle

Represents a vehicle with control methods.

Properties

  • vehicle_id: str - Unique vehicle identifier
  • device_key: str - Device key for commands
  • name: str - Vehicle name
  • info: VehicleInfo - Detailed vehicle information

Methods

  • get_status() -> VehicleStatus - Get current status
  • start() -> CommandResponse - Start engine
  • stop() -> CommandResponse - Stop engine
  • lock() -> CommandResponse - Lock doors
  • unlock() -> CommandResponse - Unlock doors
  • trunk() -> CommandResponse - Open trunk
  • panic_on() -> CommandResponse - Activate panic
  • panic_off() -> CommandResponse - Deactivate panic
  • aux1() -> CommandResponse - Trigger auxiliary 1
  • aux2() -> CommandResponse - Trigger auxiliary 2
  • get_location() -> CommandResponse - Get GPS location

Data Models

VehicleStatus

@dataclass
class VehicleStatus:
    vehicle_id: str
    device_key: str
    is_running: bool
    is_locked: bool
    battery_voltage: Optional[float]
    battery_percent: Optional[int]
    odometer: Optional[float]
    fuel_level: Optional[int]
    interior_temperature: Optional[float]
    exterior_temperature: Optional[float]
    location: Optional[Location]
    last_updated: Optional[datetime]
    raw_data: Dict[str, Any]

VehicleInfo

@dataclass
class VehicleInfo:
    vehicle_id: str
    device_key: str
    name: str
    make: Optional[str]
    model: Optional[str]
    year: Optional[int]
    color: Optional[str]
    vin: Optional[str]
    raw_data: Dict[str, Any]

🔒 Security

  • Tokens are stored securely in ~/.config/drone_mobile/ with restrictive permissions (0600)
  • Sensitive data is never logged
  • Automatic token refresh prevents credential exposure

🧪 Development

Setup Development Environment

# Clone the repository
git clone https://github.com/bjhiltbrand/drone_mobile_python.git
cd drone_mobile_python

# Install with development dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=drone_mobile --cov-report=html

# Run specific test file
pytest tests/test_auth.py

Code Quality

# Format code
black drone_mobile/ tests/

# Lint
ruff check drone_mobile/

# Type check
mypy drone_mobile/

# Run all checks
make format lint type-check test

📝 Migration from 0.2.x

If you're upgrading from version 0.2.x, see CHANGELOG.md for a detailed migration guide.

Quick changes:

  • Import DroneMobileClient instead of Vehicle
  • Use get_vehicles() instead of getAllVehicles()
  • Methods now return typed objects instead of raw dicts
  • Token storage moved to ~/.config/drone_mobile/

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Run the test suite
  5. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE.md file for details.

🙏 Acknowledgments

  • Original API reverse engineering by the community
  • Thanks to all contributors

📮 Support

⚖️ Legal

This is an unofficial API wrapper and is not affiliated with, endorsed by, or connected to DroneMobile, Firstech, or Compustar in any way.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drone_mobile-0.3.4.tar.gz (30.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drone_mobile-0.3.4-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file drone_mobile-0.3.4.tar.gz.

File metadata

  • Download URL: drone_mobile-0.3.4.tar.gz
  • Upload date:
  • Size: 30.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for drone_mobile-0.3.4.tar.gz
Algorithm Hash digest
SHA256 89e31fc729449bb3cc30ee6843a1fc5f2f86abc33594f8b62772c3e228850f97
MD5 486023553a9354959f1e9c0092e32c09
BLAKE2b-256 3c6cf2a6e169c84fac464618a45291048a9c8dc78fe13e535f1581becfc2e63d

See more details on using hashes here.

File details

Details for the file drone_mobile-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: drone_mobile-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for drone_mobile-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9820447707f36a0dc123efdeceabf247f7082992ef889eb7df8ab63c36872b92
MD5 091cc49b192444776a1ff7a015be7a9c
BLAKE2b-256 93bbf39251ab546982c88bf1ad2badfe82f015591673380cd9139c25f5e49de2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page