diff --git a/src/main.cpp b/src/main.cpp index dda2770..e631a9a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -264,6 +264,8 @@ void loop() mqtt.publish(FLIPDOT_AVAILABILITY_TOPIC, "available"); publishHomeAssistantDiscovery(); + + publishClose(); } } } @@ -450,25 +452,6 @@ void mqttCallback(char *topic, unsigned char *message, unsigned int length) if (ToppicString == FLIPDOT_TEXT_TOPIC) { Serial.println("Text topic received: " + MessageString); - JsonDocument doc; - if (deserializeJson(doc, (const char *)message, length) == DeserializationError::Ok) - { - MessageString = doc["value"] | String("none"); // the pipe operand tells the default value, if "value" is not existing - - if ((MessageString != "none")) - { - printText(MessageString); - } - else - { - Serial.print(FLIPDOT_TEXT_TOPIC); - Serial.println(" has no [\"value\"]!"); - } - } - else - { - Serial.print(FLIPDOT_TEXT_TOPIC); - Serial.println(" is no json!"); - } + printText(MessageString); } }