Skip to main content

API for controlling a Kramer media switch using Protocol 2000

Project description

kessler-av

Python library for controlling a Kramer media switch that uses Protocol 2000 over a TCP connection.

It's primarily intended for use as a device driver for a Home Assistant integration.

USAGE

from kesslerav import get_media_switch

device_url = '10.0.0.1'
media_switch = get_media_switch(device_url)

media_switch.select_source(3) # Change to input 3
media_switch.lock() # Lock front panel
media_switch.unlock() # Unlock front panel
media_switch.update() # Refreshes device state

See src/kesslerav/media_switch.py for full MediaSwitch capabilities.

Device URL format

The URL takes the form of <scheme>://<host>:<port>#<protocol> with all but host being optional.

Default scheme is tcp, with a default port of 5000.

Default protocol is Protocol 2000 (identifier: protocol2k.)

Examples:

  • 10.0.0.1 -> Scheme: tcp, Host: 10.0.0.1, Port: 5000, Protocol: protocol2k
  • localhost:1337 -> Scheme: tcp, Host: localhost, Port: 1337, Protocol: protocol2k
  • localhost:1337#protocol2000 -> Scheme: tcp, Host: localhost, Port: 1337, Protocol: protocol2k
  • tcp://10.0.0.1 -> Scheme: tcp, Host: 10.0.0.1, Port: 5000, Protocol: protocol2k
  • tcp://switch.local:8080 -> Scheme: tcp, Host: switch.local, Port: 8080, Protocol: protocol2k
  • tcp://localhost:8080#protocol2k Scheme: tcp, Host: localhost, Port: 8080, Protocol: protocol2k

Limitations

The library was tested and developed using a Kramer VS-161HDMI switch, but should work for any Kramer switch using Protocol 2000.

It does not currently support:

  • Matrix switch operations, since I don't have a device to test with
  • UDP communication, since I don't have a device to test with
  • Serial communication, since TCP is the more likely control mechanism for home automation purposes

The library has extension points for adding the support above should an opportunity or need to do so arise.

Development workflow

Python environment

Workflow scripts assume a working Python environment, including pip.

Remember to be kind to yourself and use a virtual environment.

python3 -m venv env
env/bin/activate

Setup

Install development and runtime dependencies. This also installs the library as an editable path, so that it can be loaded in the REPL and pytest.

script/setup

Tests

Run unit tests:

script/test

Tests can also be continuously run while developing with:

ptw .

Build

To build distributables:

script/build

Build artifacts will be placed in the dist directory.

Publishing

Build the distribution.

script/build

Publish the library to TestPyPI.

script/publish_test

Publish the library to PyPI.

script/publish

Why kessler-av?

In Seinfeld, the character Cosmo Kramer was based on comedian Kenny Kramer. In the shows pilot episode, the producers hadn't gotten permission to use Kramer's name, so the character was called Kessler instead.

This library controls Kramer A/V's media switches, but doesn't have permission to use their trademarked name. As a result, it seemed fitting to name it kessler-av.

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

kessler_av-0.9.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

kessler_av-0.9.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file kessler_av-0.9.0.tar.gz.

File metadata

  • Download URL: kessler_av-0.9.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for kessler_av-0.9.0.tar.gz
Algorithm Hash digest
SHA256 e84bd1e78297153a2ed3a6f21b989e1f32d87f44e4d337dc1633b143c91e7245
MD5 aaf5b33591875aa741e7db9a2be72505
BLAKE2b-256 2c6397c7798cc0e25b56e554dd7df63b9e12703016aae007a66ced607f160c9d

See more details on using hashes here.

File details

Details for the file kessler_av-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: kessler_av-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for kessler_av-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 358b0fb8fa33d2142261c8b26b908b2f6f95bee3765d8033cee9c4e724a4f063
MD5 3bfd2cff106444bbc8f78d65f4102121
BLAKE2b-256 e2cdbcc7fb2dfdb910a015c6ec1cc196bf61bb7b1e92a68713c1af6b90ef38b9

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