# 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/94/fb/dea98516a6ae8051fd5eb29767deb17cb631c4d9eda882cdf5792bddd084/localsolarwatt-0.7.1.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.1",
"project_urls": {
"Download": "https://github.com/SebastianWallat/SolarWattEnergyManagerAPI/archive/v_071.tar.gz",
"Homepage": "https://github.com/AlgorithmicEntropy/SolarWattEnergyManagerAPI"
},
"split_keywords": [
"iot",
" solar",
" local"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c925e0e56fd68306375494ac03610d8f61043748b746c7d33d7ab744c74158c7",
"md5": "74b4c03b2cfe534301a56d8771a79198",
"sha256": "48a9187be93854bc0edee12ffea8f36035993ae316fbb20712f1a668aecfe60a"
},
"downloads": -1,
"filename": "LocalSolarWatt-0.7.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "74b4c03b2cfe534301a56d8771a79198",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7296,
"upload_time": "2024-08-24T10:45:27",
"upload_time_iso_8601": "2024-08-24T10:45:27.535226Z",
"url": "https://files.pythonhosted.org/packages/c9/25/e0e56fd68306375494ac03610d8f61043748b746c7d33d7ab744c74158c7/LocalSolarWatt-0.7.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "94fbdea98516a6ae8051fd5eb29767deb17cb631c4d9eda882cdf5792bddd084",
"md5": "ce9711292234f0a32da565da81b2e86e",
"sha256": "cbde1412b8ff325c58e52478a3bd425fdc991a18274ef3d6e1b84708d86e5334"
},
"downloads": -1,
"filename": "localsolarwatt-0.7.1.tar.gz",
"has_sig": false,
"md5_digest": "ce9711292234f0a32da565da81b2e86e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6138,
"upload_time": "2024-08-24T10:45:29",
"upload_time_iso_8601": "2024-08-24T10:45:29.511788Z",
"url": "https://files.pythonhosted.org/packages/94/fb/dea98516a6ae8051fd5eb29767deb17cb631c4d9eda882cdf5792bddd084/localsolarwatt-0.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-24 10:45:29",
"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"
}