Skip to main content

bond-api

Asynchronous Python wrapper library over Bond Local API

Installation

From PyPi:

pip3 install bond-api

Library Usage

import asyncio

from aiohttp import ClientResponseError, ClientConnectorError

from bond_api import Bond, Action


async def main():
    """Example of library usage."""
    
    bond = Bond("[your ip or hostname here]", "[your bond API token here]")

    try:
        print("Version:")
        print(await bond.version())

        print("Device IDs:")
        device_ids = await bond.devices()
        print(device_ids)

        print("Devices:")
        devices = await asyncio.gather(*[bond.device(device_id) for device_id in device_ids])
        print(devices)

        print("Devices Properties:")
        properties = await asyncio.gather(*[bond.device_properties(device_id) for device_id in device_ids])
        print(properties)

        print("Devices State:")
        state = await asyncio.gather(*[bond.device_state(device_id) for device_id in device_ids])
        print(state)

        print("Turn on fan!")
        await bond.action("[your fan device ID here]", Action.turn_on())

        print("Change fan speed!")
        await bond.action("[your fan device ID here]", Action.set_speed(2))

        print("Turn off fan!")
        await bond.action("[your fan device ID here]", Action.turn_off())
        
    except ClientResponseError as x:
        print("Client response error: ", x)
    except ClientConnectorError as x:
        print("Client connector error: ", x)


if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

Metadata

Release files for bond-api 0.1.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bond-api 0.1.18
File Size Uploaded Provenance Actions
bond_api-0.1.18.tar.gz 8.0 kB Without provenance Details for bond_api-0.1.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bond-api 0.1.18
File Interpreter ABI Platform Actions
bond_api-0.1.18-py3-none-any.whl Python 3 none any Details for bond_api-0.1.18-py3-none-any.whl

Total release size: 16.4 kB

Release files / bond_api-0.1.18.tar.gz

Download URL bond_api-0.1.18.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
406f2ae4bba27e3695c0f0e7f4dab59f263e9ce50986b9fb49cac85de0cc8811
BLAKE2b-256 checksum
How to use checksums
fcb1b926a7b3eccea7749f91592b87209435c49471d4bcd148a4ce414986101b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / bond_api-0.1.18-py3-none-any.whl

Download URL bond_api-0.1.18-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd60e96ad1b1aef98a3a6aa989c50470bef011829cf3e11a6770ce7a135c2c8e
BLAKE2b-256 checksum
How to use checksums
c6a72b3c086aa15b0bb523481054f31354e2ac3ab37f10d38d0cd1af4fa93937
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Security for bond-api 0.1.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page