fork(1) download
  1. [
  2. {
  3. "id": "7b9a0807.ce73c8",
  4. "type": "subflow",
  5. "name": "Lấy dữ từ iNut (10)",
  6. "info": "",
  7. "in": [
  8. {
  9. "x": 50,
  10. "y": 30,
  11. "wires": [
  12. {
  13. "id": "87c91422.62a1b8"
  14. }
  15. ]
  16. }
  17. ],
  18. "out": [
  19. {
  20. "x": 1000,
  21. "y": 280,
  22. "wires": [
  23. {
  24. "id": "eea5251a.05e808",
  25. "port": 0
  26. }
  27. ]
  28. }
  29. ],
  30. "inputLabels": [
  31. "Nhận đầu vào MQTT IN từ iNut cảm biến"
  32. ],
  33. "outputLabels": [
  34. "Luồng cảm biến 1"
  35. ]
  36. },
  37. {
  38. "id": "87c91422.62a1b8",
  39. "type": "json",
  40. "z": "7b9a0807.ce73c8",
  41. "name": "",
  42. "property": "payload",
  43. "action": "",
  44. "pretty": false,
  45. "x": 165,
  46. "y": 84,
  47. "wires": [
  48. [
  49. "ad0dbf89.1666b"
  50. ]
  51. ]
  52. },
  53. {
  54. "id": "eea5251a.05e808",
  55. "type": "switch",
  56. "z": "7b9a0807.ce73c8",
  57. "name": "Phân luồn",
  58. "property": "relayId",
  59. "propertyType": "msg",
  60. "rules": [
  61. {
  62. "t": "eq",
  63. "v": "0",
  64. "vt": "num"
  65. }
  66. ],
  67. "checkall": "true",
  68. "repair": false,
  69. "outputs": 1,
  70. "x": 825.9869575500488,
  71. "y": 288.1562738418579,
  72. "wires": [
  73. []
  74. ]
  75. },
  76. {
  77. "id": "ad0dbf89.1666b",
  78. "type": "function",
  79. "z": "7b9a0807.ce73c8",
  80. "name": "Lặp",
  81. "func": "if (!msg.states) {\n msg.states = msg.payload\n msg.i = 0\n return msg;\n} else {\n msg.i++\n if (msg.states[msg.i])\n return msg;\n}\n",
  82. "outputs": 1,
  83. "noerr": 0,
  84. "x": 327.89060974121094,
  85. "y": 83.33600330352783,
  86. "wires": [
  87. [
  88. "9ad5ebb3.5fcbc8"
  89. ]
  90. ]
  91. },
  92. {
  93. "id": "9ad5ebb3.5fcbc8",
  94. "type": "function",
  95. "z": "7b9a0807.ce73c8",
  96. "name": "Lấy trạng thái thiết bị",
  97. "func": "msg.relayId = msg.i\nmsg.payload = msg.states[msg.i].state\nreturn msg;",
  98. "outputs": 1,
  99. "noerr": 0,
  100. "x": 477.89060974121094,
  101. "y": 183.33600330352783,
  102. "wires": [
  103. [
  104. "ad0dbf89.1666b",
  105. "eea5251a.05e808"
  106. ]
  107. ]
  108. },
  109. {
  110. "id": "7ca3223e.632e0c",
  111. "type": "subflow:7b9a0807.ce73c8",
  112. "z": "a03f7e6d.55604",
  113. "name": "",
  114. "x": 430,
  115. "y": 260,
  116. "wires": [
  117. [
  118. "b990965d.4e3c38"
  119. ]
  120. ]
  121. },
  122. {
  123. "id": "6cb706fa.834538",
  124. "type": "function",
  125. "z": "a03f7e6d.55604",
  126. "name": "",
  127. "func": "var command = msg.topic + ' ';\nif (msg.payload == 1) {\n command = command + '1 OFF';\n} else {\n command = command + '0 ON';\n}\nmsg.payload = {\n id: 0,\n command: command\n}\nreturn msg;",
  128. "outputs": 1,
  129. "noerr": 0,
  130. "x": 1450,
  131. "y": 200,
  132. "wires": [
  133. [
  134. "3eeaa6ea.33deea"
  135. ]
  136. ]
  137. },
  138. {
  139. "id": "eaa12ff5.7f651",
  140. "type": "ui_button",
  141. "z": "a03f7e6d.55604",
  142. "name": "",
  143. "group": "72aa2c44.6511e4",
  144. "order": 3,
  145. "width": "2",
  146. "height": "2",
  147. "passthru": false,
  148. "label": "OFF",
  149. "tooltip": "",
  150. "color": "RED",
  151. "bgcolor": "yellow",
  152. "icon": "",
  153. "payload": "0",
  154. "payloadType": "num",
  155. "topic": "LOCK",
  156. "x": 1270,
  157. "y": 220,
  158. "wires": [
  159. [
  160. "6cb706fa.834538"
  161. ]
  162. ]
  163. },
  164. {
  165. "id": "46aabd82.3304b4",
  166. "type": "ui_button",
  167. "z": "a03f7e6d.55604",
  168. "name": "",
  169. "group": "72aa2c44.6511e4",
  170. "order": 1,
  171. "width": "2",
  172. "height": "2",
  173. "passthru": false,
  174. "label": "ON",
  175. "tooltip": "",
  176. "color": "RED",
  177. "bgcolor": "yellow",
  178. "icon": "",
  179. "payload": "1",
  180. "payloadType": "num",
  181. "topic": "LOCK",
  182. "x": 1270,
  183. "y": 180,
  184. "wires": [
  185. [
  186. "6cb706fa.834538"
  187. ]
  188. ]
  189. },
  190. {
  191. "id": "1575f5b.b7df10a",
  192. "type": "ui_text",
  193. "z": "a03f7e6d.55604",
  194. "group": "c16842a5.e4714",
  195. "order": 1,
  196. "width": 0,
  197. "height": 0,
  198. "name": "",
  199. "label": "Status",
  200. "format": "{{msg.payload}}",
  201. "layout": "row-spread",
  202. "x": 1110,
  203. "y": 160,
  204. "wires": []
  205. },
  206. {
  207. "id": "cd16af16.09c5b",
  208. "type": "change",
  209. "z": "a03f7e6d.55604",
  210. "name": "ONLINE",
  211. "rules": [
  212. {
  213. "t": "set",
  214. "p": "payload",
  215. "pt": "msg",
  216. "to": "ONLINE",
  217. "tot": "str"
  218. }
  219. ],
  220. "action": "",
  221. "property": "",
  222. "from": "",
  223. "to": "",
  224. "reg": false,
  225. "x": 960,
  226. "y": 120,
  227. "wires": [
  228. [
  229. "1575f5b.b7df10a",
  230. "3d53a718.5b8b58"
  231. ]
  232. ]
  233. },
  234. {
  235. "id": "a61218d.370e7e8",
  236. "type": "switch",
  237. "z": "a03f7e6d.55604",
  238. "name": "Kiểm tra ONLINE",
  239. "property": "payload.status",
  240. "propertyType": "msg",
  241. "rules": [
  242. {
  243. "t": "eq",
  244. "v": "0",
  245. "vt": "num"
  246. },
  247. {
  248. "t": "eq",
  249. "v": "-1",
  250. "vt": "num"
  251. }
  252. ],
  253. "checkall": "true",
  254. "repair": false,
  255. "outputs": 2,
  256. "x": 790,
  257. "y": 160,
  258. "wires": [
  259. [
  260. "cd16af16.09c5b"
  261. ],
  262. [
  263. "a0e398cf.880838"
  264. ]
  265. ]
  266. },
  267. {
  268. "id": "a0e398cf.880838",
  269. "type": "change",
  270. "z": "a03f7e6d.55604",
  271. "name": "OFFLINE",
  272. "rules": [
  273. {
  274. "t": "set",
  275. "p": "payload",
  276. "pt": "msg",
  277. "to": "OFFLINE",
  278. "tot": "str"
  279. }
  280. ],
  281. "action": "",
  282. "property": "",
  283. "from": "",
  284. "to": "",
  285. "reg": false,
  286. "x": 960,
  287. "y": 180,
  288. "wires": [
  289. [
  290. "1575f5b.b7df10a"
  291. ]
  292. ]
  293. },
  294. {
  295. "id": "99cf9920.2b8c68",
  296. "type": "json",
  297. "z": "a03f7e6d.55604",
  298. "name": "",
  299. "property": "payload",
  300. "action": "",
  301. "pretty": false,
  302. "x": 630,
  303. "y": 160,
  304. "wires": [
  305. [
  306. "a61218d.370e7e8"
  307. ]
  308. ]
  309. },
  310. {
  311. "id": "d39c7e26.477bf",
  312. "type": "inject",
  313. "z": "a03f7e6d.55604",
  314. "name": "",
  315. "topic": "",
  316. "payload": "",
  317. "payloadType": "date",
  318. "repeat": "",
  319. "crontab": "",
  320. "once": true,
  321. "onceDelay": 0.1,
  322. "x": 110,
  323. "y": 120,
  324. "wires": [
  325. [
  326. "b55a77df.292828"
  327. ]
  328. ]
  329. },
  330. {
  331. "id": "3eeaa6ea.33deea",
  332. "type": "link out",
  333. "z": "a03f7e6d.55604",
  334. "name": "OUT_RES_PORT",
  335. "links": [
  336. "b6df0cb7.9c668"
  337. ],
  338. "x": 1555,
  339. "y": 200,
  340. "wires": []
  341. },
  342. {
  343. "id": "b6df0cb7.9c668",
  344. "type": "link in",
  345. "z": "a03f7e6d.55604",
  346. "name": "REST_POST",
  347. "links": [
  348. "3850f97b.cf5b76",
  349. "3eeaa6ea.33deea",
  350. "b3ced61c.061d58",
  351. "361dbb9e.e7b7e4"
  352. ],
  353. "x": 35,
  354. "y": 180,
  355. "wires": [
  356. [
  357. "5efd3dcc.07ddc4"
  358. ]
  359. ]
  360. },
  361. {
  362. "id": "5b61d3a7.4d19bc",
  363. "type": "ui_gauge",
  364. "z": "a03f7e6d.55604",
  365. "name": "",
  366. "group": "72aa2c44.6511e4",
  367. "order": 2,
  368. "width": "2",
  369. "height": "2",
  370. "gtype": "gage",
  371. "title": "LOCK",
  372. "label": "units",
  373. "format": "{{value}}",
  374. "min": 0,
  375. "max": "1",
  376. "colors": [
  377. "#00b500",
  378. "#e6e600",
  379. "#ca3838"
  380. ],
  381. "seg1": "",
  382. "seg2": "",
  383. "x": 770,
  384. "y": 300,
  385. "wires": []
  386. },
  387. {
  388. "id": "b4943ab2.a09298",
  389. "type": "link out",
  390. "z": "a03f7e6d.55604",
  391. "name": "RELOAD",
  392. "links": [
  393. "1548c7f6.656998"
  394. ],
  395. "x": 1575,
  396. "y": 100,
  397. "wires": []
  398. },
  399. {
  400. "id": "1548c7f6.656998",
  401. "type": "link in",
  402. "z": "a03f7e6d.55604",
  403. "name": "RELOAD",
  404. "links": [
  405. "b4943ab2.a09298"
  406. ],
  407. "x": 95,
  408. "y": 40,
  409. "wires": [
  410. [
  411. "b55a77df.292828"
  412. ]
  413. ]
  414. },
  415. {
  416. "id": "a3d75404.741bf8",
  417. "type": "change",
  418. "z": "a03f7e6d.55604",
  419. "name": "",
  420. "rules": [
  421. {
  422. "t": "set",
  423. "p": "topic",
  424. "pt": "msg",
  425. "to": "POST",
  426. "tot": "str"
  427. }
  428. ],
  429. "action": "",
  430. "property": "",
  431. "from": "",
  432. "to": "",
  433. "reg": false,
  434. "x": 470,
  435. "y": 180,
  436. "wires": [
  437. [
  438. "99cf9920.2b8c68"
  439. ]
  440. ]
  441. },
  442. {
  443. "id": "3d53a718.5b8b58",
  444. "type": "switch",
  445. "z": "a03f7e6d.55604",
  446. "name": "",
  447. "property": "topic",
  448. "propertyType": "msg",
  449. "rules": [
  450. {
  451. "t": "eq",
  452. "v": "POST",
  453. "vt": "str"
  454. }
  455. ],
  456. "checkall": "true",
  457. "repair": false,
  458. "outputs": 1,
  459. "x": 1110,
  460. "y": 100,
  461. "wires": [
  462. [
  463. "4eec935.cffc06c",
  464. "411c08fb.7f07e8"
  465. ]
  466. ]
  467. },
  468. {
  469. "id": "4eec935.cffc06c",
  470. "type": "delay",
  471. "z": "a03f7e6d.55604",
  472. "name": "",
  473. "pauseType": "delay",
  474. "timeout": "50",
  475. "timeoutUnits": "milliseconds",
  476. "rate": "1",
  477. "nbRateUnits": "1",
  478. "rateUnits": "second",
  479. "randomFirst": "1",
  480. "randomLast": "5",
  481. "randomUnits": "seconds",
  482. "drop": false,
  483. "x": 1270,
  484. "y": 80,
  485. "wires": [
  486. [
  487. "3892ce03.26e722"
  488. ]
  489. ]
  490. },
  491. {
  492. "id": "3892ce03.26e722",
  493. "type": "change",
  494. "z": "a03f7e6d.55604",
  495. "name": "",
  496. "rules": [
  497. {
  498. "t": "delete",
  499. "p": "topic",
  500. "pt": "msg"
  501. }
  502. ],
  503. "action": "",
  504. "property": "",
  505. "from": "",
  506. "to": "",
  507. "reg": false,
  508. "x": 1440,
  509. "y": 100,
  510. "wires": [
  511. [
  512. "b4943ab2.a09298"
  513. ]
  514. ]
  515. },
  516. {
  517. "id": "411c08fb.7f07e8",
  518. "type": "delay",
  519. "z": "a03f7e6d.55604",
  520. "name": "",
  521. "pauseType": "delay",
  522. "timeout": "250",
  523. "timeoutUnits": "milliseconds",
  524. "rate": "1",
  525. "nbRateUnits": "1",
  526. "rateUnits": "second",
  527. "randomFirst": "1",
  528. "randomLast": "5",
  529. "randomUnits": "seconds",
  530. "drop": false,
  531. "x": 1270,
  532. "y": 120,
  533. "wires": [
  534. [
  535. "3892ce03.26e722"
  536. ]
  537. ]
  538. },
  539. {
  540. "id": "e147a1d.b7cbe6",
  541. "type": "mqtt in",
  542. "z": "a03f7e6d.55604",
  543. "name": "[MQTT-IN]iNut cảm biến - iNut M1",
  544. "topic": "request/dkjTobCPXidsp7X1NqzKFQbQ4z02/SyVEreTK4/ccff6a10caddfc13fee619eb7065f4cb302880090088",
  545. "qos": "2",
  546. "broker": "5421618d.ae96c",
  547. "x": 160,
  548. "y": 260,
  549. "wires": [
  550. [
  551. "7ca3223e.632e0c"
  552. ]
  553. ]
  554. },
  555. {
  556. "id": "b55a77df.292828",
  557. "type": "http request",
  558. "z": "a03f7e6d.55604",
  559. "name": "[REST][GET]iNut cảm biến - iNut M1",
  560. "method": "GET",
  561. "ret": "txt",
  562. "url": "https://c...content-available-to-author-only...e.vn/api/1.0/request/dkjTobCPXidsp7X1NqzKFQbQ4z02/SyVEreTK4/ccff6a10caddfc13fee619eb7065f4cb302880090088/req_device",
  563. "tls": "",
  564. "x": 370,
  565. "y": 120,
  566. "wires": [
  567. [
  568. "99cf9920.2b8c68"
  569. ]
  570. ]
  571. },
  572. {
  573. "id": "5efd3dcc.07ddc4",
  574. "type": "http request",
  575. "z": "a03f7e6d.55604",
  576. "name": "[REST][POST]iNut cảm biến - iNut M1",
  577. "method": "POST",
  578. "ret": "txt",
  579. "url": "https://c...content-available-to-author-only...e.vn/api/1.0/request/dkjTobCPXidsp7X1NqzKFQbQ4z02/SyVEreTK4/ccff6a10caddfc13fee619eb7065f4cb302880090088/req_device_toggle",
  580. "tls": "",
  581. "x": 210,
  582. "y": 180,
  583. "wires": [
  584. [
  585. "a3d75404.741bf8"
  586. ]
  587. ]
  588. },
  589. {
  590. "id": "b990965d.4e3c38",
  591. "type": "change",
  592. "z": "a03f7e6d.55604",
  593. "name": "",
  594. "rules": [
  595. {
  596. "t": "set",
  597. "p": "topic",
  598. "pt": "msg",
  599. "to": "Trạng Thái",
  600. "tot": "str"
  601. }
  602. ],
  603. "action": "",
  604. "property": "",
  605. "from": "",
  606. "to": "",
  607. "reg": false,
  608. "x": 610,
  609. "y": 260,
  610. "wires": [
  611. [
  612. "5b63ccaf.7c4fe4",
  613. "5b61d3a7.4d19bc"
  614. ]
  615. ]
  616. },
  617. {
  618. "id": "5b63ccaf.7c4fe4",
  619. "type": "function",
  620. "z": "a03f7e6d.55604",
  621. "name": "",
  622. "func": "var trangthai;\nif (msg.payload == 0) {\n trangthai = \"Đóng\";\n}\nelse if (msg.payload == 1) {\n trangthai = \"Mở\";\n}\nmsg.payload = trangthai;\nreturn msg;",
  623. "outputs": 1,
  624. "noerr": 0,
  625. "x": 770,
  626. "y": 240,
  627. "wires": [
  628. [
  629. "ccfdd94f.6e6228"
  630. ]
  631. ]
  632. },
  633. {
  634. "id": "ccfdd94f.6e6228",
  635. "type": "ui_text",
  636. "z": "a03f7e6d.55604",
  637. "group": "72aa2c44.6511e4",
  638. "order": 0,
  639. "width": 0,
  640. "height": 0,
  641. "name": "",
  642. "label": "Trạng Thái: ",
  643. "format": "{{msg.payload}}",
  644. "layout": "row-spread",
  645. "x": 950,
  646. "y": 240,
  647. "wires": []
  648. },
  649. {
  650. "id": "72aa2c44.6511e4",
  651. "type": "ui_group",
  652. "z": "",
  653. "name": "Group 1",
  654. "tab": "e59646ac.c34d18",
  655. "order": 1,
  656. "disp": false,
  657. "width": "6",
  658. "collapse": false
  659. },
  660. {
  661. "id": "c16842a5.e4714",
  662. "type": "ui_group",
  663. "z": "",
  664. "name": "Group 2",
  665. "tab": "e59646ac.c34d18",
  666. "order": 2,
  667. "disp": false,
  668. "width": "6",
  669. "collapse": false
  670. },
  671. {
  672. "id": "5421618d.ae96c",
  673. "type": "mqtt-broker",
  674. "name": "",
  675. "broker": "mqtt.mysmarthome.vn",
  676. "port": "1883",
  677. "clientid": "",
  678. "usetls": false,
  679. "compatmode": true,
  680. "keepalive": "60",
  681. "cleansession": true,
  682. "willTopic": "",
  683. "willQos": "0",
  684. "willPayload": "",
  685. "birthTopic": "",
  686. "birthQos": "0",
  687. "birthPayload": ""
  688. },
  689. {
  690. "id": "e59646ac.c34d18",
  691. "type": "ui_tab",
  692. "name": "Tab 1",
  693. "icon": "dashboard",
  694. "order": 1
  695. }
  696. ]
Success #stdin #stdout 0.31s 2181632KB
stdin
Standard input is empty
stdout
Standard output is empty