Python library for the ista calista service
Project description
PyCalista-ista
Unofficial async Python library for the Ista Calista service API. This library allows you to interact with your Ista Calista account to retrieve consumption data from heating and water meters using asyncio and aiohttp.
This project is based on ecotrend-ista and adapted for the Calista portal and asynchronous operation.
Features
- Asynchronous: Uses
asyncioandaiohttpfor non-blocking I/O. - Login and session management with automatic cookie handling.
- Retrieve consumption data for heating and water meters.
- Parse Excel reports (
.xls,.xlsx) from Ista Calista usingpandasandopenpyxl. - Support for different meter types (heating, hot water, cold water).
- Automatic handling of session expiration and relogin attempts.
- Data interpolation for missing readings.
- Configurable retries for network requests.
Installation
Requires Python 3.12+
pip install pycalista-ista
This will install the library along with its dependencies (aiohttp, pandas, openpyxl, unidecode, yarl).
Usage
import asyncio
from datetime import date
import aiohttp
from pycalista_ista import PyCalistaIsta, IstaLoginError, IstaConnectionError
async def main():
# It's recommended to reuse aiohttp ClientSession
async with aiohttp.ClientSession() as session:
# Initialize the client, optionally passing the session
client = PyCalistaIsta("your@email.com", "your_password", session=session)
try:
# Login to the service (async)
await client.login()
print("Login successful!")
# Get device history for a date range (async)
start_date = date(2025, 1, 1)
end_date = date(2025, 1, 31)
devices = await client.get_devices_history(start_date, end_date)
print(f"Retrieved data for {len(devices)} devices.")
# Access device data
for serial, device in devices.items():
print("-" * 20)
print(f"Device Serial: {serial}")
print(f"Type: {device.__class__.__name__}")
print(f"Location: {device.location}")
if device.last_reading:
print(f"Last Reading: {device.last_reading.reading} on {device.last_reading.date.date()}")
else:
print("Last Reading: N/A")
# Access full history if needed: device.history
except IstaLoginError as err:
print(f"Login failed: {err}")
except IstaConnectionError as err:
print(f"Connection error: {err}")
except Exception as err:
print(f"An unexpected error occurred: {err}")
# No need to explicitly call client.close() if session is managed externally
# If client created its own session, call await client.close()
if __name__ == "__main__":
asyncio.run(main())
Development
Setup Development Environment
-
Clone the repository:
git clone [https://github.com/herruzo99/pycalista-ista.git](https://github.com/herruzo99/pycalista-ista.git) cd pycalista-ista
-
Create and activate a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # or .venv\Scripts\activate on Windows
-
Install development dependencies:
pip install -e ".[dev]"
This installs the package in editable mode plus dev tools like
pytest,pytest-asyncio,aresponses,black,isort,mypy,ruff. -
Set up pre-commit hooks (optional but recommended):
pre-commit install
Running Tests
The project uses pytest and pytest-asyncio.
# Run all tests
pytest
# Run with coverage report
pytest --cov=pycalista_ista
# Run specific test file
pytest tests/test_virtual_api.py
Tests require mocking external requests, which is handled using aresponses.
Code Style and Linting
- Code is formatted using
black. - Imports are sorted using
isort. - Linting is done using
ruff. - Type checking is done using
mypy.
Run checks manually:
black . --check
isort . --check-only
ruff check .
mypy pycalista_ista tests
Or run pre-commit hooks: pre-commit run --all-files
Contributing
Contributions are welcome! Please follow the guidelines in CONTRIBUTING.md.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/amazing-feature). - Make your changes, ensuring tests pass and coverage is maintained.
- Update documentation if necessary.
- Commit your changes following Conventional Commits.
- Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.
Interact with the Project
Get the Software
- Install from PyPI:
pip install pycalista-ista
- Clone the repository:
git clone [https://github.com/herruzo99/pycalista-ista.git](https://github.com/herruzo99/pycalista-ista.git)
Provide Feedback
Use GitHub Issues and Discussions:
- Bug Reports: Open an issue
- Feature Requests: Submit an enhancement
- Questions: Start a discussion
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 pycalista_ista-0.4.1.tar.gz.
File metadata
- Download URL: pycalista_ista-0.4.1.tar.gz
- Upload date:
- Size: 26.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 |
2108bd07add20abc8f7227fbdd11d150dbba449696fae78db867564e60ef08db
|
|
| MD5 |
30fe898257edb777f8f868834ec96e78
|
|
| BLAKE2b-256 |
20b22034bbe02687870002f2929a8de3168b91969fcfc710b690d3d2268734e1
|
Provenance
The following attestation bundles were made for pycalista_ista-0.4.1.tar.gz:
Publisher:
python-publish.yml on herruzo99/pycalista-ista
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycalista_ista-0.4.1.tar.gz -
Subject digest:
2108bd07add20abc8f7227fbdd11d150dbba449696fae78db867564e60ef08db - Sigstore transparency entry: 195857439
- Sigstore integration time:
-
Permalink:
herruzo99/pycalista-ista@96ddb73c4321c3602fa4c4279e56bfa743aeb655 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/herruzo99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@96ddb73c4321c3602fa4c4279e56bfa743aeb655 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycalista_ista-0.4.1-py3-none-any.whl.
File metadata
- Download URL: pycalista_ista-0.4.1-py3-none-any.whl
- Upload date:
- Size: 28.1 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 |
47661a9b36089ce009f9df4d1fdbe272affabbc9345c349cae224ef19b21fac0
|
|
| MD5 |
5efc61322fe34823b6b8391152c687fe
|
|
| BLAKE2b-256 |
59dbffdec930dfc196aa5d9478aac4e17e676c81b5433ddcc6cc45c88a764a3e
|
Provenance
The following attestation bundles were made for pycalista_ista-0.4.1-py3-none-any.whl:
Publisher:
python-publish.yml on herruzo99/pycalista-ista
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycalista_ista-0.4.1-py3-none-any.whl -
Subject digest:
47661a9b36089ce009f9df4d1fdbe272affabbc9345c349cae224ef19b21fac0 - Sigstore transparency entry: 195857440
- Sigstore integration time:
-
Permalink:
herruzo99/pycalista-ista@96ddb73c4321c3602fa4c4279e56bfa743aeb655 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/herruzo99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@96ddb73c4321c3602fa4c4279e56bfa743aeb655 -
Trigger Event:
release
-
Statement type: