Hello!
We do indeed have an API command for switching HDMI output sources, however, I don’t believe this was exposed in any documentation when Mat originally responded!
Please note:
-
The following commands are from a REST API in development. Documentation is still very limited and is subject to change at anytime. Use at your own risk
-
While switching HDMI output to a channel is pretty straightforward, switching HDMI output to a direct input is not, and more data of your physical unit would need to be parsed via GET commands.
However, we can focus on channels for now.
The HDMI output ports on Pearl devices are called “Displays” in the API. Pearl-2 has two “Displays” (HDMI Outputs), which are identified as D1 (HDMI Output 1) and D2 (HDMI Output 2).
If you wanted to see the settings of HDMI Output 1 (D1), you would run API command:
curl -X GET -u admin: http://your_IP/api/displays/D1/settings
Note: admin: = username and password. If the password for admin were “test”, the API command would look like this:
curl -X GET -u admin:test http://your_ip/api/displays/D1/settings
which would return something like:
{"status":"ok","result":{"source":"2","audio":true,"audio_volume":100,"mirrored":false}}
If you look at the Pearl WebUI, you will see UI items for each of the above data sections of the string. For “source” the data that follows, in this case, “2”, indicates logical channel #2 is selected as the source. Therefore, if this were “1”, logical channel #1 would be selected as the source.
To change the “source” section of the “D1” (HDMI Output 1) we must add an extra header to the above API command while using the PUT argument; replacing the data held within “D1” settings. You can do this with the following API command:
In this example, I am changing “D1” (HDMI Output 1) source from logical channel#2 -> logical channel#1
curl -H "Content-Type: application/json" -u admin: -X PUT --data "{\"source\":\"1\",\"audio\":true,\"audio_volume\":100,\"mirrored\":false}" http://your_IP/api/displays/D1/settings
Notice --data in the command contains the new data to be used in the “D1” settings. Choosing a direct input instead of a channel is much more tricky, so do let me know if this is a requirement and I will do my best to explain this as well.
Hope this helps!