update docs
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
- [Icons](icons.md)
|
||||
- [Sounds](sounds.md)
|
||||
|
||||
- MQTT
|
||||
- API
|
||||
- [MQTT/HTTP](api.md)
|
||||
- [Custom Pages & Notifications](custom.md)
|
||||
- [Commands](mqtt.md)
|
||||
|
||||
|
||||
@@ -1,26 +1,40 @@
|
||||
# MQTT Commands
|
||||
# MQTT / HTTP API
|
||||
|
||||
|
||||
## Status
|
||||
In MQTT awtrix send its stats every 10s to `[PREFIX]/stats`
|
||||
With HTTP, make GET request to `http://[IP]/api/stats`
|
||||
|
||||
|
||||
## Add custom app
|
||||
create custom apps or notifications to display your own text and icons.
|
||||
Have a look at [this section](custom?id=custom-apps-and-notifications)
|
||||
|
||||
| Topic | URL | Payload/Body | HTTP Header | HTTP method |
|
||||
| --- | --- | --- |--- |--- |
|
||||
| `[PREFIX]/custom/[appname]` |`http://[IP]/api/custom` | JSON | name = [appname] | POST |
|
||||
|
||||
## Dismiss Notification
|
||||
Dismiss a notification which was set to "hold"=true.
|
||||
|
||||
| Topic | Payload |
|
||||
| --- | --- |
|
||||
| `[PREFIX]/notify/dismiss` | empty payload |
|
||||
| Topic | URL | Payload/Body | HTTP method |
|
||||
| --- | --- | --- | --- |
|
||||
| `[PREFIX]/custom/[appname]` |`http://[IP]/api/notify/dismiss` | empty payload/body | POST |
|
||||
|
||||
## Switch Apps
|
||||
Switch to next or previous app.
|
||||
|
||||
| Topic | Payload |
|
||||
| --- | --- |
|
||||
| `[PREFIX]/nextapp` | empty payload |
|
||||
| `[PREFIX]/previousapp` | empty payload |
|
||||
| Topic | URL | Payload/Body | HTTP method |
|
||||
| --- | --- | --- | --- |
|
||||
| `[PREFIX]/nextapp` | `http://[IP]/api/nextapp` | empty payload/body | POST |
|
||||
| `[PREFIX]/previousapp` | `http://[IP]/api/previousapp` | payload/body | POST |
|
||||
|
||||
## Switch to Specific App
|
||||
Switch to a specific app by name.
|
||||
|
||||
| Topic | Payload |
|
||||
| --- | --- |
|
||||
| `[PREFIX]/switch` | `{"name":"time"}` |
|
||||
| Topic | URL | Payload/Body | HTTP method |
|
||||
| --- | --- | --- | --- |
|
||||
| `[PREFIX]/switch` | `http://[IP]/api/switch` | `{"name":"time"}` | POST |
|
||||
|
||||
Built-in app names are:
|
||||
- `time`
|
||||
@@ -34,9 +48,9 @@ For custom apps, use the name you set in the topic. For example, if `[PREFIX]/cu
|
||||
## Add/remove and rearange apps
|
||||
|
||||
|
||||
| Topic |
|
||||
| --- |
|
||||
| `[PREFIX]/apps` |
|
||||
| Topic | URL | Payload/Body | HTTP method |
|
||||
| --- | --- | --- | --- |
|
||||
| `[PREFIX]/apps`|`http://[IP]/api/apps`| json | POST |
|
||||
|
||||
!> This function provides users with the ability to manage the apps on their device by adding, removing, and rearranging them. However, as it is an experimental feature, caution should be exercised, particularly when attempting to rearrange multiple apps at once, as this can lead to unintended consequences due to the resulting shifts in position of other apps.
|
||||
|
||||
@@ -98,15 +112,21 @@ In this example,
|
||||
- The "bat" app is inactive and will be removed,
|
||||
- and the "github" app is active and should be displayed in position 4.
|
||||
|
||||
## Add timer
|
||||
create custom apps or notifications to display your own text and icons.
|
||||
have a look at [this section](custom)
|
||||
|
||||
| Topic | URL | Payload/Body |HTTP method |
|
||||
| --- | --- | --- |--- |
|
||||
| `[PREFIX]/custom/[appname]` |`http://[IP]/api/notify/dismiss` | empty payload/body | POST |
|
||||
|
||||
|
||||
## Change Settings
|
||||
Change various settings related to the app display.
|
||||
|
||||
| Topic | Payload |
|
||||
| --- | --- |
|
||||
| `[PREFIX]/settings` | JSON properties |
|
||||
| Topic | URL | Payload/Body |HTTP method |
|
||||
| --- | --- | --- |--- |
|
||||
| `[PREFIX]/settings` |`http://[IP]/api/settings`| JSON | POST |
|
||||
|
||||
Each property is optional; you do not need to send all.
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# Custom Apps & Notifications
|
||||
# Custom Apps and Notifications
|
||||
|
||||
With AWTRIX Light, you can create custom apps or notifications to display your own text and icons.
|
||||
Simply send a JSON object to the topic "awtrixlight/custom/[page]" where [page] is a the name of your page (without spaces).
|
||||
With AWTRIX Light, you can create custom apps or notifications to display your own text and icons.
|
||||
|
||||
With MQTT simply send a JSON object to the topic `[PREFIX]/custom/[page]` where [page] is a the name of your page (without spaces).
|
||||
With the [HTTP API](api?id=add-custom-app) you have to set the appname in the request header (`name = Appname`)
|
||||
|
||||
## JSON Properties
|
||||
|
||||
@@ -9,7 +11,7 @@ The JSON object has the following properties:
|
||||
|
||||
| Key | Type | Description | Default |
|
||||
| --- | ---- | ----------- | ------- |
|
||||
| `pos` | number | defines the position of your custompage in the loop, starting at 0 for the first position. This will only apply with your first push. You cant change the position afterwards with [this function](mqtt?id=addremove-and-rearange-apps) |
|
||||
| `pos` | number | defines the position of your custompage in the loop, starting at 0 for the first position. This will only apply with your first push. You cant change the position afterwards with [this function](api?id=addremove-and-rearange-apps) |
|
||||
| `text` | string | The text to display on the page. | |
|
||||
| `icon` | string | The icon ID or filename (without extension) to display on the page. | |
|
||||
| `repeat` | number | Sets how many times the text should be scrolled through the matrix before the display ends. | 1 |
|
||||
@@ -41,5 +43,6 @@ Here's an example JSON object to display the text "Hello, AWTRIX Light!" with th
|
||||
}
|
||||
```
|
||||
|
||||
## Delete a custom page
|
||||
To delelte a custom page simply send a empty payload to the same topic
|
||||
## Delete a custom app
|
||||
To delete a custom app simply send a empty payload/body to the same topic/url.
|
||||
You can also use [this API](api?id=addremove-and-rearange-apps)
|
||||
|
||||
@@ -514,6 +514,7 @@ void DisplayManager_::loadNativeApps()
|
||||
|
||||
void DisplayManager_::setup()
|
||||
{
|
||||
|
||||
TJpgDec.setCallback(jpg_output);
|
||||
FastLED.addLeds<NEOPIXEL, MATRIX_PIN>(leds, MATRIX_WIDTH * MATRIX_HEIGHT);
|
||||
gif.setMatrix(&matrix);
|
||||
|
||||
@@ -116,7 +116,7 @@ IPAddress gateway;
|
||||
IPAddress subnet;
|
||||
IPAddress primaryDNS;
|
||||
IPAddress secondaryDNS;
|
||||
const char *VERSION = "0.45";
|
||||
const char *VERSION = "0.46";
|
||||
String MQTT_HOST = "";
|
||||
uint16_t MQTT_PORT = 1883;
|
||||
String MQTT_USER;
|
||||
|
||||
@@ -44,11 +44,10 @@ const char *menuItems[] PROGMEM = {
|
||||
"TEMP",
|
||||
"APPS",
|
||||
"SOUND",
|
||||
"VOLUME",
|
||||
"UPDATE"};
|
||||
|
||||
int8_t menuIndex = 0;
|
||||
uint8_t menuItemCount = 14;
|
||||
uint8_t menuItemCount = 13;
|
||||
|
||||
const char *timeFormat[] PROGMEM = {
|
||||
"%H:%M:%S",
|
||||
@@ -374,8 +373,9 @@ void MenuManager_::selectButton()
|
||||
case 12:
|
||||
#ifdef AWTRIX_UPGRADE
|
||||
currentState = VolumeMenu;
|
||||
break;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 13:
|
||||
if (FirmwareVersionCheck())
|
||||
{
|
||||
|
||||
@@ -123,13 +123,14 @@ void ServerManager_::setup()
|
||||
{
|
||||
WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS);
|
||||
}
|
||||
IPAddress myIP = mws.startWiFi(10000, uniqueID, "12345678");
|
||||
myIP = mws.startWiFi(10000, uniqueID, "12345678");
|
||||
|
||||
isConnected = !(myIP == IPAddress(192, 168, 4, 1));
|
||||
Serial.println(myIP.toString());
|
||||
|
||||
if (isConnected)
|
||||
{
|
||||
|
||||
|
||||
mws.addOptionBox("Network");
|
||||
mws.addOption("Static IP", NET_STATIC);
|
||||
mws.addOption("Local IP", NET_IP);
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
void tick();
|
||||
void loadSettings();
|
||||
bool isConnected;
|
||||
IPAddress myIP;
|
||||
};
|
||||
|
||||
extern ServerManager_ &ServerManager;
|
||||
|
||||
14
src/main.cpp
14
src/main.cpp
@@ -61,15 +61,10 @@ void setup()
|
||||
delay(500);
|
||||
Serial.begin(9600);
|
||||
loadSettings();
|
||||
Serial.println("1");
|
||||
ServerManager.loadSettings();
|
||||
Serial.println("2");
|
||||
DisplayManager.setup();
|
||||
Serial.println("3");
|
||||
DisplayManager.HSVtext(9, 6, VERSION, true);
|
||||
Serial.println("4");
|
||||
delay(500);
|
||||
Serial.println("5");
|
||||
PeripheryManager.playBootSound();
|
||||
xTaskCreatePinnedToCore(BootAnimation, "Task", 10000, NULL, 1, &taskHandle, 1);
|
||||
ServerManager.setup();
|
||||
@@ -78,13 +73,20 @@ void setup()
|
||||
{
|
||||
MQTTManager.setup();
|
||||
DisplayManager.loadNativeApps();
|
||||
StopTask = true;
|
||||
float x = 4;
|
||||
while (x >= -85)
|
||||
{
|
||||
DisplayManager.HSVtext(x, 6, ("AWTRIX " + ServerManager.myIP.toString()).c_str(), true);
|
||||
x -= 0.18;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AP_MODE = true;
|
||||
StopTask = true;
|
||||
}
|
||||
|
||||
StopTask = true;
|
||||
delay(200);
|
||||
DisplayManager.clearMatrix();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user