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
- Vue UI: http://localhost:5173 (with hot reload)
- FastAPI: http://localhost:8000
Production Mode
# Build frontend and run production server
python build.py
python dev.py prod
- Production server: http://localhost:8000
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
- Vue builds optimized production files
- Files are automatically placed in
peloterm/web/static/ - FastAPI serves the built files
- 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 installfor 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:
- Run
peloterm start - See the list of devices it's waiting for
- Turn on your heart rate monitor, cadence sensor, and trainer
- Watch as each device connects in real-time
- Start your workout once all devices are connected!
- 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:
- ๐พ Save this ride as a FIT file? - Save your ride data
- ๐ Enter a name for your ride - Optional custom name
- ๐ด Upload this ride to Strava? - Direct upload to Strava
- 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:
- Creating a Strava API application
- Authorizing Peloterm to upload activities
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf31e8d97ca957e325a3bca60dd6c3456a94fc7b79b663d9dd1d4807ea1a0628
|
|
| MD5 |
284b44666765dc944061590d1d04b8ff
|
|
| BLAKE2b-256 |
da252bd2da98a955a4f7803811c7030c5fbb2a523b4af327db446503cae5c2b3
|
Provenance
The following attestation bundles were made for peloterm-0.1.1.tar.gz:
Publisher:
publish.yml on amarder/peloterm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
peloterm-0.1.1.tar.gz -
Subject digest:
cf31e8d97ca957e325a3bca60dd6c3456a94fc7b79b663d9dd1d4807ea1a0628 - Sigstore transparency entry: 220006986
- Sigstore integration time:
-
Permalink:
amarder/peloterm@6fecc9269622d683de7a8226c8266633316e9df5 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/amarder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6fecc9269622d683de7a8226c8266633316e9df5 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e04572bd9367a3c5a11d2a2fc1814ffdb77f68b972e2e7882fd67e0461f0f3b7
|
|
| MD5 |
2980ecd3fd03a4200a820ef4a1f696a5
|
|
| BLAKE2b-256 |
8d7bf81b2c3dd59e63de59a3e8664d4dc0df10a555dc3ba083c51fd21385a1fa
|
Provenance
The following attestation bundles were made for peloterm-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on amarder/peloterm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
peloterm-0.1.1-py3-none-any.whl -
Subject digest:
e04572bd9367a3c5a11d2a2fc1814ffdb77f68b972e2e7882fd67e0461f0f3b7 - Sigstore transparency entry: 220006990
- Sigstore integration time:
-
Permalink:
amarder/peloterm@6fecc9269622d683de7a8226c8266633316e9df5 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/amarder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6fecc9269622d683de7a8226c8266633316e9df5 -
Trigger Event:
push
-
Statement type: