Metadata-Version: 2.1
Name: stromnetzgraz
Version: 0.1.8
Summary: Python client library for Stromnetz Graz API
Home-page: https://github.com/dreautall/stromnetzgraz
Author: dreautall
Author-email: michael@online-net.eu
Project-URL: Documentation, https://github.com/dreautall/stromnetzgraz
Project-URL: Bug Reports, https://github.com/dreautall/stromnetzgraz/issues
Project-URL: Source Code, https://github.com/dreautall/stromnetzgraz
Keywords: stromnetz graz,power,api
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyjwt
Requires-Dist: aiohttp
Provides-Extra: dev
Requires-Dist: check-manifest ; extra == 'dev'

# Python client library for Stromnetz Graz API

[![PyPI package](https://img.shields.io/badge/pip%20install-stromnetzgraz-brightgreen)](https://pypi.org/project/stromnetzgraz/) [![version number](https://img.shields.io/pypi/v/stromnetzgraz?color=green&label=version)](https://github.com/dreautall/stromnetzgraz/releases) [![License](https://img.shields.io/github/license/dreautall/stromnetzgraz)](https://github.com/dreautall/stromnetzgraz/blob/main/LICENSE)

This is a simple client library for the (unofficial) [Stromnetz Graz Smart Meter Web API](https://webportal.stromnetz-graz.at/).

Please note that you must be able to login and view data on the portal before this library will work. Please refer to Stromnetz Graz how to set up access to the smart meter statistics. Best results are achieved in the `IME` mode (15 minute reading intervals), however the library can also fall back to `IMS` (daily reading interval). The most recent data available will be the one for the previous day (see also their [FAQ](https://www.stromnetz-graz.at/sgg/stromzaehler/intelligenter-stromzaehler/faqs)).

## Example

```python
from sngraz import StromNetzGraz

sn = StromNetzGraz(mail, password)
await sn.authenticate()
await sn.update_info()

for installation in sn.get_installations():
    print("Installation ID", installation._installation_id)
    print("Installation is installed at", installation._address)
    for meter in installation.get_meters():
        print("Meter ID", meter.id)
        print("Meter Name", meter._short_name)
        await meter.fetch_consumption_data()

        # meter._data now contains the meter readings of the last 30 days
        print(meter._data)

await sn.close_connection()
```

*The example needs to run in an async context, please see [issue #6](https://github.com/dreautall/stromnetzgraz/issues/6) for an example if you want to run it standalone.*

An `installation` is usually an house or apartment with an individual address and may contain multiple meters (for example a second meter for a hot water boiler). A `meter` is the actual single meter.

Stromnetz Graz assigns individual numerical IDs to both `installation`s and `meter`s. The usually used meter number (33 characters usually starting with `AT00`) is available as attributes (`meter._name` & `meter._short_name`).

## Home Assistant Integration

This library is used in my Home Assistant Custom Component [ha-stromnetzgraz](https://github.com/dreautall/ha-stromnetzgraz), available via HACS. It allows you to have your Smart Meter readings inside Home Assistant! See the [ha-stromnetzgraz repository](https://github.com/dreautall/ha-stromnetzgraz) for more details.
