Deactivated: Get WS2812 modes.
Message too large
This commit is contained in:
parent
b699cf75a2
commit
b71834bbb2
2 changed files with 13 additions and 9 deletions
|
@ -8,6 +8,7 @@
|
||||||
#define ENABLE_OTA // If defined, enable Arduino OTA code.
|
#define ENABLE_OTA // If defined, enable Arduino OTA code.
|
||||||
|
|
||||||
#define ENABLE_MQTT // If defined, enable MQTT client code.
|
#define ENABLE_MQTT // If defined, enable MQTT client code.
|
||||||
|
#define MQTT_MAX_PACKET_SIZE 4096
|
||||||
#ifdef ENABLE_MQTT
|
#ifdef ENABLE_MQTT
|
||||||
const char mqtt_intopic[] = "inTopic";
|
const char mqtt_intopic[] = "inTopic";
|
||||||
const char mqtt_outtopic[] = "outTopic";
|
const char mqtt_outtopic[] = "outTopic";
|
||||||
|
|
|
@ -342,14 +342,14 @@ void checkForRequests() {
|
||||||
// * ==> Set main color and light all LEDs (Shortcut)
|
// * ==> Set main color and light all LEDs (Shortcut)
|
||||||
if (payload[0] == '*') {
|
if (payload[0] == '*') {
|
||||||
handleSetAllMode(payload);
|
handleSetAllMode(payload);
|
||||||
DBG_OUTPUT_PORT.printf("MQTT: Set main color and light all LEDs [%u]\n", payload);
|
DBG_OUTPUT_PORT.printf("MQTT: Set main color and light all LEDs [%s]\n", payload);
|
||||||
mqtt_client.publish(mqtt_outtopic, "OK");
|
mqtt_client.publish(mqtt_outtopic, "OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ! ==> Set single LED in given color
|
// ! ==> Set single LED in given color
|
||||||
if (payload[0] == '!') {
|
if (payload[0] == '!') {
|
||||||
handleSetSingleLED(payload);
|
handleSetSingleLED(payload);
|
||||||
DBG_OUTPUT_PORT.printf("MQTT: Set single LED in given color [%u]\n", payload);
|
DBG_OUTPUT_PORT.printf("MQTT: Set single LED in given color [%s]\n", payload);
|
||||||
mqtt_client.publish(mqtt_outtopic, "OK");
|
mqtt_client.publish(mqtt_outtopic, "OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,30 +357,33 @@ void checkForRequests() {
|
||||||
if (payload[0] == '=') {
|
if (payload[0] == '=') {
|
||||||
String str_mode = String((char *) &payload[0]);
|
String str_mode = String((char *) &payload[0]);
|
||||||
handleSetNamedMode(str_mode);
|
handleSetNamedMode(str_mode);
|
||||||
DBG_OUTPUT_PORT.printf("MQTT: Activate named mode [%u]\n", payload);
|
DBG_OUTPUT_PORT.printf("MQTT: Activate named mode [%s]\n", payload);
|
||||||
mqtt_client.publish(mqtt_outtopic, "OK");
|
mqtt_client.publish(mqtt_outtopic, "OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
// $ ==> Get status Info.
|
// $ ==> Get status Info.
|
||||||
if (payload[0] == '$') {
|
if (payload[0] == '$') {
|
||||||
DBG_OUTPUT_PORT.printf("MQTT: Get status info.");
|
DBG_OUTPUT_PORT.printf("MQTT: Get status info.\n");
|
||||||
mqtt_client.publish(mqtt_outtopic, listStatusJSON());
|
mqtt_client.publish(mqtt_outtopic, listStatusJSON());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ ==> Get WS2812 modes.
|
// ~ ==> Get WS2812 modes.
|
||||||
// TODO: Fix this, doesn't return anything. Too long?
|
// TODO: Fix this, doesn't return anything. Too long?
|
||||||
if (payload[0] == '~') {
|
if (payload[0] == '~') {
|
||||||
DBG_OUTPUT_PORT.printf("MQTT: Get WS2812 modes.");
|
DBG_OUTPUT_PORT.printf("MQTT: Get WS2812 modes.\n");
|
||||||
String json_modes = listModesJSON();
|
DBG_OUTPUT_PORT.printf("Error: Not implemented. Message too large for pubsubclient.");
|
||||||
DBG_OUTPUT_PORT.printf(json_modes.c_str());
|
mqtt_client.publish(mqtt_outtopic, "ERROR: Not implemented. Message too large for pubsubclient.");
|
||||||
|
//String json_modes = listModesJSON();
|
||||||
|
//DBG_OUTPUT_PORT.printf(json_modes.c_str());
|
||||||
|
|
||||||
mqtt_client.publish(mqtt_outtopic, json_modes.c_str());
|
//int res = mqtt_client.publish(mqtt_outtopic, json_modes.c_str(), json_modes.length());
|
||||||
|
//DBG_OUTPUT_PORT.printf("Result: %d / %d", res, json_modes.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
// / ==> Set WS2812 mode.
|
// / ==> Set WS2812 mode.
|
||||||
if ((char)payload[0] == '/') {
|
if ((char)payload[0] == '/') {
|
||||||
handleSetWS2812FXMode(payload);
|
handleSetWS2812FXMode(payload);
|
||||||
DBG_OUTPUT_PORT.printf("MQTT: Set WS2812 mode [%u]\n", payload);
|
DBG_OUTPUT_PORT.printf("MQTT: Set WS2812 mode [%s]\n", payload);
|
||||||
mqtt_client.publish(mqtt_outtopic, "OK");
|
mqtt_client.publish(mqtt_outtopic, "OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue