Python client for Open Surplus Manager
Project description
pyOSManager
Python client for Open Surplus Manager
Installation
pip install pyosmanager
Usage
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_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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyosmanager-0.2.1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for pyosmanager-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d0a0d291fbdad83cc5fb63e03a1fa7313a67197f538a1622cbe92b23a36919b |
|
MD5 | 6e44a738a1951fd20b16374b323df7f3 |
|
BLAKE2b-256 | 48b06e92c94b27e5cbe25804a3244013bc20c6fb39fde89f35a24da2282bc78f |