Skip to content

latelylk/pyavaccess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyavaccess

Python libary for interfacing with AV Access devices over serial. Designed for use with Home Assistant.

Supported Devices

Although this library was created for and tested with the 4kmx42-h2a, it was written so that it could be easily expanded for use with any AV Access device.

Have a different device?

If you're a developer - please consider contributing to this project :)

If you're not a developer - open an issue with the model and features of your device and I'll see what I can do

Usage

from pyavaccess import HDMIMatrixSerial

# Interface with a "4kmx42-h2a" device over serial at "/dev/ttyUSB0"
av = HDMIMatrixSerial("/dev/ttyUSB0", "4KMX42-H2A")

# Print current version
print(av.getVer())

# Get a map of active input for each output {out: in, ...}
outputMap = av.getMappings()

# For each output, print the input mapped to it
for output, input in outputMap.items():
    print("Output {} is mapped to input {}".format(output, input))

# Set the input for output 1 to input 4
av.mapOutput(1, 4)

# Check that the mapping was successful
assert av.getMapping(1) == 4

Testing

The tests for this library are driven by pytest and require connection to an AV Access device.

pytest