Metadata-Version: 2.4
Name: ucec
Version: 0.4.2
Summary: Pure Python UCEC library.
License: MIT
Project-URL: homepage, https://github.com/SteveTheEngineer/python-ucec
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: description
Dynamic: description-content-type
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: summary

# python-ucec
A pure Python library to create user-space HDMI CEC drivers using [ucec](https://github.com/SteveTheEngineer/ucec).
Requires that driver to be installed on the running system. Only supports `asyncio`.

Loosely based on [python-uhid](https://github.com/FFY00/python-uhid), [discord.py](https://github.com/Rapptz/discord.py) and [aioesphomeapi](https://github.com/esphome/aioesphomeapi).

## Installation
From PyPI:
```bash
pip install ucec
```

## Example Usage
```py
import asyncio
import ucec


class MyAdapter(ucec.UCECAdapter):
    async def on_enable(self) -> None:
        print("On enable")


async def main() -> None:
    with MyAdapter(
        name="Test Adapter",
        capabilities=ucec.CECCapabilities.TRANSMIT | ucec.CECCapabilities.LOG_ADDRS | ucec.CECCapabilities.PASSTHROUGH,
        available_logical_addresses=1,
    ) as adapter:
        adapter.set_physical_address(0x1000)

        for _ in range(10):
            adapter.submit_received_message(
                CECMessage(data=b"\x0F\x32\x65\x6e\x67")
            )

            await asyncio.sleep(5)


if __name__ == "__main__":
    asyncio.run(main)
```
## Development
Initialize a virtual environment:
```bash
python3 -m venv .venv
source .venv/bin/activate
```

Install the project to the virtual environment in editable mode:
```bash
pip3 install -e .
```
