publishing results

This commit is contained in:
Wolfgang Hottgenroth 2020-11-18 15:24:23 +01:00
parent 5ed7fdce0f
commit 31cbe4fc7e
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -113,8 +113,9 @@ static void printError(t_mbusCommHandle *localMbusCommHandle) {
coloredMsg(LOG_YELLOW, true, "mbc pe [%d] Error ratio is %.2f",
localMbusCommHandle->requestId,
errorRatio);
mqttPublishf(MBUS_TOPIC, "{\"Status\":\"Error\", \"RequestId\":\"%d\", \"Device\":\"%s\", \"ErrorRatio\":\"%.2f\"}",
localMbusCommHandle->requestId, localMbusCommHandle->device->deviceName, errorRatio);
mqttPublishf(MBUS_TOPIC, "{\"Status\":\"Error\", \"RequestId\":\"%d\", \"Device\":\"%s\", \"Errors\":\"%d\", \"Requests\":\"%d\", \"ErrorRatio\":\"%.2f\"}",
localMbusCommHandle->requestId, localMbusCommHandle->device->deviceName,
localMbusCommHandle->device->failures, localMbusCommHandle->device->requests, errorRatio);
}
@ -204,8 +205,9 @@ static void parseAndPrintFrame(t_mbusCommHandle *localMbusCommHandle) {
coloredMsg(LOG_YELLOW, true, "mbc papf [%d] Error ratio is %.2f",
localMbusCommHandle->requestId,
errorRatio);
mqttPublishf(MBUS_TOPIC, "{\"Status\":\"Ok\", \"RequestId\":\"%d\", \"Device\":\"%s\", \"ErrorRatio\":\"%.2f\"}",
localMbusCommHandle->requestId, localMbusCommHandle->device->deviceName, errorRatio);
mqttPublishf(MBUS_TOPIC, "{\"Status\":\"Ok\", \"RequestId\":\"%d\", \"Device\":\"%s\", \"Errors\":\"%d\", \"Requests\":\"%d\", \"ErrorRatio\":\"%.2f\"}",
localMbusCommHandle->requestId, localMbusCommHandle->device->deviceName,
localMbusCommHandle->device->failures, localMbusCommHandle->device->requests, errorRatio);
} else {
coloredMsg(LOG_RED, true, "mbc papf [%d] err: unable to parse frame", localMbusCommHandle->requestId);
}