Microservice to RESTfully control Atlona video switchers
This microservice provides a RESTful API to control various Atlona video switchers. It handles the communication protocol with the devices, providing a simple interface for switching inputs, controlling volume, and managing mute settings.
This microservice will immediately execute one connection and then will add a delay of 1 second for all subsequent commands until all connections have completed. Atlona switchers require 500ms before each command and this code includes 500ms of delay when reading the responses from the device.
Each command opens, executes, reads and returns the response, and closes the connection with the Atlona device.
The following Atlona devices are supported:
- AT-UHD-SW-52ED - 5×2 HDMI switcher
- AT-OME-PS62 - 6×2 presentation switcher
- AT-GAIN-60 - Audio amplifier
All devices share these standard endpoints:
GET /ping- Returns "pong" if the service is runningGET /status- Returns the service status
Both devices share these endpoints:
Action Endpoints
GET /api/v1/AT-UHD-SW-52ED/:address/output/:output/input/:input- Switch input for a specified outputGET /api/v1/AT-UHD-SW-52ED/:address/block/:output/volume/:level- Set volume levelGET /api/v1/AT-UHD-SW-52ED/:address/block/:output/muted/:mute- Set mute state (true/false)
Status Endpoints
GET /api/v1/AT-UHD-SW-52ED/:address/output/:output/input- Get current input for outputGET /api/v1/AT-UHD-SW-52ED/:address/block/:output/volume- Get current volume levelGET /api/v1/AT-UHD-SW-52ED/:address/block/:output/muted- Get current mute state
Replace AT-UHD-SW-52ED with AT-OME-PS62 for the PS62 switcher.
Action Endpoints
GET /api/v1/AT-GAIN-60/:address/block/:output/volume/:level- Set volume levelGET /api/v1/AT-GAIN-60/:address/block/:output/muted/:mute- Set mute state (true/false)
Status Endpoints
GET /api/v1/AT-GAIN-60/:address/block/:output/volume- Get current volume levelGET /api/v1/AT-GAIN-60/:address/block/:output/muted- Get current mute state
Use the Makefile to build the project:
make buildTo run tests:
make testBuild and deploy Docker containers:
make docker
make deployThe following API guides were used and switchers have been tested:
The main package is located in the cmd folder. Device communication logic is contained in the device/actions package.