Tigo Python API Wrapper
A modern, open-source Python library for interacting with the Tigo Energy API.
Features
- 🔑 Automatic authentication with credentials from environment
- 📊 Raw API access and convenient DataFrame helpers
- ⚡ Built-in rate limiting and error handling
- 🧪 Well-tested with comprehensive test suite
- 📈 Advanced analytics including system efficiency and panel performance
- 🛡️ Type hints for better development experience
Installation
From PyPI (when published)
pip install tigo_python
From GitHub
pip install git+https://github.com/matt-dreyer/tigo_python.git
Development Installation
git clone https://github.com/matt-dreyer/tigo_python.git
cd tigo-python
pip install -e ".[dev]"
Quick Start
1. Set up credentials
Create a .env file in your project root:
TIGO_USERNAME=your_username
TIGO_PASSWORD=your_password
Or set environment variables:
export TIGO_USERNAME=your_username
export TIGO_PASSWORD=your_password
2. Basic usage
from tigo_python import TigoClient
# Credentials loaded automatically from environment
with TigoClient() as client:
# Get your systems
systems = client.list_systems()
system_id = systems["systems"][0]["system_id"]
# Get current performance
summary = client.get_summary(system_id)
print(f"Current power: {summary['summary']['last_power_dc']} W")
# Get historical data as DataFrame
df = client.get_today_data(system_id)
print(df.head())
3. Advanced analytics
# System efficiency analysis
efficiency = client.calculate_system_efficiency(system_id, days_back=30)
print(f"System efficiency: {efficiency['average_efficiency_percent']:.1f}%")
# Panel performance comparison
panel_perf = client.get_panel_performance(system_id)
print(panel_perf.head())
# Find underperforming panels
problems = client.find_underperforming_panels(system_id, threshold_percent=85)
for panel in problems:
print(f"Panel {panel['panel_id']}: {panel['efficiency_percent']:.1f}% efficiency")
API Coverage
Core Endpoints
- ✅ Authentication - Login/logout with token management
- ✅ Users - User information and preferences
- ✅ Systems - List systems, get details and layouts
- ✅ Sources - Hardware sources and configurations
- ✅ Objects - System components and hierarchy
- ✅ Data - Combined and aggregate data endpoints
- ✅ Alerts - System alerts and notifications
Data Formats
- Raw API responses - Direct JSON from Tigo API
- CSV strings - For integration with other tools
- Pandas DataFrames - For data analysis and visualization
Error Handling
The library provides specific exceptions for different error scenarios:
from tigo_python.exceptions import TigoAPIError, TigoAuthenticationError
try:
client = TigoClient("wrong_user", "wrong_pass")
except TigoAuthenticationError as e:
print(f"Login failed: {e}")
except TigoAPIError as e:
print(f"API error: {e}")
Rate Limiting
The library automatically handles API rate limits by:
- Limiting data requests to safe time ranges (≤20,150 minutes)
- Using appropriate data resolution (minute/hour/day) based on time span
- Providing helpful warnings when requests are adjusted
Development
Setup
git clone https://github.com/matt-dreyer/tigo_python.git
cd tigo-python
pip install -e ".[dev]"
Running Tests
pytest tests/ -v
Code Quality
# Linting
ruff check tigo_python/
# Type checking
mypy tigo_python/
# Formatting
ruff format tigo_python/
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with tests
- Ensure code quality checks pass
- Submit a pull request
Requirements
- Python ≥ 3.8
- httpx ≥ 0.27.0
- pandas ≥ 2.0.0
- numpy ≥ 1.24.0
Acknowledgments
This project is inspired by the Rust tigo client by @mrustl.
License
MIT License - see LICENSE for details.
This library is not affiliated with or endorsed by Tigo Energy.
Metadata
Release files for tigo-python 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tigo_python-0.2.0.tar.gz | 12.5 kB | Without provenance | Details for tigo_python-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tigo_python-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for tigo_python-0.2.0-py3-none-any.whl |
Total release size: 23.9 kB
Release files / tigo_python-0.2.0.tar.gz
| Download URL | tigo_python-0.2.0.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e77e9ee2208fbccbe5ab6e0811c250829ada84a360c9696a8fc22291c2ac0a19
|
|
BLAKE2b-256 checksum How to use checksums |
5615e1aa5e2159ea2d013e4fec5edad205233b093ef40825d598f0f5b43e2655
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / tigo_python-0.2.0-py3-none-any.whl
| Download URL | tigo_python-0.2.0-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d87f12738306815d119da1a014ac9bab33de7c165d0df5942e58a135ecce749a
|
|
BLAKE2b-256 checksum How to use checksums |
9aa88f49bb81b8fe1b9d76fafdd643763151abe169f813f81a5b101c1b4ffe4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for tigo-python 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.