How-To Guides
Flows Guides
Create Audio Notifications for Sensor Readings
1min
you can use flows to create dashboards to notify you when sensor anomalies occur user scenario imagine a situation in an automobile assembly plant where temperature sensors detect readings that are beyond the normal range in such a scenario, the system can immediately trigger an audio alert, which can help to quickly address potential issues to create a flow that notifies you of temperature reading alerts in litmus edge, navigate to the flows manager and create a new flow see create a flow docid\ veyyte7xdcangglzbqya0 to learn more drag an inject node, function node, and serial out node onto the canvas and connect them create a new connection by adding serial in , function , and audio out nodes to the canvas and connecting them together the two connections should be connected as shown below double click either the serial in or serial out node the edit serial node dialog box appears serial port click the edit icon the edit serial port node page opens create a configuration for the connected device make sure that the serial port and baud rate match the device information click update click done repeat step 4 to configure each serial node in the flow double click the inject node the edit inject node dialog box appears msg payload select string from the drop down option and enter a string message that requests the desired data from it in this use case, f is used to request temperature data in fahrenheit from the sensor repeat set an interval to have the node automatically request data after every one second click done double click the audio out node the edit audio out node dialog box appears tts voice select a voice to use play audio when window not in focus select the check box to hear the alert when the flow is minimized group if needed, click the edit icon to create a dashboard name enter a user defined name click done double click the function node connected to the inject node and serial out node the edit function node dialog box appears on message enter code that adds a carriage return to the message to ensure that the device reads it properly msg payload = msg payload + "\r"; // add a carriage return to the output return msg; double click the function node connected to the serial in node and audio out node the edit function node dialog box appears on message enter code that checks for the sensor reading and outputs a message when it is above or below a certain threshold var val = parsefloat(msg payload); // gets the temperature in degrees fahrenheit from the string sent by the device if (val > 70 0) { // checks for if the temperature is higher than 70 deg f msg payload = "high"; // sets the notification message to say "high" when the temperature is high } else { msg payload = "low"; // sets the notification message to say "low" when the temperature is lower than 70 deg f } return msg; click deploy and expand the message window beneath the flow click the dashboard icon then, click the expand icon to open the dashboard to begin hearing the audio notifications