Difference between revisions of "IEdge NodeRED iAlarm Sample"

From ESS-WIKI
Jump to: navigation, search
Line 4: Line 4:
 
This document will introduce a NodeRed sample code for user define their own alarm flow and message in iEdge. In this example, we use Modbus-Master plugin to collect sensor data, and if the status sensor returns 0 which means device does not any abnormal, other wise, sensor returns error code. We use NodeRed to design a work flow that will send corresponding error message which depends on the error code. 
 
This document will introduce a NodeRed sample code for user define their own alarm flow and message in iEdge. In this example, we use Modbus-Master plugin to collect sensor data, and if the status sensor returns 0 which means device does not any abnormal, other wise, sensor returns error code. We use NodeRed to design a work flow that will send corresponding error message which depends on the error code. 
  
[[File:IEdge NodeRed 1 Example Code.png|center|1024px]]
+
[[File:IEdge NodeRed 1 Example Code.png|center|1024px|IEdge NodeRed 1 Example Code.png]]
 +
 
 +
== Set Global Variable ==
 +
 
 +
To avoid a large number of notifications in a short period of time, this sample code adds a variable to record previous error code. If sensor returns error code, iEdge will send alarm once and will not notify again if getting the same code with previous time again.
 +
 
 +
 
 +
 
 +
== Get Data From MQTT ==
 +
 
 +
== Filter Modbus-Master Data ==
 +
 
 +
== Filter Sensor Data ==
 +
 
 +
== Define Alarm Message ==
 +
 
 +
== Publish Alarm to MQTT ==
 +
 
 +
 
 +
 
 +
 

Revision as of 10:17, 23 December 2022

Introduction

This document will introduce a NodeRed sample code for user define their own alarm flow and message in iEdge. In this example, we use Modbus-Master plugin to collect sensor data, and if the status sensor returns 0 which means device does not any abnormal, other wise, sensor returns error code. We use NodeRed to design a work flow that will send corresponding error message which depends on the error code. 

IEdge NodeRed 1 Example Code.png

Set Global Variable

To avoid a large number of notifications in a short period of time, this sample code adds a variable to record previous error code. If sensor returns error code, iEdge will send alarm once and will not notify again if getting the same code with previous time again.

 

Get Data From MQTT

Filter Modbus-Master Data

Filter Sensor Data

Define Alarm Message

Publish Alarm to MQTT