Skip to content

Commit

Permalink
Merge 74ccecf into 37a9457
Browse files Browse the repository at this point in the history
  • Loading branch information
drc38 committed Jan 27, 2023
2 parents 37a9457 + 74ccecf commit 2a8a66b
Show file tree
Hide file tree
Showing 18 changed files with 1,549 additions and 1,274 deletions.
25 changes: 21 additions & 4 deletions README.md
Expand Up @@ -5,12 +5,12 @@
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/PyFronius.svg)
[![PyPI - Status](https://img.shields.io/pypi/status/PyFronius.svg)](https://pypi.org/project/pyfronius/)

A package that connects to a Fronius device in the local network and provides data
that is provided via the JSON API of the Fronius.
A package that can connect to a Fronius device in the local network (provides data
that is provided via the JSON API of the Fronius) or via the cloud Solar Web api.
This includes the grid consumption, grid return, photovoltaic production
and many more details on the status of the local power supply.

## Features
## Local api Features

The package supports the following data provided by Fronius devices:

Expand All @@ -28,12 +28,29 @@ and aims to support as many different device types as possible (Hybrid, GEN24,..
I also know there are better scripts, yet they are not on pypi which is necessary
for using them with [Home Assistant](https://www.home-assistant.io)

## Cloud api Features

- Talks to your Fronius Solar.web PV system via Cloud API
- Automatic retries with exponential backoff
- Optionally pass in a `httpx` client

Although intended as a library a `cloud_example.py` is provided for testing purposes.

To provide authentication for the example is via environment variables, e.g. on nix systems:

```
export ACCESS_KEY_ID=FKIAFEF58CFEFA94486F9C804CF6077A01AB
export ACCESS_KEY_VALUE=47c076bc-23e5-4949-37a6-4bcfcf8d21d6
export PV_SYSTEM_ID=20bb600e-019b-4e03-9df3-a0a900cda689
```

## Contributing

Support may be enhanced based on the official documentation ([V1](https://www.fronius.com/~/downloads/Solar%20Energy/Operating%20Instructions/42%2C0410%2C2012.pdf), [V0](https://www.fronius.com/~/downloads/Solar%20Energy/Operating%20Instructions/42,0410,2011.pdf)).
Support may be enhanced based on the official documentation ([V1](https://www.fronius.com/~/downloads/Solar%20Energy/Operating%20Instructions/42%2C0410%2C2012.pdf), [V0](https://www.fronius.com/~/downloads/Solar%20Energy/Operating%20Instructions/42,0410,2011.pdf), [SW](https://www.fronius.com/~/downloads/Solar%20Energy/User%20Information/SE_UI_API_InterfaceDocumentation_EN.pdf)).
Pull requests are very welcome.

If you own a Fronius device, feel free to provide us with raw data returned
by fetching the API endpoints manually.
Data from systems featuring Ohmpilots and Storages are much welcomed as we
have no data for testing these so far.

34 changes: 34 additions & 0 deletions examples/cloud_example.py
@@ -0,0 +1,34 @@
import asyncio
from pydantic import BaseSettings, SecretStr
from pyfronius.cloud_api import Fronius_Solarweb


class AuthDetails(BaseSettings):
ACCESS_KEY_ID: SecretStr
ACCESS_KEY_VALUE: SecretStr
PV_SYSTEM_ID: str


async def main():
creds = AuthDetails()
fronius = Fronius_Solarweb(
access_key_id=creds.ACCESS_KEY_ID.get_secret_value(),
access_key_value=creds.ACCESS_KEY_VALUE.get_secret_value(),
pv_system_id=creds.PV_SYSTEM_ID,
)

print("Getting PV system meta data for ", creds.PV_SYSTEM_ID)
pv_system_data = await fronius.get_pvsystem_meta_data()
print(pv_system_data)

print("Getting Devices meta data")
devices_data = await fronius.get_devices_meta_data()
print(devices_data)

print("Getting power flow data")
flow_data = await fronius.get_system_flow_data()
print(flow_data)


if __name__ == "__main__":
asyncio.run(main())
File renamed without changes.

0 comments on commit 2a8a66b

Please sign in to comment.