publishing results

This commit is contained in:
Wolfgang Hottgenroth 2020-11-18 14:03:52 +01:00
parent 5e4f9063e1
commit 5ed7fdce0f
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -113,6 +113,8 @@ 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);
}
@ -202,7 +204,7 @@ static void parseAndPrintFrame(t_mbusCommHandle *localMbusCommHandle) {
coloredMsg(LOG_YELLOW, true, "mbc papf [%d] Error ratio is %.2f",
localMbusCommHandle->requestId,
errorRatio);
mqttPublishf(MBUS_TOPIC, "{\"Status\":\"Error\", \"RequestId\":\"%d\", \"Device\":\"%s\", \"ErrorRatio\":\"%.2f\"}",
mqttPublishf(MBUS_TOPIC, "{\"Status\":\"Ok\", \"RequestId\":\"%d\", \"Device\":\"%s\", \"ErrorRatio\":\"%.2f\"}",
localMbusCommHandle->requestId, localMbusCommHandle->device->deviceName, errorRatio);
} else {
coloredMsg(LOG_RED, true, "mbc papf [%d] err: unable to parse frame", localMbusCommHandle->requestId);