{"id":1441,"date":"2020-08-23T13:20:22","date_gmt":"2020-08-23T06:20:22","guid":{"rendered":"https:\/\/wiki.rdd-tech.com\/?post_type=ht_kb&#038;p=1441"},"modified":"2020-08-23T15:05:30","modified_gmt":"2020-08-23T08:05:30","slug":"kumpulan-node-red-flow","status":"publish","type":"ht_kb","link":"https:\/\/wiki.rdd-tech.com\/index.php\/knowledge-base\/kumpulan-node-red-flow\/","title":{"rendered":"Kumpulan Node-Red Flow"},"content":{"rendered":"\n<h2 id=\"1-random-value-generator\" >1. Random Value Generator<\/h2>\n\n\n\n<p>Node ini berupa funtion yang akan menghasilkan bilangan acak<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;{\"id\":\"a4fdb5a5.dd1ee8\",\"type\":\"function\",\"z\":\"9bc41499.32eb78\",\"name\":\"generator\",\"func\":\"msg.payload.number=Math.random()*1000000;\\nreturn msg;\",\"outputs\":1,\"noerr\":0,\"x\":320,\"y\":80,\"wires\":&#91;&#91;]]}]<\/code><\/pre>\n\n\n\n<h2 id=\"2-node-red-dashboard-hello-world\" >2. Node-Red Dashboard Hello World<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;{\"id\":\"ab563b90.8fc7c8\",\"type\":\"tab\",\"label\":\"Flow 1\",\"disabled\":false,\"info\":\"\"},{\"id\":\"da686647.a1d978\",\"type\":\"debug\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"active\":false,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"payload\",\"targetType\":\"msg\",\"x\":950,\"y\":1480,\"wires\":&#91;]},{\"id\":\"8a5f21dc.a57e6\",\"type\":\"modbus-getter\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"PM\",\"showStatusActivities\":false,\"showErrors\":false,\"logIOActivities\":false,\"unitid\":\"7\",\"dataType\":\"HoldingRegister\",\"adr\":\"0\",\"quantity\":\"29\",\"server\":\"42ce8ce6.d53fd4\",\"useIOFile\":false,\"ioFile\":\"\",\"useIOForPayload\":false,\"emptyMsgOnFail\":false,\"x\":540,\"y\":1480,\"wires\":&#91;&#91;],&#91;\"da686647.a1d978\"]]},{\"id\":\"ca5e2d35.0826f\",\"type\":\"inject\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"repeat\":\"3\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"x\":280,\"y\":1480,\"wires\":&#91;&#91;\"8a5f21dc.a57e6\"]]},{\"id\":\"78fff522.fa232c\",\"type\":\"ui_text\",\"z\":\"ab563b90.8fc7c8\",\"group\":\"e1744a7.75736b8\",\"order\":0,\"width\":0,\"height\":0,\"name\":\"Hello World\",\"label\":\"text\",\"format\":\"{{msg.payload}}\",\"layout\":\"row-spread\",\"x\":610,\"y\":300,\"wires\":&#91;]},{\"id\":\"3bfe54c0.38152c\",\"type\":\"inject\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"topic\":\"\",\"payload\":\"Hello World\",\"payloadType\":\"str\",\"repeat\":\"1\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"x\":370,\"y\":300,\"wires\":&#91;&#91;\"78fff522.fa232c\"]]},{\"id\":\"42ce8ce6.d53fd4\",\"type\":\"modbus-client\",\"z\":\"\",\"name\":\"Voltage\",\"clienttype\":\"tcp\",\"bufferCommands\":false,\"stateLogEnabled\":false,\"queueLogEnabled\":false,\"tcpHost\":\"192.168.0.25\",\"tcpPort\":\"502\",\"tcpType\":\"DEFAULT\",\"serialPort\":\"COM4\",\"serialType\":\"RTU-BUFFERD\",\"serialBaudrate\":\"9600\",\"serialDatabits\":\"8\",\"serialStopbits\":\"1\",\"serialParity\":\"none\",\"serialConnectionDelay\":\"1\",\"unit_id\":\"5\",\"commandDelay\":\"500\",\"clientTimeout\":\"1000\",\"reconnectOnTimeout\":true,\"reconnectTimeout\":\"2000\",\"parallelUnitIdsAllowed\":false},{\"id\":\"e1744a7.75736b8\",\"type\":\"ui_group\",\"z\":\"\",\"name\":\"Group2\",\"tab\":\"79d639a3.78d118\",\"disp\":false,\"width\":\"10\",\"collapse\":false},{\"id\":\"79d639a3.78d118\",\"type\":\"ui_tab\",\"z\":\"\",\"name\":\"Home\",\"icon\":\"dashboard\",\"disabled\":false,\"hidden\":false}]<\/code><\/pre>\n\n\n\n<h2 id=\"3-node-red-menampilkan-value-pada-dashboard-gauge\" >3. Node-Red: Menampilkan Value pada dashboard gauge<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;{\"id\":\"ab563b90.8fc7c8\",\"type\":\"tab\",\"label\":\"Flow 1\",\"disabled\":false,\"info\":\"\"},{\"id\":\"da686647.a1d978\",\"type\":\"debug\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"active\":false,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"payload\",\"targetType\":\"msg\",\"x\":950,\"y\":1480,\"wires\":&#91;]},{\"id\":\"8a5f21dc.a57e6\",\"type\":\"modbus-getter\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"PM\",\"showStatusActivities\":false,\"showErrors\":false,\"logIOActivities\":false,\"unitid\":\"7\",\"dataType\":\"HoldingRegister\",\"adr\":\"0\",\"quantity\":\"29\",\"server\":\"42ce8ce6.d53fd4\",\"useIOFile\":false,\"ioFile\":\"\",\"useIOForPayload\":false,\"emptyMsgOnFail\":false,\"x\":540,\"y\":1480,\"wires\":&#91;&#91;],&#91;\"da686647.a1d978\"]]},{\"id\":\"ca5e2d35.0826f\",\"type\":\"inject\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"repeat\":\"3\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"x\":280,\"y\":1480,\"wires\":&#91;&#91;\"8a5f21dc.a57e6\"]]},{\"id\":\"f296c947.73beb8\",\"type\":\"inject\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"Injector\",\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"repeat\":\"1\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"x\":240,\"y\":220,\"wires\":&#91;&#91;\"b323c268.e4397\"]]},{\"id\":\"b323c268.e4397\",\"type\":\"random\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"Random Number\",\"low\":\"1\",\"high\":\"10000\",\"inte\":\"true\",\"property\":\"payload\",\"x\":450,\"y\":220,\"wires\":&#91;&#91;\"eebf5ba9.a2d2b8\",\"395d26f4.1a5f0a\"]]},{\"id\":\"eebf5ba9.a2d2b8\",\"type\":\"debug\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"x\":700,\"y\":220,\"wires\":&#91;]},{\"id\":\"395d26f4.1a5f0a\",\"type\":\"ui_gauge\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"group\":\"d025c192.ed41a\",\"order\":1,\"width\":0,\"height\":0,\"gtype\":\"gage\",\"title\":\"gauge\",\"label\":\"units\",\"format\":\"{{value}}\",\"min\":0,\"max\":\"10000\",\"colors\":&#91;\"#00b500\",\"#e6e600\",\"#ca3838\"],\"seg1\":\"\",\"seg2\":\"\",\"x\":670,\"y\":280,\"wires\":&#91;]},{\"id\":\"42ce8ce6.d53fd4\",\"type\":\"modbus-client\",\"z\":\"\",\"name\":\"Voltage\",\"clienttype\":\"tcp\",\"bufferCommands\":false,\"stateLogEnabled\":false,\"queueLogEnabled\":false,\"tcpHost\":\"192.168.0.25\",\"tcpPort\":\"502\",\"tcpType\":\"DEFAULT\",\"serialPort\":\"COM4\",\"serialType\":\"RTU-BUFFERD\",\"serialBaudrate\":\"9600\",\"serialDatabits\":\"8\",\"serialStopbits\":\"1\",\"serialParity\":\"none\",\"serialConnectionDelay\":\"1\",\"unit_id\":\"5\",\"commandDelay\":\"500\",\"clientTimeout\":\"1000\",\"reconnectOnTimeout\":true,\"reconnectTimeout\":\"2000\",\"parallelUnitIdsAllowed\":false},{\"id\":\"d025c192.ed41a\",\"type\":\"ui_group\",\"z\":\"\",\"name\":\"Group 1\",\"tab\":\"fd0d0d58.30f0e\",\"order\":1,\"disp\":false,\"width\":\"9\",\"collapse\":false},{\"id\":\"fd0d0d58.30f0e\",\"type\":\"ui_tab\",\"z\":\"\",\"name\":\"Home\",\"icon\":\"dashboard\",\"order\":1,\"disabled\":false,\"hidden\":false}]<\/code><\/pre>\n\n\n\n<h2 id=\"3-node-red-simple-mqtt\" >3. Node-Red: Simple MQTT<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;{\"id\":\"ab563b90.8fc7c8\",\"type\":\"tab\",\"label\":\"Flow 1\",\"disabled\":false,\"info\":\"\"},{\"id\":\"da686647.a1d978\",\"type\":\"debug\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"active\":false,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"payload\",\"targetType\":\"msg\",\"x\":950,\"y\":1480,\"wires\":&#91;]},{\"id\":\"8a5f21dc.a57e6\",\"type\":\"modbus-getter\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"PM\",\"showStatusActivities\":false,\"showErrors\":false,\"logIOActivities\":false,\"unitid\":\"7\",\"dataType\":\"HoldingRegister\",\"adr\":\"0\",\"quantity\":\"29\",\"server\":\"42ce8ce6.d53fd4\",\"useIOFile\":false,\"ioFile\":\"\",\"useIOForPayload\":false,\"emptyMsgOnFail\":false,\"x\":540,\"y\":1480,\"wires\":&#91;&#91;],&#91;\"da686647.a1d978\"]]},{\"id\":\"ca5e2d35.0826f\",\"type\":\"inject\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"repeat\":\"3\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"x\":280,\"y\":1480,\"wires\":&#91;&#91;\"8a5f21dc.a57e6\"]]},{\"id\":\"c45697a7.bceca8\",\"type\":\"mosca in\",\"z\":\"ab563b90.8fc7c8\",\"mqtt_port\":1883,\"mqtt_ws_port\":8080,\"name\":\"\",\"username\":\"rdd_user\",\"password\":\"rdd_password\",\"dburl\":\"\",\"x\":270,\"y\":80,\"wires\":&#91;&#91;\"1509e182.b483ee\"]]},{\"id\":\"1509e182.b483ee\",\"type\":\"debug\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"active\":false,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"x\":520,\"y\":80,\"wires\":&#91;]},{\"id\":\"f296c947.73beb8\",\"type\":\"inject\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"Injector\",\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"repeat\":\"1\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"x\":240,\"y\":220,\"wires\":&#91;&#91;\"b323c268.e4397\"]]},{\"id\":\"b323c268.e4397\",\"type\":\"random\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"Random Number\",\"low\":\"1\",\"high\":\"10000\",\"inte\":\"true\",\"property\":\"payload\",\"x\":450,\"y\":220,\"wires\":&#91;&#91;\"eebf5ba9.a2d2b8\"]]},{\"id\":\"eebf5ba9.a2d2b8\",\"type\":\"debug\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"active\":false,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"x\":700,\"y\":220,\"wires\":&#91;]},{\"id\":\"395d26f4.1a5f0a\",\"type\":\"ui_gauge\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"group\":\"d025c192.ed41a\",\"order\":1,\"width\":0,\"height\":0,\"gtype\":\"gage\",\"title\":\"gauge\",\"label\":\"units\",\"format\":\"{{value}}\",\"min\":0,\"max\":\"10000\",\"colors\":&#91;\"#00b500\",\"#e6e600\",\"#ca3838\"],\"seg1\":\"\",\"seg2\":\"\",\"x\":670,\"y\":460,\"wires\":&#91;]},{\"id\":\"3afb2eb9.d17e72\",\"type\":\"mqtt in\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"topic\":\"RDD\/RoomTemp\",\"qos\":\"2\",\"datatype\":\"auto\",\"broker\":\"d0846b3e.b21f98\",\"x\":420,\"y\":400,\"wires\":&#91;&#91;\"1526f3c1.45e24c\",\"395d26f4.1a5f0a\",\"fb9e578f.f5acd8\"]]},{\"id\":\"1526f3c1.45e24c\",\"type\":\"debug\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"true\",\"targetType\":\"full\",\"x\":590,\"y\":380,\"wires\":&#91;]},{\"id\":\"fb9e578f.f5acd8\",\"type\":\"function\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"func\":\"msg.object = msg.payload\\nreturn msg;\",\"outputs\":1,\"noerr\":0,\"x\":640,\"y\":560,\"wires\":&#91;&#91;\"8e1b8365.8f909\"]]},{\"id\":\"8e1b8365.8f909\",\"type\":\"debug\",\"z\":\"ab563b90.8fc7c8\",\"name\":\"\",\"active\":false,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"x\":880,\"y\":560,\"wires\":&#91;]},{\"id\":\"42ce8ce6.d53fd4\",\"type\":\"modbus-client\",\"z\":\"\",\"name\":\"Voltage\",\"clienttype\":\"tcp\",\"bufferCommands\":false,\"stateLogEnabled\":false,\"queueLogEnabled\":false,\"tcpHost\":\"192.168.0.25\",\"tcpPort\":\"502\",\"tcpType\":\"DEFAULT\",\"serialPort\":\"COM4\",\"serialType\":\"RTU-BUFFERD\",\"serialBaudrate\":\"9600\",\"serialDatabits\":\"8\",\"serialStopbits\":\"1\",\"serialParity\":\"none\",\"serialConnectionDelay\":\"1\",\"unit_id\":\"5\",\"commandDelay\":\"500\",\"clientTimeout\":\"1000\",\"reconnectOnTimeout\":true,\"reconnectTimeout\":\"2000\",\"parallelUnitIdsAllowed\":false},{\"id\":\"d025c192.ed41a\",\"type\":\"ui_group\",\"z\":\"\",\"name\":\"Group 1\",\"tab\":\"fd0d0d58.30f0e\",\"order\":1,\"disp\":false,\"width\":\"9\",\"collapse\":false},{\"id\":\"d0846b3e.b21f98\",\"type\":\"mqtt-broker\",\"z\":\"\",\"name\":\"\",\"broker\":\"192.168.1.19\",\"port\":\"1883\",\"clientid\":\"\",\"usetls\":false,\"compatmode\":true,\"keepalive\":\"60\",\"cleansession\":true,\"birthTopic\":\"\",\"birthQos\":\"0\",\"birthPayload\":\"\",\"closeTopic\":\"\",\"closeQos\":\"0\",\"closePayload\":\"\",\"willTopic\":\"\",\"willQos\":\"0\",\"willPayload\":\"\"},{\"id\":\"fd0d0d58.30f0e\",\"type\":\"ui_tab\",\"z\":\"\",\"name\":\"Home\",\"icon\":\"dashboard\",\"order\":1,\"disabled\":false,\"hidden\":false}]<\/code><\/pre>\n","protected":false},"author":1,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0},"ht_kb_category":[10],"ht_kb_tag":[],"_links":{"self":[{"href":"https:\/\/wiki.rdd-tech.com\/index.php\/wp-json\/wp\/v2\/ht_kb\/1441"}],"collection":[{"href":"https:\/\/wiki.rdd-tech.com\/index.php\/wp-json\/wp\/v2\/ht_kb"}],"about":[{"href":"https:\/\/wiki.rdd-tech.com\/index.php\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/wiki.rdd-tech.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wiki.rdd-tech.com\/index.php\/wp-json\/wp\/v2\/comments?post=1441"}],"version-history":[{"count":6,"href":"https:\/\/wiki.rdd-tech.com\/index.php\/wp-json\/wp\/v2\/ht_kb\/1441\/revisions"}],"predecessor-version":[{"id":1447,"href":"https:\/\/wiki.rdd-tech.com\/index.php\/wp-json\/wp\/v2\/ht_kb\/1441\/revisions\/1447"}],"wp:attachment":[{"href":"https:\/\/wiki.rdd-tech.com\/index.php\/wp-json\/wp\/v2\/media?parent=1441"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/wiki.rdd-tech.com\/index.php\/wp-json\/wp\/v2\/ht_kb_category?post=1441"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/wiki.rdd-tech.com\/index.php\/wp-json\/wp\/v2\/ht_kb_tag?post=1441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}