only convert and send JSON topics with type 'sendtext'

This commit is contained in:
Thomas Göttgens 2022-10-19 10:54:56 +02:00
parent b859347ecd
commit 7c3dc076d2

View File

@ -39,7 +39,7 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
if (err.empty()) {
DEBUG_MSG("JSON Received on MQTT, parsing..\n");
// check if it is a valid envelope
if (json.object_items().count("sender") != 0 && json.object_items().count("payload") != 0) {
if (json.object_items().count("sender") != 0 && json.object_items().count("payload") != 0 && json["type"] == "sendtext") {
// this is a valid envelope
if (json["sender"].string_value().compare(owner.id) != 0) {
std::string jsonPayloadStr = json["payload"].dump();