SIGNL4 Alerting for Hilscher

This sample flow shows the integration of SIGNL4 alerting with Hilscher components via MQTT.

You can find more information here.

[{"id":"7a189d3a.4919e4","type":"tab","label":"SIGNL4 Alerting","disabled":false,"info":""},{"id":"9ad63e27.6ac8b","type":"mqtt in","z":"7a189d3a.4919e4","name":"MQTT Distance Sensor 1","topic":"netfield/000001321402-000000023174/netfield-app-profinet-device-2983/published/root/output/receive_001/IO_Link_Distance1/60b047b4-446d-4be0-a6e4-2c2d6b340a9e","qos":"0","datatype":"json","broker":"3fc8ed29.a10692","x":150,"y":80,"wires":[["500f1562.337d5c","38b67dc1.0adb42"]]},{"id":"500f1562.337d5c","type":"debug","z":"7a189d3a.4919e4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":80,"wires":[]},{"id":"e5412a5f.4b8798","type":"function","z":"7a189d3a.4919e4","name":"Assemble Alert","func":"\nvar value = msg.payload.data[0].value;\n\nvar data = {\n    \"Subject\": \"Hilscher Alert\",\n    \"Body\": \"MQTT sensor data indicate a distance alert.\",\n    \"Distance\": value,\n    \"X-S4-Location\": \"52.3990058,13.0568778\",\n    \"X-S4-ExternalId\": \"Distance-Sensor-1\",\n    \"X-S4-Status\": \"new\"\n}\n\nmsg.payload = data;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":180,"wires":[["f52bca80.d63278"]]},{"id":"f52bca80.d63278","type":"SIGNL4","z":"7a189d3a.4919e4","name":"SIGNL4 Alerting","teamSecret":"","alertSubject":"Hilscher Alert","alertBody":"MQTT","alertS4Service":"","alertS4Location":"","alertS4AlertingScenario":"single_ack","alertS4Filtering":"false","alertS4ExternalID":"","x":780,"y":180,"wires":[[]]},{"id":"8ba16f38.0b6e5","type":"inject","z":"7a189d3a.4919e4","name":"Enable Alert","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":130,"y":300,"wires":[["87a7989e.984ea8"]]},{"id":"9a876bc8.815ac8","type":"inject","z":"7a189d3a.4919e4","name":"Disable Alert","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":130,"y":380,"wires":[["87a7989e.984ea8"]]},{"id":"87a7989e.984ea8","type":"function","z":"7a189d3a.4919e4","name":"Activate / Deactivate","func":"\nflow.set(\"alert\", msg.payload);\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":340,"wires":[[]]},{"id":"d9080ea2.b9958","type":"switch","z":"7a189d3a.4919e4","name":"Check Distance","property":"payload.data[0].value","propertyType":"msg","rules":[{"t":"gte","v":"1000","vt":"num"},{"t":"lt","v":"500","vt":"num"}],"checkall":"false","repair":false,"outputs":2,"x":380,"y":200,"wires":[["e5412a5f.4b8798"],["4fc91a23.7d7dd4"]]},{"id":"4fc91a23.7d7dd4","type":"function","z":"7a189d3a.4919e4","name":"Assemble Resolve","func":"\nvar value = msg.payload.data[0].value;\n\nvar data = {\n\n    \"X-S4-ExternalId\": \"Distance-Sensor-1\",\n    \"X-S4-Status\": \"resolved\"\n}\n\nmsg.payload = data;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":590,"y":220,"wires":[["769bedc1.3ec874"]]},{"id":"769bedc1.3ec874","type":"SIGNL4 Resolve","z":"7a189d3a.4919e4","name":"SIGNL4 Resolve","teamSecret":"","alertS4ExternalID":"","x":780,"y":220,"wires":[[]]},{"id":"3d569208.cb9c1e","type":"inject","z":"7a189d3a.4919e4","name":"Simulate Alert","props":[{"p":"payload.data[0].value","v":"1400","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":160,"wires":[["d9080ea2.b9958"]]},{"id":"e5c14b5c.3261a8","type":"inject","z":"7a189d3a.4919e4","name":"Simulate Resolve","props":[{"p":"payload.data[0].value","v":"400","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":140,"y":240,"wires":[["d9080ea2.b9958"]]},{"id":"38b67dc1.0adb42","type":"switch","z":"7a189d3a.4919e4","name":"Check Active","property":"alert","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":140,"wires":[["d9080ea2.b9958"]]},{"id":"3fc8ed29.a10692","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Flow Info

Created 3 years, 9 months ago
Rating: 5 1

Owner

Actions

Rate:

Node Types

Core
  • debug (x1)
  • function (x3)
  • inject (x4)
  • mqtt in (x1)
  • mqtt-broker (x1)
  • switch (x2)
Other

Tags

  • hilscher
  • MQTT
  • Alerting
  • Alert
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option