pyosmanager


Namepyosmanager JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://github.com/JoseRa9/pyOSManager/
SummaryPython client for Open Surplus Manager
upload_time2024-07-03 15:41:34
maintainerNone
docs_urlNone
authorJose R. Morales
requires_pythonNone
licenseMIT
keywords api open surplus manager api client api wrapper async iot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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/JoseRa9/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/46/7d/728dfec8dcab48cb56e2d89db49e1519d36bf00c814075b4e9ba92a1b9e9/pyosmanager-0.2.2.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.2",
    "project_urls": {
        "Homepage": "https://github.com/JoseRa9/pyOSManager/"
    },
    "split_keywords": [
        "api",
        " open surplus manager",
        " api client",
        " api wrapper",
        " async",
        " iot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0b42645120532069dc39a3d2f14344f25431f640c8617ded2716c39359a38e2f",
                "md5": "595ecd54727cb7f39cf9b206a216838d",
                "sha256": "8233dfe1f62dd07402d7b829d68b4828bd8f8b42d2bfb6aeb960d2d1d8365aa2"
            },
            "downloads": -1,
            "filename": "pyosmanager-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "595ecd54727cb7f39cf9b206a216838d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4942,
            "upload_time": "2024-07-03T15:41:33",
            "upload_time_iso_8601": "2024-07-03T15:41:33.411689Z",
            "url": "https://files.pythonhosted.org/packages/0b/42/645120532069dc39a3d2f14344f25431f640c8617ded2716c39359a38e2f/pyosmanager-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "467d728dfec8dcab48cb56e2d89db49e1519d36bf00c814075b4e9ba92a1b9e9",
                "md5": "8b434e4572b28561321bf38bcf68773b",
                "sha256": "41278cdaf06782a3e9fcda3ddb2416cbee25c7f307580363d15122f448902e76"
            },
            "downloads": -1,
            "filename": "pyosmanager-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8b434e4572b28561321bf38bcf68773b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4266,
            "upload_time": "2024-07-03T15:41:34",
            "upload_time_iso_8601": "2024-07-03T15:41:34.335779Z",
            "url": "https://files.pythonhosted.org/packages/46/7d/728dfec8dcab48cb56e2d89db49e1519d36bf00c814075b4e9ba92a1b9e9/pyosmanager-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-03 15:41:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JoseRa9",
    "github_project": "pyOSManager",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pyosmanager"
}
        
Elapsed time: 0.29409s