add status topic and publish after sending text to sign

This commit is contained in:
Bernd Stellwag 2024-10-22 19:28:39 +02:00
parent 165540c120
commit 60a82b896a

View File

@ -22,7 +22,8 @@ static SocketServer socketServer;
WiFiClient client; WiFiClient client;
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY); Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
Adafruit_MQTT_Subscribe mqtt_subscribe_topic = Adafruit_MQTT_Subscribe(&mqtt, "homeassistant/marquee_sign/text"); Adafruit_MQTT_Subscribe mqtt_subscribe_topic = Adafruit_MQTT_Subscribe(&mqtt, "homeassistant/marquee_sign/text/set");
Adafruit_MQTT_Publish mqtt_publish_topic = Adafruit_MQTT_Publish(&mqtt, "homeassistant/marquee_sign/text/status");
void MQTT_connect(); void MQTT_connect();
@ -79,6 +80,8 @@ void loop() {
const char* signText = (char *)mqtt_subscribe_topic.lastread; const char* signText = (char *)mqtt_subscribe_topic.lastread;
sendTextToSign(signText); sendTextToSign(signText);
mqtt_publish_topic.publish(signText);
} }
} }