### README.md
# Growatt API
A Python wrapper for the Growatt API, allowing you to interact with Growatt's services.
## Installation
```bash
pip install growatt-api
```
## Usage
### Initialization and Login
First, create an instance of the `Growatt` class and log in using your Growatt credentials.
```python
from growatt import Growatt
api = Growatt()
api.login("your_email@example.com", "your_password")
```
### Fetching Plants
Retrieve the first plant and get the id.
```python
plant_list = api.get_plants()[0]["id"]
print(plant_list)
```
### Fetching Specific Plant
Get detailed information about a specific plant.
```python
plant_id = "plant_id"
plant_topic = api.get_plant(plant_id)
print(plant_topic)
```
## Quick Demo
Here's a quick demo showing how to use the Growatt API wrapper.
```python
from growatt import Growatt
api = Growatt()
api.login("user@example.com", "pass123")
plantId = api.get_plants()[0]["id"]
print(f"Plant ID: {plantId}")
plant = api.get_plant(plantId)
print(plant)
mixSn = api.get_mix_ids(plantId)[0][1]
print(mixSn)
mixTotal = api.get_mix_total(plantId, mixSn)
print(mixTotal)
mixStatus = api.get_mix_status(plantId, mixSn)
pprint(mixStatus)
```
## Fetching periodic data
To fetch periodic data such as daily, monthly, yearly or total, you can use the following functions.
### Daily
```python
api.get_energy_stats_yearly("2024-08-06",1234567,"ODCUTJF8IFP")
```
### Monthly
```python
api.get_energy_stats_yearly("2024-08",1234567,"ODCUTJF8IFP")
```
### Yearly
```python
api.get_energy_stats_yearly("2024",1234567,"ODCUTJF8IFP")
```
## Battery weekly data
Battery information is in a weekly format.
```python
api.get_weekly_battery_stats(1234567,"ODCUTJF8IFP")
```
### License
This project is licensed under the MIT License. See the LICENSE file for more details.
Raw data
{
"_id": null,
"home_page": "https://github.com/brandonbondig/growatt",
"name": "growatt-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Brandon Bondig",
"author_email": "brandon@bondig.dk",
"download_url": "https://files.pythonhosted.org/packages/01/c9/dea545ffd061fa46fb0933cd7f4ead8fc3e705528fb1e746be38871dca89/growatt_api-0.1.4.tar.gz",
"platform": null,
"description": "### README.md\n\n# Growatt API\n\nA Python wrapper for the Growatt API, allowing you to interact with Growatt's services.\n\n## Installation\n\n```bash\npip install growatt-api\n```\n\n## Usage\n\n### Initialization and Login\n\nFirst, create an instance of the `Growatt` class and log in using your Growatt credentials.\n\n```python\nfrom growatt import Growatt\n\napi = Growatt()\napi.login(\"your_email@example.com\", \"your_password\")\n```\n\n### Fetching Plants\n\nRetrieve the first plant and get the id.\n\n```python\nplant_list = api.get_plants()[0][\"id\"]\nprint(plant_list)\n```\n\n### Fetching Specific Plant\n\nGet detailed information about a specific plant.\n\n```python\nplant_id = \"plant_id\"\nplant_topic = api.get_plant(plant_id)\nprint(plant_topic)\n```\n\n## Quick Demo\n\nHere's a quick demo showing how to use the Growatt API wrapper.\n\n```python\nfrom growatt import Growatt\n\napi = Growatt()\n\napi.login(\"user@example.com\", \"pass123\")\n\nplantId = api.get_plants()[0][\"id\"]\nprint(f\"Plant ID: {plantId}\")\n\nplant = api.get_plant(plantId)\nprint(plant)\n\nmixSn = api.get_mix_ids(plantId)[0][1]\nprint(mixSn)\n\nmixTotal = api.get_mix_total(plantId, mixSn)\nprint(mixTotal)\n\nmixStatus = api.get_mix_status(plantId, mixSn)\npprint(mixStatus)\n```\n\n## Fetching periodic data\n\nTo fetch periodic data such as daily, monthly, yearly or total, you can use the following functions.\n\n### Daily\n```python\napi.get_energy_stats_yearly(\"2024-08-06\",1234567,\"ODCUTJF8IFP\")\n```\n### Monthly\n```python\napi.get_energy_stats_yearly(\"2024-08\",1234567,\"ODCUTJF8IFP\")\n```\n### Yearly\n```python\napi.get_energy_stats_yearly(\"2024\",1234567,\"ODCUTJF8IFP\")\n```\n\n## Battery weekly data\nBattery information is in a weekly format.\n\n```python\napi.get_weekly_battery_stats(1234567,\"ODCUTJF8IFP\")\n```\n\n### License\n\nThis project is licensed under the MIT License. See the LICENSE file for more details.\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python wrapper for Growatt API",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/brandonbondig/growatt"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8c19ac1a2d3c77f9605803f8a3e6d5139087130a5f2a628b184589c43d2d609a",
"md5": "e6ed30d76478ff29d237f22396f0e156",
"sha256": "7518dc93b0dc200f08b1f7a8b2bfbc0902a30d0ad155913f7707c05765a9cbfa"
},
"downloads": -1,
"filename": "growatt_api-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e6ed30d76478ff29d237f22396f0e156",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4735,
"upload_time": "2024-08-06T16:39:32",
"upload_time_iso_8601": "2024-08-06T16:39:32.025745Z",
"url": "https://files.pythonhosted.org/packages/8c/19/ac1a2d3c77f9605803f8a3e6d5139087130a5f2a628b184589c43d2d609a/growatt_api-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "01c9dea545ffd061fa46fb0933cd7f4ead8fc3e705528fb1e746be38871dca89",
"md5": "c66b67cd5ad66babc94b1d4fecf57fa2",
"sha256": "a95b478696ce2a55de34a242fa7acd1e6edf24e39439bcc0a21334bfd114cd27"
},
"downloads": -1,
"filename": "growatt_api-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "c66b67cd5ad66babc94b1d4fecf57fa2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4557,
"upload_time": "2024-08-06T16:39:33",
"upload_time_iso_8601": "2024-08-06T16:39:33.454847Z",
"url": "https://files.pythonhosted.org/packages/01/c9/dea545ffd061fa46fb0933cd7f4ead8fc3e705528fb1e746be38871dca89/growatt_api-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-06 16:39:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "brandonbondig",
"github_project": "growatt",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "growatt-api"
}