don't use buffered string, which was causing extraneous zero length packets to be transmitted.
1 files changed, 5 insertions(+), 8 deletions(-)

M src/main.cpp
M src/main.cpp +5 -8
@@ 103,7 103,7 @@ boolean justChanged = 0;
 //      FUNCTIONS
 
 WiFiUDP ntpUdp;
-NTPClient timeClient(ntpUdp);
+NTPClient timeClient(ntpUdp, "192.168.5.155");
 
 //MQTT
 PubSubClient MQTTClient(wifiClient);

          
@@ 632,7 632,7 @@ void setup() {
     Serial.begin(115200);
 
     DEBUG("Startup");
-
+//resetEverything();
 //Set up software serial at 104 baud to read from AC
 
     pinMode(BUS_TX, OUTPUT);

          
@@ 750,12 750,12 @@ void thSensorLoop() {
         lastReport = tsm;
 #ifdef WANT_NTP
         ts = timeClient.getEpochTime();
+Serial.println(timeClient.getFormattedTime());
 #endif /* WANT_NTP */
 
         // always send the hub message
 
             StaticJsonDocument<220> doc;
-            WriteBufferingStream bufferedFile{udp, 64};
 
             doc["serial_number"] = hubsn;
             doc["type"] = "hub_status";

          
@@ 765,14 765,12 @@ void thSensorLoop() {
             doc["timestamp"] = ts;
 
             udp.beginPacket(br_adr, SMARTWEATHER_PORT);
-            serializeJson(doc, bufferedFile);
-            bufferedFile.flush();
+            serializeJson(doc, udp);
             udp.endPacket();
             reportcnt++;
 
         if (sensorPresent) {
             StaticJsonDocument<220> doc;
-            WriteBufferingStream bufferedFile{udp, 64};
             doc["serial_number"] = airsn;
             doc["hub_sn"] = hubsn;
             doc["type"] = "device_status";

          
@@ 784,8 782,7 @@ void thSensorLoop() {
             doc["timestamp"] = ts;
 
             udp.beginPacket(br_adr, SMARTWEATHER_PORT);
-            serializeJson(doc, bufferedFile);
-            bufferedFile.flush();
+            serializeJson(doc, udp);
             udp.endPacket();
         }
     }