HEInventions / aiopjlink

Python asyncio PJLink library
MIT License
3 stars 2 forks source link
# aiopjlink A modern Python asyncio PJLink library (Class I and Class II). [![PyPI](https://img.shields.io/pypi/v/aiopjlink?logo=python&logoColor=%23cccccc)](https://pypi.org/project/aiopjlink) ![PyPI - License](https://img.shields.io/pypi/l/aiopjlink) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aiopjlink) ![PyPI - Downloads](https://img.shields.io/pypi/dm/aiopjlink) ![GitHub repo size](https://img.shields.io/github/repo-size/HEInventions/aiopjlink)

What is PJLink?

Most projectors that have RJ45 ports on the back can be controlled via PJLink.

PJLink is a communication protocol and unified standard for operating and controlling data projectors via TCP/IP, regardless of manufacturer.

PJLink consists of Class 1 commands and queries, as well as Class 2 notifications and extensions.

What is aiopjlink?

A Python library that uses asyncio to talk to one or more projectors connected to a network using the PJLink protocol.

It has these advantages:

Usage

Each "connection" to a projector is managed through a PJLink context manager. Once this is connected, you access the different functions through a high level API (e.g. conn.power.turn_off(), conn.lamps.hours(), conn.errors.query(), etc).

For example, create a PJLink connection to the projector and issue commands:

async with PJLink(address="192.168.1.120", password="secretpassword") as link:

    # Turn on the projector.
    await link.power.turn_on()

    # Wait a few seconds, then print out all the error information.
    await asyncio.sleep(5)
    print("errors = ", await link.errors.query())

    # Then wait a few seconds, then turn the projector off.
    await asyncio.sleep(5)
    await link.power.turn_off()

Development

We use the PDM package manager.

pdm install --dev  # install all deps required to run and test the code

pdm run lint  # check code quality
pdm run test  # check all test cases run OK

pdm publish  # Publish the project to PyPI

Other notes:

Roadmap

Pull requests with test cases are welcome. There are still some things to finish, including: