# LocalSolarWatt
A python3 library to access the data of solar watt devices via local api
Disclaimer: This library uses an unofficial local api and could therefore break at any point
# Overview
The package uses the kiwigrid api provided by your solar watt energy manager device.
Data available:
- Real time power values from inverter, AC sensor and battery (if exists)
- Long term energy statistics
This library does some preprocessing by extracting relevant fields and grouping them by device class.
For now this mostly includes data I deem usefully for the integration with home assistant.
Note: Polling the energy manager with a very high interval often could lead to reliability issues (untested).
# Supported devices
As I only have access to one installation and the api is as far as I'm aware not documented by SolarWatt, I can not guarantee that this library works with your setup.
If you encounter issues with your concrete setup, feel free to open a new issue.
The raw json data is available via `http://YOUR_DEVICE_IP/rest/kiwigrid/wizard/devices`
If you can provide the raw json dump, I can try to add support for your device.
**Important Note**: This data does contain some sensitive information (especially for the "Location" device), so make sure to remove any sensitive data before sharing.
## Installation
```
pip install LocalSolarWatt
```
## Usage
```
from local_solar_watt import Api, WorkUnits, DeviceClass
# create a new api objects
energy_api = Api('hostname or ip')
# optional, change work units to Wh instead of kWh
api = Api('hostname or ip', work_unit=WorkUnits.Wh)
# optional, change log level
api.set_log_level('WARNING')
# test the connection (returns bool based on success)
status, data = api.test_connection()
# pull data from the device (returns only selected power values, grouped by device class)
print(api.pull_data())
# You can also pull the raw json data for your own parsing needs
print(api.pull_raw())
```
# Tests:
If you want to run the tests locally make sure to set the following environment variables to correct IPs / hostnames
```
ENERGY_MANAGER_HOST
```
Raw data
{
"_id": null,
"home_page": "https://github.com/AlgorithmicEntropy/SolarWattEnergyManagerAPI",
"name": "LocalSolarWatt",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "IOT, Solar, Local",
"author": "AlgorithmicEntropy",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/fe/43/d468e61d22e8cb9aa04d55fe20518c8c75d2f066608baf7d223ddf1f205b/LocalSolarWatt-0.7.tar.gz",
"platform": null,
"description": "# LocalSolarWatt\nA python3 library to access the data of solar watt devices via local api \nDisclaimer: This library uses an unofficial local api and could therefore break at any point\n\n# Overview\nThe package uses the kiwigrid api provided by your solar watt energy manager device. \nData available:\n - Real time power values from inverter, AC sensor and battery (if exists)\n - Long term energy statistics\n\nThis library does some preprocessing by extracting relevant fields and grouping them by device class. \nFor now this mostly includes data I deem usefully for the integration with home assistant.\n\nNote: Polling the energy manager with a very high interval often could lead to reliability issues (untested).\n\n# Supported devices\nAs I only have access to one installation and the api is as far as I'm aware not documented by SolarWatt, I can not guarantee that this library works with your setup. \nIf you encounter issues with your concrete setup, feel free to open a new issue. \nThe raw json data is available via `http://YOUR_DEVICE_IP/rest/kiwigrid/wizard/devices` \nIf you can provide the raw json dump, I can try to add support for your device. \n**Important Note**: This data does contain some sensitive information (especially for the \"Location\" device), so make sure to remove any sensitive data before sharing.\n\n## Installation\n\n```\npip install LocalSolarWatt\n```\n\n## Usage\n```\nfrom local_solar_watt import Api, WorkUnits, DeviceClass\n\n# create a new api objects\nenergy_api = Api('hostname or ip')\n\n# optional, change work units to Wh instead of kWh\napi = Api('hostname or ip', work_unit=WorkUnits.Wh)\n\n# optional, change log level\napi.set_log_level('WARNING')\n\n# test the connection (returns bool based on success)\nstatus, data = api.test_connection()\n\n# pull data from the device (returns only selected power values, grouped by device class)\nprint(api.pull_data())\n\n# You can also pull the raw json data for your own parsing needs\nprint(api.pull_raw())\n```\n\n# Tests:\nIf you want to run the tests locally make sure to set the following environment variables to correct IPs / hostnames\n```\nENERGY_MANAGER_HOST\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "python api wrapper for solar watt device api",
"version": "0.7",
"project_urls": {
"Download": "https://github.com/SebastianWallat/SolarWattEnergyManagerAPI/archive/v_070.tar.gz",
"Homepage": "https://github.com/AlgorithmicEntropy/SolarWattEnergyManagerAPI"
},
"split_keywords": [
"iot",
" solar",
" local"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0d853d73929f07b9ee905da3eaa13cd4f7cae036e9905d41a996aa1bb5e89565",
"md5": "04a6e32265a9541ce6f2fa2e57d2cd97",
"sha256": "910f96cea19165f49bfe7315f72374e9429be59025f536bb647d46019d8d477f"
},
"downloads": -1,
"filename": "LocalSolarWatt-0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "04a6e32265a9541ce6f2fa2e57d2cd97",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7223,
"upload_time": "2024-04-07T14:17:30",
"upload_time_iso_8601": "2024-04-07T14:17:30.451451Z",
"url": "https://files.pythonhosted.org/packages/0d/85/3d73929f07b9ee905da3eaa13cd4f7cae036e9905d41a996aa1bb5e89565/LocalSolarWatt-0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fe43d468e61d22e8cb9aa04d55fe20518c8c75d2f066608baf7d223ddf1f205b",
"md5": "9ad95aea9efb8065ea3e8a0e9a7daa29",
"sha256": "38c53db84b9b4d616602c3f4261b3e1ab7e47fbd97d7001aa94e05f5444a4f4f"
},
"downloads": -1,
"filename": "LocalSolarWatt-0.7.tar.gz",
"has_sig": false,
"md5_digest": "9ad95aea9efb8065ea3e8a0e9a7daa29",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6094,
"upload_time": "2024-04-07T14:17:31",
"upload_time_iso_8601": "2024-04-07T14:17:31.472092Z",
"url": "https://files.pythonhosted.org/packages/fe/43/d468e61d22e8cb9aa04d55fe20518c8c75d2f066608baf7d223ddf1f205b/LocalSolarWatt-0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-07 14:17:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AlgorithmicEntropy",
"github_project": "SolarWattEnergyManagerAPI",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "requests",
"specs": [
[
"==",
"2.31.0"
]
]
}
],
"lcname": "localsolarwatt"
}