# pyOSManager
> Python client for Open Surplus Manager
## Installation
```bash
pip install pyosmanager
```
## Usage
```python
import asyncio
from pyosmanager import OSMClient
from pyosmanager.responses import DeviceResponse
async def main():
async with OSMClient("http://localhost:8080") as client:
res = await client.get_devices()
d: DeviceResponse
for d in res:
print(d.name)
if __name__ == "__main__":
asyncio.run(main())
```
## Methods
- `is_healthy() -> bool`
True if the server is healthy
- `get_core_state() -> dict`
Retrieve the core state
- `get_devices() -> list[DeviceResponse]`
Retrieve a list of devices
- `get_device(device_name: str) -> DeviceResponse`
Retrieve a device data dictionary by name
- `get_device_consumption(device_name: str) -> float`
Retrieve the device consumption by name
- `get_surplus() -> float:`
Retrieve the surplus value
- `set_surplus_margin(margin: float) -> float:`
Set the surplus margin
- `set_grid_margin(margin: float) -> float:`
Set the grid margin
- `set_idle_power(idle_power: float) -> float:`
Set the idle power
- `set_device_max_consumption(device_name: str, max_consumption: float) -> float:`
Set the max consumption for a device
- `set_device_expected_consumption(device_name: str, expected_consumption: float) -> float:`
Set the expected consumption for a device
- `set_device_cooldown(device_name: str, cooldown: int) -> int:`
Set the cooldown for a device
Raw data
{
"_id": null,
"home_page": "https://github.com/JoseRMorales/pyOSManager/",
"name": "pyosmanager",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "API, Open Surplus Manager, API client, API wrapper, async, iot",
"author": "Jose R. Morales",
"author_email": "dev@josermorales.com",
"download_url": "https://files.pythonhosted.org/packages/76/f8/24daa51177751fa42e99ad79b21a9b143ad2c658dfdb4784fd21a851c4b5/pyosmanager-0.2.3.tar.gz",
"platform": null,
"description": "# pyOSManager\n\n> Python client for Open Surplus Manager\n\n## Installation\n\n```bash\npip install pyosmanager\n```\n\n## Usage\n\n```python\nimport asyncio\n\nfrom pyosmanager import OSMClient\nfrom pyosmanager.responses import DeviceResponse\n\n\nasync def main():\n async with OSMClient(\"http://localhost:8080\") as client:\n res = await client.get_devices()\n d: DeviceResponse\n for d in res:\n print(d.name)\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n\n```\n\n## Methods\n\n- `is_healthy() -> bool`\n\nTrue if the server is healthy\n\n- `get_core_state() -> dict`\n\nRetrieve the core state\n\n- `get_devices() -> list[DeviceResponse]`\n\nRetrieve a list of devices\n\n- `get_device(device_name: str) -> DeviceResponse`\n \nRetrieve a device data dictionary by name\n\n- `get_device_consumption(device_name: str) -> float`\n \nRetrieve the device consumption by name\n\n- `get_surplus() -> float:`\n\nRetrieve the surplus value\n\n- `set_surplus_margin(margin: float) -> float:`\n \nSet the surplus margin\n\n- `set_grid_margin(margin: float) -> float:`\n\nSet the grid margin\n\n- `set_idle_power(idle_power: float) -> float:`\n\nSet the idle power\n\n- `set_device_max_consumption(device_name: str, max_consumption: float) -> float:`\n\nSet the max consumption for a device\n\n- `set_device_expected_consumption(device_name: str, expected_consumption: float) -> float:`\n\nSet the expected consumption for a device\n\n- `set_device_cooldown(device_name: str, cooldown: int) -> int:`\n\nSet the cooldown for a device\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python client for Open Surplus Manager",
"version": "0.2.3",
"project_urls": {
"Homepage": "https://github.com/JoseRMorales/pyOSManager/"
},
"split_keywords": [
"api",
" open surplus manager",
" api client",
" api wrapper",
" async",
" iot"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e2feac0168eb0a24c30f0d7adb61a73ece20d5062a74a760badb2bbebc5c45ab",
"md5": "72798c037b63fd6b9d71f126b6cdd7d9",
"sha256": "63d3b3ea0390799b9007e70dd4c6d5054e8c24ebbb7b417c45a20ea5e40f58d4"
},
"downloads": -1,
"filename": "pyosmanager-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "72798c037b63fd6b9d71f126b6cdd7d9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4943,
"upload_time": "2024-10-11T19:19:23",
"upload_time_iso_8601": "2024-10-11T19:19:23.246300Z",
"url": "https://files.pythonhosted.org/packages/e2/fe/ac0168eb0a24c30f0d7adb61a73ece20d5062a74a760badb2bbebc5c45ab/pyosmanager-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "76f824daa51177751fa42e99ad79b21a9b143ad2c658dfdb4784fd21a851c4b5",
"md5": "cde2ed14fcffd17de63481c307fc09ef",
"sha256": "d0b2aa197bbe46c574887f09e2cb352e9832260c39e51e7c62c9f61fd806ec54"
},
"downloads": -1,
"filename": "pyosmanager-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "cde2ed14fcffd17de63481c307fc09ef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4267,
"upload_time": "2024-10-11T19:19:24",
"upload_time_iso_8601": "2024-10-11T19:19:24.128568Z",
"url": "https://files.pythonhosted.org/packages/76/f8/24daa51177751fa42e99ad79b21a9b143ad2c658dfdb4784fd21a851c4b5/pyosmanager-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-11 19:19:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "JoseRMorales",
"github_project": "pyOSManager",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pyosmanager"
}