# 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/dreautall/stromnetzgraz",
"name": "stromnetzgraz",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "stromnetz graz,power,api",
"author": "dreautall",
"author_email": "michael@online-net.eu",
"download_url": "https://files.pythonhosted.org/packages/a1/59/dec690cb064d629d52ea932335f91f91416244164aa01bc68f2119d8054b/stromnetzgraz-0.1.8.tar.gz",
"platform": null,
"description": "# Python client library for Stromnetz Graz API\n\n[![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)\n\nThis is a simple client library for the (unofficial) [Stromnetz Graz Smart Meter Web API](https://webportal.stromnetz-graz.at/).\n\nPlease 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)).\n\n## Example\n\n```python\nfrom sngraz import StromNetzGraz\n\nsn = StromNetzGraz(mail, password)\nawait sn.authenticate()\nawait sn.update_info()\n\nfor installation in sn.get_installations():\n print(\"Installation ID\", installation._installation_id)\n print(\"Installation is installed at\", installation._address)\n for meter in installation.get_meters():\n print(\"Meter ID\", meter.id)\n print(\"Meter Name\", meter._short_name)\n await meter.fetch_consumption_data()\n\n # meter._data now contains the meter readings of the last 30 days\n print(meter._data)\n\nawait sn.close_connection()\n```\n\n*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.*\n\nAn `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.\n\nStromnetz 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`).\n\n## Home Assistant Integration\n\nThis 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.\n",
"bugtrack_url": null,
"license": "",
"summary": "Python client library for Stromnetz Graz API",
"version": "0.1.8",
"project_urls": {
"Bug Reports": "https://github.com/dreautall/stromnetzgraz/issues",
"Documentation": "https://github.com/dreautall/stromnetzgraz",
"Homepage": "https://github.com/dreautall/stromnetzgraz",
"Source Code": "https://github.com/dreautall/stromnetzgraz"
},
"split_keywords": [
"stromnetz graz",
"power",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "11377910d51037f08ec49c19c47bb8b26daa4a7193afb0678691ad71b51d9076",
"md5": "3f46842d3a06898f87a0cc31b7440ae7",
"sha256": "155de9cc3488c44e893db2332c79a40167c8b1ee33f272fd77f62424d4707c43"
},
"downloads": -1,
"filename": "stromnetzgraz-0.1.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3f46842d3a06898f87a0cc31b7440ae7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 11523,
"upload_time": "2023-12-30T19:48:43",
"upload_time_iso_8601": "2023-12-30T19:48:43.277429Z",
"url": "https://files.pythonhosted.org/packages/11/37/7910d51037f08ec49c19c47bb8b26daa4a7193afb0678691ad71b51d9076/stromnetzgraz-0.1.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a159dec690cb064d629d52ea932335f91f91416244164aa01bc68f2119d8054b",
"md5": "61242b8118523a3c53bcedbf402a9916",
"sha256": "351a7234c9b06657bd505028a8f2022c3147d5a4dcf58ea17e0eba842a0a231e"
},
"downloads": -1,
"filename": "stromnetzgraz-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "61242b8118523a3c53bcedbf402a9916",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 13277,
"upload_time": "2023-12-30T19:48:44",
"upload_time_iso_8601": "2023-12-30T19:48:44.321899Z",
"url": "https://files.pythonhosted.org/packages/a1/59/dec690cb064d629d52ea932335f91f91416244164aa01bc68f2119d8054b/stromnetzgraz-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-30 19:48:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dreautall",
"github_project": "stromnetzgraz",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "stromnetzgraz"
}