logging for inactive devices
This commit is contained in:
@ -299,11 +299,11 @@ int forwardMinuteBuffer(t_forwarderHandle *handle, t_minuteBuffer *buf) {
|
||||
buf->s.deviceId, buf->s.totalRunningHours, buf->s.totalPowercycles, buf->s.totalWatchdogResets,
|
||||
buf->s.version, location);
|
||||
|
||||
if (device->inactive == 0) {
|
||||
for (uint8_t j = 0; j < SECONDS_PER_MINUTE; j++) {
|
||||
uint64_t timestamp = buf->s.timestamp + j;
|
||||
logmsg(LOG_DEBUG, "Time: %lu, Frequency: %u", timestamp, buf->s.frequency[j]);
|
||||
for (uint8_t j = 0; j < SECONDS_PER_MINUTE; j++) {
|
||||
uint64_t timestamp = buf->s.timestamp + j;
|
||||
logmsg(LOG_DEBUG, "Time: %lu, Frequency: %u", timestamp, buf->s.frequency[j]);
|
||||
|
||||
if (device->inactive == 0) {
|
||||
if ((buf->s.frequency[j] >= handle->lowerBound) && (buf->s.frequency[j] <= handle->upperBound)) {
|
||||
int frequency_before_point = buf->s.frequency[j] / 1000;
|
||||
int frequency_behind_point = buf->s.frequency[j] - (frequency_before_point * 1000);
|
||||
@ -332,12 +332,16 @@ int forwardMinuteBuffer(t_forwarderHandle *handle, t_minuteBuffer *buf) {
|
||||
} else {
|
||||
logmsg(LOG_ERR, "%u out of bound, ignored", buf->s.frequency[j]);
|
||||
}
|
||||
} else {
|
||||
logmsg(LOG_DEBUG, "Inactive device, not sent to InfluxDB");
|
||||
}
|
||||
} else {
|
||||
logmsg(LOG_INFO, "Inactive device, not sent to InfluxDB");
|
||||
}
|
||||
|
||||
logmsg(LOG_INFO, "Successfully sent whole minute to InfluxDB");
|
||||
if (device->inactive == 0) {
|
||||
logmsg(LOG_INFO, "Successfully sent whole minute to InfluxDB");
|
||||
} else {
|
||||
logmsg(LOG_INFO, "Not sent to database, device is marked as inactive");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user