Skip to main content

A terminal-based cycling metrics visualization tool

Project description

Peloterm

A terminal-based cycling metrics visualization tool with a modern web interface.

๐Ÿ“ Project Structure

bike/
โ”œโ”€โ”€ peloterm/              # Python package
โ”‚   โ”œโ”€โ”€ web/
โ”‚   โ”‚   โ”œโ”€โ”€ static/        # Built Vue files (auto-generated)
โ”‚   โ”‚   โ””โ”€โ”€ server.py      # FastAPI backend
โ”‚   โ”œโ”€โ”€ devices/           # Bluetooth device handlers
โ”‚   โ”œโ”€โ”€ cli.py             # Terminal interface
โ”‚   โ””โ”€โ”€ ...                # Other Python modules
โ”œโ”€โ”€ frontend/              # Vue 3 web interface
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/    # Vue components
โ”‚   โ”‚   โ”œโ”€โ”€ composables/   # Reusable logic
โ”‚   โ”‚   โ””โ”€โ”€ types/         # TypeScript definitions
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ vite.config.ts
โ”œโ”€โ”€ build.py               # Build frontend โ†’ Python package
โ”œโ”€โ”€ dev.py                 # Development server runner
โ””โ”€โ”€ pyproject.toml         # Python package configuration

๐Ÿš€ Quick Start

Development Mode (Hot Reload)

# Run both Vue dev server + FastAPI backend
python dev.py

Production Mode

# Build frontend and run production server
python build.py
python dev.py prod

Frontend Only

cd frontend
npm install
npm run dev

๐Ÿ›  Development Workflow

1. Frontend Development

# Terminal 1: Run backend
python -m peloterm.web.server

# Terminal 2: Run frontend with proxy
cd frontend
npm run dev

2. Building for Production

# Build frontend into Python package
python build.py

# Verify build
python dev.py prod

3. One-Command Development

# Runs both servers together
python dev.py

๐Ÿ— Architecture

Backend (Python)

  • FastAPI web server with WebSocket support
  • Bluetooth device communication
  • Real-time metrics processing
  • Configuration management

Frontend (Vue 3)

  • Component-based architecture
  • TypeScript for type safety
  • Chart.js for real-time visualizations
  • Responsive design
  • Hot reload development

Build Process

  1. Vue builds optimized production files
  2. Files are automatically placed in peloterm/web/static/
  3. FastAPI serves the built files
  4. Single Python command runs everything

๐Ÿ“ฆ Distribution

The build process creates a self-contained Python package:

  • All frontend assets bundled into the package
  • No separate frontend server needed in production
  • Single pip install for end users

๐ŸŽฏ Features

  • Real-time Metrics: Power, speed, cadence, heart rate
  • Interactive Charts: Historical data visualization
  • Responsive Design: Works on desktop and mobile
  • Resizable Panels: Customizable layout
  • Dark Theme: Easy on the eyes
  • WebSocket Updates: Low-latency data streaming

๐Ÿ”ง Configuration

Configure iframe URL and metrics in the web interface or via config files.

๐Ÿ“ฑ Web Interface

The Vue frontend provides:

  • Real-time cycling metrics display
  • Interactive Chart.js visualizations
  • Resizable video panel
  • Mobile-responsive design
  • Dark theme matching terminal aesthetic

๐Ÿงช Testing

# Frontend tests
cd frontend
npm run test:unit

# Python tests
pytest

๐Ÿ“ˆ Performance

  • Optimized builds with Vite
  • Tree-shaking removes unused code
  • Asset optimization and caching
  • Efficient reactivity with Vue 3

Features

  • Real-time BLE sensor connection with concurrent device scanning
  • Modern web-based UI with configurable video integration (YouTube by default)
  • Support for multiple sensor types
  • Easy-to-use command line interface
  • Automatic device reconnection if connection is lost
  • Smart listening mode that waits for you to turn on devices - no more timing issues!
  • Automatic ride recording with FIT file generation
  • Interactive Strava upload during shutdown

Installation

pip install peloterm

Usage

First, scan for available Bluetooth sensors in your area:

peloterm scan

This will show all available BLE devices and help you set up your configuration file with the correct sensor IDs.

Starting Your Session

peloterm start

Perfect for devices that auto-sleep quickly! By default, peloterm now uses smart listening mode:

  • Shows you which devices it's waiting for
  • Lets you turn on your devices when you're ready
  • Connects to all devices concurrently as they become available
  • Automatically starts monitoring once all devices are connected
  • Records your ride data automatically

Example workflow:

  1. Run peloterm start
  2. See the list of devices it's waiting for
  3. Turn on your heart rate monitor, cadence sensor, and trainer
  4. Watch as each device connects in real-time
  5. Start your workout once all devices are connected!
  6. Press Ctrl+C when done - you'll be prompted to save and upload your ride

Recording and Strava Integration

When you stop Peloterm (Ctrl+C), you'll be prompted with:

  1. ๐Ÿ’พ Save this ride as a FIT file? - Save your ride data
  2. ๐Ÿ“ Enter a name for your ride - Optional custom name
  3. ๐Ÿšด Upload this ride to Strava? - Direct upload to Strava
  4. Activity details - Name and description for Strava

If Strava isn't set up yet, you'll be guided through the setup process automatically.

Strava Setup (Optional)

To set up Strava integration ahead of time:

peloterm strava setup

This will guide you through:

  1. Creating a Strava API application
  2. Authorizing Peloterm to upload activities
  3. Storing your credentials securely

Other Strava Commands

# Test your Strava connection
peloterm strava test

# List all recorded rides
peloterm strava list

# Upload a specific ride file
peloterm strava upload ride_file.fit --name "Epic Mountain Climb"

Command Options

The start command supports these options:

  • --config PATH - Use a specific configuration file
  • --timeout 60 - Set connection timeout in seconds (default: 60)
  • --debug - Enable debug output
  • --web/--no-web - Enable/disable web UI (default: enabled)
  • --port 8000 - Set web server port
  • --duration 30 - Set target ride duration in minutes
  • --no-recording - Disable automatic ride recording

Examples:

# Standard ride with recording
peloterm start

# Disable recording (monitoring only)
peloterm start --no-recording

# Use debug mode to troubleshoot connections
peloterm start --debug

# Listen for devices with 2-minute timeout
peloterm start --timeout 120

File Formats

When recording rides, Peloterm generates FIT files which are:

  • โœ… Compact: Binary format, much smaller than TCX/GPX
  • โœ… Complete: Supports all cycling metrics (power, cadence, heart rate, speed)
  • โœ… Compatible: Native format for Garmin devices and widely supported
  • โœ… Strava-optimized: Best format for uploading to Strava

FIT files are saved to ~/.peloterm/rides/ and can be uploaded to Strava or imported into other cycling apps.

Development

To set up the development environment:

# Clone the repository
git clone https://github.com/yourusername/peloterm.git
cd peloterm

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

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

Running Tests

To run the test suite:

pytest

References

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

peloterm-0.1.1.tar.gz (142.0 kB view details)

Uploaded Source

Built Distribution

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

peloterm-0.1.1-py3-none-any.whl (260.3 kB view details)

Uploaded Python 3

File details

Details for the file peloterm-0.1.1.tar.gz.

File metadata

  • Download URL: peloterm-0.1.1.tar.gz
  • Upload date:
  • Size: 142.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for peloterm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cf31e8d97ca957e325a3bca60dd6c3456a94fc7b79b663d9dd1d4807ea1a0628
MD5 284b44666765dc944061590d1d04b8ff
BLAKE2b-256 da252bd2da98a955a4f7803811c7030c5fbb2a523b4af327db446503cae5c2b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for peloterm-0.1.1.tar.gz:

Publisher: publish.yml on amarder/peloterm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file peloterm-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: peloterm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 260.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for peloterm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e04572bd9367a3c5a11d2a2fc1814ffdb77f68b972e2e7882fd67e0461f0f3b7
MD5 2980ecd3fd03a4200a820ef4a1f696a5
BLAKE2b-256 8d7bf81b2c3dd59e63de59a3e8664d4dc0df10a555dc3ba083c51fd21385a1fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for peloterm-0.1.1-py3-none-any.whl:

Publisher: publish.yml on amarder/peloterm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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