Opentrigger Slack Example

see: https://www.gitbook.com/book/acolono/opentrigger/ Opentrigger Slack

[{"id":"5e6a2292.b746fc","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":false,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":null,"willPayload":"","birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":""},{"id":"6fe31be1.96c5d4","type":"function","z":"48a43edf.9b97e","name":"Coffee is ready!","func":"msg.payload = {\n    \"attachments\": [\n        {\n            \"color\": \"#E22B1B\",\n            \"pretext\": \":coffee: is ready!\",\n            \"image_url\": \"https://i.imgur.com/yTtxUpj.gif\",\n            //\"mrkdwn_in\": [\"text\",\"pretext\"],\n        },\n    ],\n};\n//msg.payload.username = \"opentrigger\";\n//msg.payload.channel = \"@flo\";\nmsg.headers = {'Content-Type':'application/json'};\nreturn msg;","outputs":1,"noerr":0,"x":1000,"y":180,"wires":[["e65a21ec.4ff52"]]},{"id":"e65a21ec.4ff52","type":"http request","z":"48a43edf.9b97e","name":"slack","method":"POST","ret":"txt","url":"https://hooks.slack.com/services/CHANGE-ME","x":1170,"y":180,"wires":[[]]},{"id":"e2f334c7.c261b8","type":"mqtt in","z":"48a43edf.9b97e","name":"Opentrigger Release","topic":"/opentrigger/signals/release","broker":"5e6a2292.b746fc","x":180,"y":200,"wires":[["d7e84bc2.10da08"]]},{"id":"d7e84bc2.10da08","type":"json","z":"48a43edf.9b97e","name":"","x":370,"y":200,"wires":[["4c91d8af.c56cf8"]]},{"id":"4c91d8af.c56cf8","type":"switch","z":"48a43edf.9b97e","name":"Age > 2sec","property":"payload.Age","propertyType":"msg","rules":[{"t":"lt","v":"2000","vt":"num"},{"t":"gte","v":"2000","vt":"num"}],"checkall":"true","outputs":2,"x":530,"y":200,"wires":[["af43b44e.3b5828"],["c2015a4c.7a6d38"]]},{"id":"af43b44e.3b5828","type":"switch","z":"48a43edf.9b97e","name":"Short","property":"payload.Packet.ManufacturerSpecific.SensorData.DigitalInputs","propertyType":"msg","rules":[{"t":"eq","v":"0,1,1,1,1,1","vt":"str"},{"t":"eq","v":"1,0,1,1,1,1","vt":"str"},{"t":"eq","v":"1,1,0,1,1,1","vt":"str"},{"t":"eq","v":"1,1,1,0,1,1","vt":"str"},{"t":"eq","v":"1,1,1,1,0,1","vt":"str"},{"t":"eq","v":"1,1,1,1,1,0","vt":"str"}],"checkall":"true","outputs":6,"x":710,"y":120,"wires":[["6fe31be1.96c5d4"],[],[],[],[],[]]},{"id":"c2015a4c.7a6d38","type":"switch","z":"48a43edf.9b97e","name":"Long","property":"payload.Packet.ManufacturerSpecific.SensorData.DigitalInputs","propertyType":"msg","rules":[{"t":"eq","v":"0,1,1,1,1,1","vt":"str"},{"t":"eq","v":"1,0,1,1,1,1","vt":"str"},{"t":"eq","v":"1,1,0,1,1,1","vt":"str"},{"t":"eq","v":"1,1,1,0,1,1","vt":"str"},{"t":"eq","v":"1,1,1,1,0,1","vt":"str"},{"t":"eq","v":"1,1,1,1,1,0","vt":"str"}],"checkall":"true","outputs":6,"x":710,"y":280,"wires":[[],[],[],[],[],[]]}]

Flow Info

Created 8 years, 6 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • function (x1)
  • http request (x1)
  • json (x1)
  • mqtt in (x1)
  • mqtt-broker (x1)
  • switch (x3)

Tags

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