<aside> đź’ˇ THE STARTING POINT:
detected Anomaly example flow.json
</aside>
You need to decide which “error”-messages you want to store as detected anomalies. Use their MQTT-IN nodes. E.g. for:
After that place a json for the convertation from string to object:
In case the value from the machine/sensor comes in as a boolean value. You need to transfer it into a boolean number (1 or 0 instead of TRUE or FALSE):
msg.payload.ERR_TEMP_FĂśHLER = msg.payload.ERR_TEMP_FĂśHLER ? 1 : 0;
return msg;
After that. use a rising edge to only let values through that reach the 1 (rising edge = 0.999).
Finally, we add a TO JSON function to give the message a timestamp and give it a name according to the anomaly. After this, we only need to send the message by using the /detectedAnomaly MQTT-OUT node.
//TO JSON function
msg.payload = {
"timestamp_ms": Date.now(), //timestamp
"detectedAnomaly": "ERR_TEMP_FĂśHLER" //name
}
return msg;