SIGNL4 Alerting for ifm IO-Link
This flow integrates ifm IO-Link with SIGNL4 using Node-RED.
We use the device and documentations as listed here: https://www.ifm.com/de/en/product/AL1350?tab=documents
In our example we use a temperature sensor connected to IO-Link. Node-RED polls the temperature at certain intervals and if the temperature exceeds a certain value an alarm is sent to SIGNL4. We use an HTTP request to retrieve the sensor data in JSON format.
The trigger node "Simulate" allows to simulate an event from IO-Link.
[{"id":"da2daf60.9ee548","type":"inject","z":"5dafe24d.f1956c","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":200,"wires":[["158151d0.e38396"]]},{"id":"62f2ac63.f3ebc4","type":"debug","z":"5dafe24d.f1956c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":200,"wires":[]},{"id":"158151d0.e38396","type":"function","z":"5dafe24d.f1956c","name":"Get process data","func":"msg.payload = {\"code\": \"request\", \"cid\": 4, \n\"adr\": \"/iolinkmaster/port[1]/iolinkdevice/pdin/getdata\"}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":200,"wires":[["6ea58f83.8bb9a"]]},{"id":"6ea58f83.8bb9a","type":"http request","z":"5dafe24d.f1956c","name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"192.168.0.10","tls":"","persist":false,"proxy":"","authType":"","x":570,"y":200,"wires":[["62f2ac63.f3ebc4","aff06ae2.0b58b8"]]},{"id":"7a67afec.37efc","type":"SIGNL4","z":"5dafe24d.f1956c","name":"SIGNL4 Alerting","teamSecret":"","alertSubject":"","alertBody":"","alertS4Service":"","alertS4Location":"","alertS4AlertingScenario":"single_ack","alertS4Filtering":"false","alertS4ExternalID":"","x":760,"y":340,"wires":[[]]},{"id":"f2df48ae.323ae8","type":"function","z":"5dafe24d.f1956c","name":"Alert Data","func":"\n\nvar data = {\n \"X-S4-Location\": \"52.3984235,13.0544149\",\n \"Subject\": \"Temperature Alert\",\n \"Body\": \"Temperature to high.\",\n \"Temperature\": parseInt(\"0x\" + msg.payload.data.value)\n};\n\nmsg.payload = data;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":340,"wires":[["7a67afec.37efc"]]},{"id":"fb638e04.f2da2","type":"json","z":"5dafe24d.f1956c","name":"","property":"payload","action":"","pretty":true,"x":330,"y":280,"wires":[["aff06ae2.0b58b8"]]},{"id":"69dc62f7.7db90c","type":"inject","z":"5dafe24d.f1956c","name":"Simulate","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{ \"cid\":4711, \"data\":{\"value\":\"44\"}, \"code\":200 }","payloadType":"str","x":180,"y":280,"wires":[["fb638e04.f2da2"]]},{"id":"aff06ae2.0b58b8","type":"switch","z":"5dafe24d.f1956c","name":"Condition","property":"msg.payload.data.value","propertyType":"jsonata","rules":[{"t":"gt","v":"20","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":500,"y":280,"wires":[["f2df48ae.323ae8"]]}]