This topic is for advanced users only. More information about MQTT protocol can be found on https://mqtt.org/ and Wikipedia.

Slideshow contains an MQTT client, which can connect to a remote MQTT broker via internet connection and receive commands. Setup of the connection can be done through the web interface – menu SettingsDevice settings – section MQTT. Reload the app after changing the settings in order to apply them. Current connection status can be found via menu InformationAbout deviceMQTT connection state.

Supported MQTT version is 5, with optional TLS security or communication through HTTP WebSockets (both configurable in Device settings).

If “Report data through MQTT” setting is enabled, Slideshow will automatically report its device status and display statistics over MQTT every 2 minutes, without need to make any request.

Communication

Communication via MQTT is asynchronous, Slideshow is listening for commands from an external system. Once the command arrives, Slideshow executes it and returns a response on another topic.

Four MQTT topics are used for the communication with each device, the names are based on the MQTT topic prefix and MQTT topic name from the device settings.

  • {MQTT topic prefix}/REQ/{MQTT topic name}/SHELL – request from server to the device to execute shell command
  • {MQTT topic prefix}/RESP/{MQTT topic name}/SHELL – response from the device to the shell command
  • {MQTT topic prefix}/REQ/{MQTT topic name}/API – request from server to the device to execute API call
  • {MQTT topic prefix}/RESP/{MQTT topic name}/API – response from the device to the API call
If no topic name is set in the device settings, MAC address without colons will be used as a default (if available).

Example communication

Topic prefix “SLIDESHOW” and device with MAC address 01:02:03:04:05:06 is used in all examples below.

Execute shell command

Request topic: SLIDESHOW/REQ/010203040506/SHELL
Request message: getprop ro.serialno
Response topic: SLIDESHOW/RESP/010203040506/SHELL
Response message: {"command": "echo test", "success": true, "result": { "result": 0, "stdout": "test\n", "stderr": "" }}

Move to the next file

Request topic: SLIDESHOW/REQ/010203040506/API
Request message: {"operation": "next"}
Response topic: SLIDESHOW/RESP/010203040506/API
Response message: {"command": "next", "success": true}

Display file on screen

Request topic: SLIDESHOW/REQ/010203040506/API
Request message: {"operation": "showFile", "parameters": {"panelName": "Whole screen", "file": "sample1.jpg", "length": 5}}
Response topic: SLIDESHOW/RESP/010203040506/API
Response message: {"command": "showFile", "success": true}

Supported commands

Move to the next file:
{"operation": "next", "parameters": {"panelName": "Whole screen"}}

Display file on the screen:
{"operation": "showFile", "parameters": {"panelName": "Whole screen", "file": "sample1.jpg", "length": 5}}

Display custom HTML content on the screen:
{"operation": "showSentHtml", "parameters": {"panelName": "Whole screen", "length": 5, "html": "<strong>Sample bold text</strong>"}}

Switch to different playlist:
{"operation": "playlist/set", "parameters": {"panelName": "Whole screen", "playlist": 1}}

Clear set playlist:
{"operation": "playlist/clear", "parameters": {"panelName": "Whole screen"}}

Set screen layout:

{"operation": "layout/set", "parameters": {"layoutName": "Sample layout"}}

Clear set screen layout:
{"operation": "layout/clear"}

Get device info:
{"operation": "deviceInfo"}

Toggle fullscreen view for main panel
{"operation": "fullscreen/toggle"}

Get list of panels:
{"operation": "panels"}

Set volume:
{"operation": "volume/set", "parameters": {"vol": 5}}

Reload app:
{"operation": "reload"}

Reboot device:
{"operation": "reboot"}

Panel name in the parameters is optional, if no panel name is set, the operation will be performed on the main panel.