### Install pywybot via pip Source: https://github.com/bassrock/pywybot/blob/main/README.md Install the pywybot library using pip. ```bash pip install pywybot ``` -------------------------------- ### BLE client with custom BluetoothAdapter Source: https://github.com/bassrock/pywybot/blob/main/README.md Shows how to instantiate WyBotBLEClient with a custom BluetoothAdapter implementation. The adapter must implement the protocol methods shown; Home Assistant provides its own adapter. ```python from wybot import WyBotBLEClient, BluetoothAdapter class MyAdapter: # implements the BluetoothAdapter protocol def scanner_count(self) -> int: ... def discovered_devices(self): ... # -> list[bleak BLEDevice] def device_from_address(self, address): ... # -> BLEDevice | None ble = WyBotBLEClient(MyAdapter()) ``` -------------------------------- ### Cloud HTTP client usage Source: https://github.com/bassrock/pywybot/blob/main/README.md Shows how to authenticate and retrieve device groups using WyBotHTTPClient. Requires aiohttp session; omit to let the client create its own. Raises WybotAuthError for invalid credentials and WybotConnectionError for network failures. ```python import aiohttp from wybot import WyBotHTTPClient, WybotAuthError, WybotConnectionError async with aiohttp.ClientSession() as session: # Pass a session to reuse it (e.g. Home Assistant's shared session); # omit it and the client creates and owns one (call await client.close()). client = WyBotHTTPClient("you@example.com", "password", session=session) try: await client.authenticate() except WybotAuthError: ... # invalid credentials except WybotConnectionError: ... # network/server error groups = await client.get_indexed_current_grouped_devices() ```