Asynchronous library to interact with Iregul systems via undocumented API
Project description
aioiregul
Asynchronous Python library to interact with IRegul systems via their undocumented API over sockets.
Note: This library is under active development.
Features
- 🔄 Fully asynchronous using
asyncioandaiohttp - 🔌 Socket-based communication with IRegul systems
- 🎯 Type-safe with comprehensive type hints
- 📊 Parse and decode IRegul API responses
- 🏠 Home automation integration ready
Requirements
- Python 3.14 or higher
- aiohttp
- BeautifulSoup4
- python-slugify
Installation
uv pip install aioiregul
Or install from source:
git clone https://github.com/PoppyPop/aioiregul.git
cd aioiregul
uv sync --all-extras
Quick Start
import asyncio
import aioiregul
async def main():
# Configure connection options
options = aioiregul.ConnectionOptions(
username='your_username',
password='your_password'
)
# Create device instance
device = aioiregul.Device(options)
# Collect data from the device
data = await device.collect()
# Display results
print(data)
# Run the async function
asyncio.run(main())
Development Setup
Using VS Code Devcontainer (Recommended)
The easiest way to get started with development:
- Install Docker and VS Code
- Install the Remote - Containers extension
- Open the project in VS Code
- Click "Reopen in Container" when prompted
All dependencies and tools will be automatically installed!
Local Development
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh # Linux/Mac
# Or on Windows:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Sync all dependencies
uv sync --all-extras
# Install pre-commit hooks
uv run pre-commit install
Running Tests
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=aioiregul --cov-report=html
# Run specific test
uv run pytest tests/test_iregul.py -v
Code Quality
# Format code
uv run ruff format .
# Lint code
uv run ruff check . --fix
# Type checking
uv run mypy src/
# Run all pre-commit hooks
uv run pre-commit run --all-files
Project Structure
aioiregul/
├── .devcontainer/ # VS Code devcontainer configuration
├── src/
│ └── aioiregul/ # Main library code
├── tests/ # Unit tests
├── examples/ # Example scripts and sample data
├── pyproject.toml # Project configuration
├── CONTRIBUTING.md # Contribution guidelines
└── README.md # This file
API Documentation
ConnectionOptions
Configuration for connecting to IRegul systems.
@dataclass
class ConnectionOptions:
username: str # IRegul account username
password: str # IRegul account password
iregul_base_url: str # Base URL (default: https://vpn.i-regul.com/modules/)
refresh_rate: timedelta # Data refresh interval (default: 5 minutes)
Device
Main class for interacting with IRegul devices.
device = Device(options: ConnectionOptions)
data = await device.collect() # Fetch current device data
IRegulData
Data structure for IRegul measurements.
@dataclass
class IRegulData:
id: str # Data point identifier
name: str # Human-readable name
value: Decimal # Measured value
unit: str # Unit of measurement
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Development Checklist
- Write tests for new features
- Update documentation
- Follow code style guidelines (Ruff, MyPy)
- Add type hints to all functions
- Write docstrings for public APIs
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
This library reverse-engineers the undocumented IRegul API. It is not officially supported by IRegul.
Support
Changelog
See CHANGELOG.md for version history and changes.
Project details
Release history Release notifications | RSS feed
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 aioiregul-0.2.8.tar.gz.
File metadata
- Download URL: aioiregul-0.2.8.tar.gz
- Upload date:
- Size: 135.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1553d0a09139e6add206954311e1ad4dfa80a5f83f403493a5ad0fb8abaa8474
|
|
| MD5 |
6ad25e2ab90dcbb1d45d46fd66c8aba6
|
|
| BLAKE2b-256 |
85526777d2891e53c78a5d3e91b8600caae2451b471917b22a3d065a9e247dc9
|
Provenance
The following attestation bundles were made for aioiregul-0.2.8.tar.gz:
Publisher:
publish-to-test-pypi.yml on PoppyPop/aioiregul
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aioiregul-0.2.8.tar.gz -
Subject digest:
1553d0a09139e6add206954311e1ad4dfa80a5f83f403493a5ad0fb8abaa8474 - Sigstore transparency entry: 1186081211
- Sigstore integration time:
-
Permalink:
PoppyPop/aioiregul@4ad57bf844efd93a361a2ff4c51f28531b3a825e -
Branch / Tag:
refs/tags/v0.2.8 - Owner: https://github.com/PoppyPop
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@4ad57bf844efd93a361a2ff4c51f28531b3a825e -
Trigger Event:
release
-
Statement type:
File details
Details for the file aioiregul-0.2.8-py3-none-any.whl.
File metadata
- Download URL: aioiregul-0.2.8-py3-none-any.whl
- Upload date:
- Size: 39.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f78cc154038103753570b835b88c57669162cbb7a7007a1e3f56dc9c3c0aea0
|
|
| MD5 |
1c34a609f8e2383e1a8b128178311edd
|
|
| BLAKE2b-256 |
5fcc6e8e11196b41c39d582f4ad14fc3a94c507930a3fee9740ee4b7847330cb
|
Provenance
The following attestation bundles were made for aioiregul-0.2.8-py3-none-any.whl:
Publisher:
publish-to-test-pypi.yml on PoppyPop/aioiregul
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aioiregul-0.2.8-py3-none-any.whl -
Subject digest:
1f78cc154038103753570b835b88c57669162cbb7a7007a1e3f56dc9c3c0aea0 - Sigstore transparency entry: 1186081224
- Sigstore integration time:
-
Permalink:
PoppyPop/aioiregul@4ad57bf844efd93a361a2ff4c51f28531b3a825e -
Branch / Tag:
refs/tags/v0.2.8 - Owner: https://github.com/PoppyPop
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@4ad57bf844efd93a361a2ff4c51f28531b3a825e -
Trigger Event:
release
-
Statement type: