Connector for GridX to fetch live and historical data from your Photovoltaic System
Project description
Gridx Connector
This is not an Official GridX Library
⚠️ Deprecation Notice — Viessmann realm The Viessmann realm was shut down at the end of 2025. The
viessmannOEM is deprecated and will be removed in a future major release. Please switch to eon Home.
Harness the power of your photovoltaic system with the GridboxConnector library. This versatile tool taps into the same REST API as the official dashboard and app, providing you with direct access to your data from the cloud.
Whether you're a developer looking to integrate solar data into your own project, or a power user seeking command-line access, GridboxConnector has you covered.
Take control of your solar data with GridboxConnector, and unlock the full potential of your photovoltaic system.
Supported Realms
| Realm | Status |
|---|---|
| eon Home | ✅ Active |
| Viessmann | ⚠️ Deprecated — shut down end of 2025 |
Installation
pip install gridx-connector
# or with uv
uv add gridx-connector
Usage
Use your login credentials from the app or from https://company.gridx.de/login.
CLI
The gridx command authenticates with your credentials, discovers all energy systems
linked to your account, and prints their current live measurements to stdout as JSON.
usage: gridx [-h] -u USERNAME -p PASSWORD [-o {eon-home}]
options:
-h, --help show this help message and exit
-u, --username Login username (e-mail address from the app)
-p, --password Login password
-o, --oem OEM configuration to use (default: eon-home)
Examples
# Minimal — prints live data for all systems on your account
gridx -u your@email.com -p yourpassword
# Explicit OEM (currently only eon-home is supported)
gridx -u your@email.com -p yourpassword -o eon-home
# Pretty-print with jq
gridx -u your@email.com -p yourpassword | jq .
# Store the result in a file
gridx -u your@email.com -p yourpassword > live.json
What the command does internally
- Loads
eon-home.config.jsonbundled with the package. - Exchanges your credentials for an OAuth2 token via Auth0.
- Calls
GET /systemsto discover all energy systems on your account. - Calls
GET /systems/{id}/livefor each system. - Prints the combined list of measurement dicts as JSON to stdout.
As a library
from gridx_connector import GridboxConnector, SupportedOEM
from importlib.resources import files
import json
config_file = files("gridx_connector").joinpath("config", f"{SupportedOEM.EON_HOME}.config.json")
with open(config_file) as f:
config = json.load(f)
config["login"]["username"] = "your@email.com"
config["login"]["password"] = "yourpassword"
connector = GridboxConnector(config)
# Live data (all systems)
live_data = connector.retrieve_live_data()
# Historical data
historical = connector.retrieve_historical_data(
start="2024-01-01T00:00:00+01:00",
end="2024-01-02T00:00:00+01:00",
resolution="1h", # 15m | 1h | 1d | 1w | 1M
)
Example Output
{
"consumption": 496,
"directConsumption": 413,
"directConsumptionEV": 0,
"directConsumptionHeatPump": 0,
"directConsumptionHeater": 0,
"directConsumptionHousehold": 413,
"directConsumptionRate": 1,
"grid": 83,
"gridMeterReadingNegative": 4318200000,
"gridMeterReadingPositive": 14499360000,
"measuredAt": "2023-08-04T11:29:43Z",
"photovoltaic": 413,
"production": 413,
"selfConsumption": 413,
"selfConsumptionRate": 1,
"selfSufficiencyRate": 0.8326612903225806,
"selfSupply": 413,
"totalConsumption": 496
}
How it works — Getting your data step by step
The diagram below shows the full journey from credentials to measurements.
┌─────────────────────────────────────────────────────────────┐
│ 1. Load config │
│ Read eon-home.config.json (or set USERNAME / PASSWORD │
│ env vars to avoid storing credentials in a file). │
└────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 2. Authenticate (OAuth2 / Auth0) │
│ GridboxConnector calls POST /oauth/token on the login │
│ URL with your credentials and receives an id_token. │
│ The token is refreshed automatically when it expires. │
└────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 3. Discover systems (GET /systems) │
│ The connector fetches all energy systems linked to your │
│ account and stores their UUIDs in connector.gateways. │
└────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 4a. Live data (GET /systems/{id}/live) │
│ Returns the latest snapshot: PV production, grid feed- │
│ in/draw, battery state, household consumption, etc. │
├─────────────────────────────────────────────────────────────┤
│ 4b. Historical data (GET /systems/{id}/historical) │
│ Returns measurements aggregated over a time interval │
│ and a chosen resolution (15m / 1h / 1d / 1w / 1M). │
└─────────────────────────────────────────────────────────────┘
Minimal working example
import json
from importlib.resources import files
from gridx_connector import GridboxConnector, SupportedOEM
# 1. Load config
config_path = files("gridx_connector").joinpath("config", f"{SupportedOEM.EON_HOME}.config.json")
config = json.loads(config_path.read_text())
# Inject credentials (or set USERNAME / PASSWORD env vars instead)
config["login"]["username"] = "your@email.com"
config["login"]["password"] = "yourpassword"
# 2+3. Authenticate and discover systems automatically
connector = GridboxConnector(config)
print("Systems found:", connector.get_gateways())
# 4a. Live snapshot for all systems
for measurement in connector.retrieve_live_data():
print(f"PV: {measurement['photovoltaic']} W "
f"Grid: {measurement['grid']} W "
f"Consumption: {measurement['consumption']} W")
# 4b. Yesterday's data in 1-hour buckets
from datetime import date, timedelta
yesterday = date.today() - timedelta(days=1)
historical = connector.retrieve_historical_data(
start=f"{yesterday}T00:00:00+01:00",
end=f"{yesterday}T23:59:59+01:00",
resolution="1h", # 15m | 1h | 1d | 1w | 1M
)
for entry in historical:
for bucket in entry.get("measurements", []):
print(bucket["measuredAt"], "→", bucket["photovoltaic"], "W")
Credential handling
| Option | How |
|---|---|
| Config file | Set login.username / login.password in eon-home.config.json |
| Environment variables | Export USERNAME=... and PASSWORD=... — these override the config file |
| CLI | Pass -u <user> -p <pass> on the command line |
Discover OAuth config automatically
If you only know your website URL plus username/password, use the helper script to discover
client_id, realm, scope, audience, and the token endpoint from the login page and JS bundles.
# Discovery only (prints candidates as JSON)
python scripts/discover_oauth_config.py --site-url https://eon.gridx.de
# Discovery + token validation + config file output (credentials redacted by default)
python scripts/discover_oauth_config.py \
--site-url https://eon.gridx.de \
-u your@email.com \
-p yourpassword \
--validate \
--output eon.config.json
Notes:
- Add
--include-credentialsto store username/password in the output file. - The generated JSON matches this project's config structure and can be used with
--config.
Examples
Ready-to-run scripts are in the examples/ directory:
| Script | Description |
|---|---|
read_live_data.py |
Poll live data every 60 s |
historical_data.py |
Fetch today's historical data |
openapi_test.py |
Use the low-level gridx_connector_api client directly |
Generated API Client
gridx_connector_api/ is an auto-generated Python client derived directly from
APIDefinition/openapi.json using
openapi-python-client.
The client is regenerated automatically via GitHub Actions whenever openapi.json changes.
To regenerate locally after replacing openapi.json:
uv sync --dev
bash scripts/generate_client.sh
Dependencies
requests— HTTP clientauthlib— OAuth2 authentication
License
MIT
Contributing
If you'd like to contribute to gridx-connector, please follow these steps:
Fork the repository. Create a new branch for your feature or bug fix. Make your changes and write tests if possible. Run tests and ensure they pass. Submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 gridx_connector-3.0.2.tar.gz.
File metadata
- Download URL: gridx_connector-3.0.2.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28aeac8e205a21dfbf5dff76ae79c9bbef4cbca77dece9fdf050249e73362f64
|
|
| MD5 |
1f73d57aeb857ba37e483dbdaf7332a3
|
|
| BLAKE2b-256 |
cb129c643372c6d4cb87b4877b149b4ebf3cde3848d70f9922824f21c7f3ce3b
|
Provenance
The following attestation bundles were made for gridx_connector-3.0.2.tar.gz:
Publisher:
python-publish.yml on unl0ck/gridx-connector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gridx_connector-3.0.2.tar.gz -
Subject digest:
28aeac8e205a21dfbf5dff76ae79c9bbef4cbca77dece9fdf050249e73362f64 - Sigstore transparency entry: 1224822920
- Sigstore integration time:
-
Permalink:
unl0ck/gridx-connector@4f333836d198eab1aa257dd1aea4ca3926dfaa20 -
Branch / Tag:
refs/tags/v3.0.2 - Owner: https://github.com/unl0ck
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4f333836d198eab1aa257dd1aea4ca3926dfaa20 -
Trigger Event:
release
-
Statement type:
File details
Details for the file gridx_connector-3.0.2-py3-none-any.whl.
File metadata
- Download URL: gridx_connector-3.0.2-py3-none-any.whl
- Upload date:
- Size: 1.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
644ae5cf9ad62d57d5d52b164c5300570c34e741a967f7e2596d802d2ab92408
|
|
| MD5 |
0d703131282df3a95662fda6f551ca8e
|
|
| BLAKE2b-256 |
b535ce5b6ea2b06165ad2803ebbe184e342b55c8001c0730de73078f38a55af1
|
Provenance
The following attestation bundles were made for gridx_connector-3.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on unl0ck/gridx-connector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gridx_connector-3.0.2-py3-none-any.whl -
Subject digest:
644ae5cf9ad62d57d5d52b164c5300570c34e741a967f7e2596d802d2ab92408 - Sigstore transparency entry: 1224822995
- Sigstore integration time:
-
Permalink:
unl0ck/gridx-connector@4f333836d198eab1aa257dd1aea4ca3926dfaa20 -
Branch / Tag:
refs/tags/v3.0.2 - Owner: https://github.com/unl0ck
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4f333836d198eab1aa257dd1aea4ca3926dfaa20 -
Trigger Event:
release
-
Statement type: