Probably a simple answer, but I want to publish the Epoch time when my Arduino/esp-link boots up. This is invaluable as a debug tool so I know if a station is going down at a certain millis time, UpSince thingy in Node-Red, etc.
In the loop() in Arduino might start like: (which doesn't work)
define pubTopicEpoch "Rain/E/Epoch" // Publish station start time for failure analysis
uint32_t epoch;
int EpochPublished = 0;
void loop() {
esp.Process();
// Publish the startup time once
if (connected && EpochPublished == 0) {
epoch = cmd.GetTime();
mqtt.publish(pubTopicEpoch,epoch); // topic,payload,payloadlen,qos,retain
EpochPublished = 1;
}
// more code
}
Probably a simple answer, but I want to publish the Epoch time when my Arduino/esp-link boots up. This is invaluable as a debug tool so I know if a station is going down at a certain millis time, UpSince thingy in Node-Red, etc.
In the loop() in Arduino might start like: (which doesn't work)
define pubTopicEpoch "Rain/E/Epoch" // Publish station start time for failure analysis
uint32_t epoch; int EpochPublished = 0;
void loop() { esp.Process();
// Publish the startup time once if (connected && EpochPublished == 0) { epoch = cmd.GetTime(); mqtt.publish(pubTopicEpoch,epoch); // topic,payload,payloadlen,qos,retain EpochPublished = 1; } // more code }