V0.36
adds new MQTT commands. See https://blueforcer.github.io/awtrix-light/#/mqtt
This commit is contained in:
@@ -132,12 +132,30 @@ void onMqttMessage(const char *topic, const uint8_t *payload, uint16_t length)
|
||||
return;
|
||||
}
|
||||
|
||||
if (strTopic == MQTT_PREFIX + "/switch")
|
||||
if (strTopic == MQTT_PREFIX + "/switch")
|
||||
{
|
||||
DisplayManager.switchToApp(strPayload);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strTopic == MQTT_PREFIX + "/settings")
|
||||
{
|
||||
DisplayManager.setNewSettings(strPayload);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strTopic == MQTT_PREFIX + "/nextapp")
|
||||
{
|
||||
DisplayManager.nextApp();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strTopic == MQTT_PREFIX + "/previousapp")
|
||||
{
|
||||
DisplayManager.previousApp();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (strTopic.startsWith(MQTT_PREFIX + "/custom"))
|
||||
{
|
||||
String topic_str = topic;
|
||||
@@ -161,6 +179,9 @@ void onMqttConnected()
|
||||
mqtt.subscribe((prefix + String("/timer")).c_str());
|
||||
mqtt.subscribe((prefix + String("/custom/#")).c_str());
|
||||
mqtt.subscribe((prefix + String("/switch")).c_str());
|
||||
mqtt.subscribe((prefix + String("/settings")).c_str());
|
||||
mqtt.subscribe((prefix + String("/previousapp")).c_str());
|
||||
mqtt.subscribe((prefix + String("/nextapp")).c_str());
|
||||
Serial.println("MQTT Connected");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user