Skip to content

MQTT / HTTP API

Table of Contents

Overview

This API documentation covers various functionalities such as retrieving device statistics, screen mirroring, notifications, custom apps, sound playing, and mood lighting. You can interact with these features via both MQTT and HTTP protocols.

Status Retrieval

Access various device statistics like battery, RAM, and more:

MQTT TopicHTTP URLDescription
[PREFIX]/statshttp://[IP]/api/statsGeneral device stats (e.g., battery, RAM)
[PREFIX]/stats/effectshttp://[IP]/api/effectsList of all effects
[PREFIX]/stats/transitionshttp://[IP]/api/transitionsList of all transition effects
[PREFIX]/stats/loophttp://[IP]/api/loopList of all apps in the loop

Note: MQTT also broadcasts other data, such as button presses and the current app.

LiveView

Retrieve the current matrix screen as an array of 24-bit colors:

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/sendscreenhttp://[IP]/api/screen-GET

When triggering the MQTT API, SVITRIX sends the array to [PREFIX]/screen.

Extras:

  • Access a live view of the screen in your browser: http://[IP]/screen.
  • Options to download a screenshot or generate a GIF from the current display content.
  • http://[IP]/fullscreen gives you a fullscreen liveview. Here you can optionally set the fps as parameter (standard 30).

Power Control

Toggle the matrix on or off:

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/powerhttp://[IP]/api/power{"power": true} or {"power": false}POST

Send the board in deep sleep mode (turns off the matrix as well), good for saving battery life:

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/sleephttp://[IP]/api/sleep{"sleep": X} where X is number of secondsPOST

SVITRIX will only wakeup after time or if you press the middle button once. There is no way to wake up via API.

Sound Playback

Play a RTTTL sound from the MELODIES folder.

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/soundhttp://[IP]/api/sound{"sound":"alarm"}POST

Play a RTTTL sound from a given RTTTL string:

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/rtttlhttp://[IP]/api/rtttlrttl stringPOST

Mood Lighting

Set the entire matrix to a custom color or temperature:

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/moodlighthttp://[IP]/api/moodlightSee belowPOST

⚠️ Caution: Using this function results in a higher current draw and heat, especially when all pixels are lit. Ensure you manage brightness values responsibly.

To disable moodlight, send an empty payload.

Example:

json
{
  "brightness": 170,
  "kelvin": 2300
}

Possible moodlight options:

json
{"brightness":170,"kelvin":2300}
or
{"brightness":170,"color":[155,38,182]}
or
{"brightness":170,"color":"#FF00FF"}

Colored Indicators

Colored indicators serve as small notification signs displayed on specific areas of the screen:

  • Upper right corner: Indicator 1
  • Right side: Indicator 2
  • Lower right corner: Indicator 3
MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/indicator1http://[IP]/api/indicator1{"color":[255,0,0]}POST
[PREFIX]/indicator2http://[IP]/api/indicator2{"color":[0,255,0]}POST
[PREFIX]/indicator3http://[IP]/api/indicator3{"color":[0,255,0]}POST

Color Options:

  • Use an RGB array, e.g., {"color":[255,0,0]}
  • Use HEX color strings, e.g., {"color":"#32a852"}

Hide Indicators:

  • To hide the indicators, send the color black ({"color":[0,0,0]}) or use the shorthand {"color":"0"}. Alternatively, send an empty payload.

Additional Effects:

  • Blinking: To make the indicator blink, add the key "blink" with a value specifying the blinking interval in milliseconds.
  • Fading: To make the indicator fade on and off, add the key "fade" with a value specifying the fade interval in milliseconds.

Custom Apps and Notifications

With SVITRIX, you can design custom apps or notifications to showcase your unique text and icons.

Interaction

  • MQTT: Send a JSON object to [PREFIX]/custom/[app], where [app] denotes your app's name (excluding spaces).
  • HTTP API: Incorporate the app name in the query parameter (name=[appname]).
  • Updating: To refresh a custom page, dispatch a modified JSON object to the identical endpoint. The display updates instantly.
  • One-Time Notification: Use the same JSON format. Direct your JSON object to [PREFIX]/notify or http://[IP]/api/notify.
MQTT TopicHTTP URLPayload/BodyQuery ParametersHTTP Method
[PREFIX]/custom/[appname]http://[IP]/api/customJSONname=[appname]POST
[PREFIX]/notifyhttp://[IP]/api/notifyJSON-POST

JSON Properties

Below are the properties you can utilize in the JSON object. All keys are optional; only include the properties you require.

KeyTypeDescriptionDefaultCustom AppNotification
textstringThe text to display. Keep in mind the font does not have a fixed size and I uses less space than W. This affects when text will start scrolling.N/AXX
textCaseintegerChanges the Uppercase setting. 0=global setting, 1 = forces uppercase; 2 = shows as sent.0XX
topTextbooleanDraw the text on top.falseXX
textOffsetintegerSets an offset for the x position of a starting text.0XX
centerbooleanCenters a short, non-scrollable text.trueXX
colorstring or array of integersThe text, bar or line color.N/AXX
gradientArray of string or integersColorizes the text in a gradient of two given colors.N/AXX
blinkTextIntegerBlinks the text in an given interval in ms, not compatible with gradient or rainbow.N/AXX
fadeTextIntegerFades the text on and off in an given interval, not compatible with gradient or rainbow.N/AXX
backgroundstring or array of integersSets a background color.N/AXX
rainbowbooleanFades each letter in the text differently through the entire RGB spectrum.falseXX
iconstringThe icon ID or filename (without extension) to display on the app. You can also send a 8x8 jpg as Base64 string.N/AXX
pushIconinteger0 = Icon doesn't move. 1 = Icon moves with text and will not appear again. 2 = Icon moves with text but appears again when the text starts to scroll again.0XX
repeatintegerSets how many times the text should be scrolled through the matrix before the app ends.-1XX
durationintegerSets how long the app or notification should be displayed.5XX
holdbooleanSet it to true, to hold your notification on top until you press the middle button or dismiss it via HomeAssistant. This key only belongs to notification.falseX
soundstringThe filename of your RTTTL ringtone file placed in the MELODIES folder (without extension).N/AX
rtttlstringAllows to send the RTTTL sound string with JSON.N/AX
loopSoundbooleanLoops the sound or RTTTL as long as the notification is running.falseX
bararray of integersDraws a bargraph. Without icon maximum 16 values, with icon 11 values.N/AXX
linearray of integersDraws a linechart. Without icon maximum 16 values, with icon 11 values.N/AXX
autoscalebooleanEnables or disables autoscaling for bar and linechart.trueXX
barBCstring or array of integersBackgroundcolor of the bars.0XX
progressintegerShows a progress bar. Value can be 0–100.-1XX
progressCstring or array of integersThe color of the progress bar.-1XX
progressBCstring or array of integersThe color of the progress bar background.-1XX
posintegerDefines the position of your custom page in the loop, starting at 0 for the first position. This will only apply with your first push. This function is experimental.N/AX
drawarray of objectsArray of drawing instructions. Each object represents a drawing command. See the drawing instructions below.XX
lifetimeintegerRemoves the custom app when there is no update after the given time in seconds.0X
lifetimeModeinteger0 = deletes the app, 1 = marks it as staled with a red rectangle around the app.0X
stackbooleanDefines if the notification will be stacked. false will immediately replace the current notification.trueX
wakeupbooleanIf the Matrix is off, the notification will wake it up for the time of the notification.falseX
noScrollbooleanDisables the text scrolling.falseXX
clientsarray of stringsAllows forwarding a notification to other SVITRIX devices. Use the MQTT prefix for MQTT and IP addresses for HTTP.X
scrollSpeedintegerModifies the scroll speed. Enter a percentage value of the original scroll speed.100XX
effectstringShows an effect as background. The effect can be removed by sending an empty string for effect.XX
effectSettingsjson mapChanges color and speed of the effect.XX
savebooleanSaves your custom app into flash and reloads it after boot. Avoid this for custom apps with high update frequencies because the ESP's flash memory has limited write cycles.X
overlaystringSets an effect overlay (cannot be used with global overlays).XX

Color: Accepts a hex string or an R,G,B array: "#FFFFFF" or [255,255,0].

Overlay effects:

  • "clear"
  • "snow"
  • "rain"
  • "drizzle"
  • "storm"
  • "thunder"
  • "frost"

Example

Here's a sample JSON to present the text "Hello, SVITRIX!" in rainbow colors for a duration of 10 seconds:

json
{
  "text": "Hello, SVITRIX!",
  "rainbow": true,
  "duration": 10
}

MQTT Placeholder

This feature is particularly useful for users without a full smart home system. It eliminates the need for an external system to display data, such as from an inverter which can send its data via MQTT. You can simply create a [AppName].json file in the CUSTOMAPP folder with your custom app JSON keys. This JSON file will be loaded upon boot, so you don't need to send it from an external source. Or you can also use it in your HTTP or MQTT API request.

The placeholders inside the text value enclosed in will be replaced with the payload of the specified MQTT topic. Currently, there are no options available for formatting the payload.

json
{"text": "Solar: {{inverter/total/P_AC}} W"}

Drawing Instructions

WARNING

Please note: Depending on the number of objects, the RAM usage can be very high. This could cause freezes or reboots.

It's important to be mindful of the number of objects and the complexity of the drawing instructions to avoid performance issues.

Each drawing instruction is an object with a required command key and an array of values depending on the command:

CommandArray ValuesDescription
dp[x, y, cl]Draw a pixel at position (x, y) with color cl
dl[x0, y0, x1, y1, cl]Draw a line from (x0, y0) to (x1, y1) with color cl
dr[x, y, w, h, cl]Draw a rectangle with top-left corner at (x, y), width w, height h, and color cl
df[x, y, w, h, cl]Draw a filled rectangle with top-left corner at (x, y), width w, height h, and color cl
dc[x, y, r, cl]Draw a circle with center at (x, y), radius r, and color cl
dfc[x, y, r, cl]Draw a filled circle with center at (x, y), radius r, and color cl
dt[x, y, t, cl]Draw text t with top-left corner at (x, y) and color cl
db[x, y, w, h, [bmp]]Draws a RGB888 bitmap array [bmp] with top-left corner at (x, y) and size of (w, h)

Example

Here's an example JSON object to draw a red circle, a blue rectangle, and the text "Hello" in green:

json
{"draw":[
 {"dc": [28, 4, 3, "#FF0000"]},
 {"dr": [20, 4, 4, 4, "#0000FF"]},
 {"dt": [0, 0, "Hello", "#00FF00"]}
]}

Display Text in Colored Fragments

SVITRIX allows you to present text where specific fragments can be colorized. Use an array of fragments with "t" representing the text fragment and "c" denoting the color's hex value.

json
{
  "text": [
    {
      "t": "Hello, ",
      "c": "FF0000"
    },
    {
      "t": "world!",
      "c": "00FF00"
    }
  ],
  "repeat": 2
}

Sending Multiple Custom Apps Simultaneously

SVITRIX enables you to dispatch multiple custom apps in a single action. Instead of transmitting one custom app object, you can forward an array of objects.

e.g. MQTT Topic: /custom/test

json
[
  {"text":"1"},
  {"text":"2"}
]

Handling of Multiple Custom Apps:

  • Suffix Assignment: Internally, the app name receives a suffix, turning it into a format like test0, test1, etc.
  • Updates: You can refresh each app individually or update all of them collectively.
  • Deletion:
    • When erasing apps, SVITRIX doesn't match the exact app name. Instead, it identifies apps that begin with the specified name.
    • To expunge all associated apps, send an empty payload to /custom/test. This action will remove test0, test1, and so on.
    • To eradicate a single app, direct the command to, for instance, /custom/test1.
    • Caution: Deleting just one app may upset the sequence of the remaining apps in the loop, as there's no provision for placeholders to retain order.

Delete a Custom App

To remove a custom app, dispatch an empty payload/body to the associated topic or URL.

Dismiss Notification

Easily dismiss a notification that was configured with "hold": true.

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/notify/dismisshttp://[IP]/api/notify/dismissEmpty payload/bodyPOST

Switch Apps

Navigate to the next or preceding app.

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/nextapphttp://[IP]/api/nextappEmpty payload/bodyPOST
[PREFIX]/previousapphttp://[IP]/api/previousappEmpty payload/bodyPOST

Switch to Specific App

Directly transition to a desired app using its name.

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/switchhttp://[IP]/api/switch{"name":"Time"}POST

Built-in App Names:

  • Time
  • Date
  • Temperature
  • Humidity
  • Battery

For custom apps, employ the name you designated in the topic or HTTP parameter. In MQTT, if [PREFIX]/custom/test is your topic, then test would be the app's name.

Change Settings

Adjust various settings related to the app display.

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/settingshttp://[IP]/api/settingsJSONGET/POST

JSON Properties

You can adjust each property in the JSON object according to your preferences. Including a property is optional.

KeyTypeDescriptionValue RangeDefault
ATIMEnumberDuration an app is displayed in seconds.Positive integer7
TEFFnumberChoose between app transition effects.0–101
TSPEEDnumberTime taken for the transition to the next app in milliseconds.Positive integer500
TCOLstring/array of intsGlobal text color.RGB array or hex colorN/A
TMODEintegerChanges the time app style.0–61
CHCOLstring/array of intsCalendar header color of the time app.RGB array or hex color#FF0000
CBCOLstring/array of intsCalendar body color of the time app.RGB array or hex color#FFFFFF
CTCOLstring/array of intsCalendar text color in the time app.RGB array or hex color#000000
WDbooleanEnable or disable the weekday display.true/falsetrue
WDCAstring/array of intsActive weekday color.RGB array or hex colorN/A
WDCIstring/array of intsInactive weekday color.RGB array or hex colorN/A
BRInumberMatrix brightness.0–255N/A
ABRIbooleanAutomatic brightness control.true/falseN/A
ATRANSbooleanAutomatic switching to the next app.true/falseN/A
CCORRECTIONarray of intsColor correction for the matrix.RGB arrayN/A
CTEMParray of intsColor temperature for the matrix.RGB arrayN/A
TFORMATstringTime format for the TimeApp.Varies (see below)N/A
DFORMATstringDate format for the DateApp.Varies (see below)N/A
SOMbooleanStart the week on Monday.true/falsetrue
CELbooleanShows the temperature in Celsius (Fahrenheit when false).true/falsetrue
BLOCKNbooleanBlock physical navigation keys (still sends input to MQTT).true/falsefalse
UPPERCASEbooleanDisplay text in uppercase.true/falsetrue
TIME_COLstring/array of intsText color of the time app. Use 0 for global text color.RGB array or hex colorN/A
DATE_COLstring/array of intsText color of the date app. Use 0 for global text color.RGB array or hex colorN/A
TEMP_COLstring/array of intsText color of the temperature app. Use 0 for global text color.RGB array or hex colorN/A
HUM_COLstring/array of intsText color of the humidity app. Use 0 for global text color.RGB array or hex colorN/A
BAT_COLstring/array of intsText color of the battery app. Use 0 for global text color.RGB array or hex colorN/A
SSPEEDintegerScroll speed modification.Percentage of original scroll speed100
TIMbooleanEnable or disable the native time app (requires reboot).true/falsetrue
DATbooleanEnable or disable the native date app (requires reboot).true/falsetrue
HUMbooleanEnable or disable the native humidity app (requires reboot).true/falsetrue
TEMPbooleanEnable or disable the native temperature app (requires reboot).true/falsetrue
BATbooleanEnable or disable the native battery app (requires reboot).true/falsetrue
MATPbooleanEnable or disable the matrix. Similar to power endpoint but without the animation.true/falsetrue
VOLintegerAllows to set the volume of the buzzer.0–3025
OVERLAYstringSets a global effect overlay (cannot be used with app specific overlays).Varies (see below)N/A

Color Values: Can either be an RGB array (e.g., [255,0,0]) or a valid 6-digit hexadecimal color value (e.g., "#FF0000" for red).

Overlay effects:

  • "clear"
  • "snow"
  • "rain"
  • "drizzle"
  • "storm"
  • "thunder"
  • "frost"

Available Time Formats:

FormatExampleDescription
%H:%M:%S13:30:4524-hour time with seconds
%l:%M:%S1:30:4512-hour time with seconds
%H:%M13:3024-hour time
%H %M13.3024-hour time with blinking colon
%l:%M1:3012-hour time
%l %M1:3012-hour time with blinking colon
%l:%M %p1:30 PM12-hour time with AM/PM indicator
%l %M %p1:30 PM12-hour time with blinking colon and AM/PM

Available Date Formats:

FormatExampleDescription
%d.%m.%y16.04.22Day.Month.Year (short)
%d.%m16.04Day.Month
%y-%m-%d22-04-16Year-Month-Day
%m-%d04-16Month-Day
%m/%d/%y04/16/22Month/Day/Year
%m/%d04/16Month/Day
%d/%m/%y16/04/22Day/Month/Year
%d/%m16/04Day/Month
%m-%d-%y04-16-22Month-Day-Year

Available Transition Effects:

CodeEffect
0Random
1Slide
2Dim
3Zoom
4Rotate
5Pixelate
6Curtain
7Ripple
8Blink
9Reload
10Fade

Update

You can initiate the firmware update either through the update button in HA or using the following:

MQTT TopicHTTP URLPayload/BodyHTTP HeaderHTTP Method
[PREFIX]/doupdatehttp://[IP]/api/doupdateJSONempty payload/bodyPOST

Reboot Svitrix

If you need to restart the Svitrix:

MQTT TopicHTTP URLPayload/BodyHTTP Method
[PREFIX]/reboothttp://[IP]/api/reboot-POST

Erase Svitrix

WARNING: This action will format the flash memory and EEPROM but will not modify the WiFi Settings. It essentially serves as a factory reset.

MQTT TopicHTTP URLPayload/BodyHTTP Method
N/Ahttp://[IP]/api/erase-POST

Clear Settings

WARNING: This action will reset all settings from the settings API. It does not reset the flash files and WiFi Settings.

MQTT TopicHTTP URLPayload/BodyHTTP Method
N/Ahttp://[IP]/api/resetSettings-POST