Skip to main content

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_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

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.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

pyosmanager-0.2.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file pyosmanager-0.2.3.tar.gz.

File metadata

  • Download URL: pyosmanager-0.2.3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyosmanager-0.2.3.tar.gz
Algorithm Hash digest
SHA256 d0b2aa197bbe46c574887f09e2cb352e9832260c39e51e7c62c9f61fd806ec54
MD5 cde2ed14fcffd17de63481c307fc09ef
BLAKE2b-256 76f824daa51177751fa42e99ad79b21a9b143ad2c658dfdb4784fd21a851c4b5

See more details on using hashes here.

File details

Details for the file pyosmanager-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: pyosmanager-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyosmanager-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 63d3b3ea0390799b9007e70dd4c6d5054e8c24ebbb7b417c45a20ea5e40f58d4
MD5 72798c037b63fd6b9d71f126b6cdd7d9
BLAKE2b-256 e2feac0168eb0a24c30f0d7adb61a73ece20d5062a74a760badb2bbebc5c45ab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page