Yandex IoT Core中的Node-RED和流式编程简介



-, Node-RED, . , Node-RED Yandex.Cloud.



, , ( , — 1 2). . , -.



, - . , , . IBM .



Node-RED, ,



, Node-RED — , IBM Emerging Technology Services JS Foundation.



Node-RED , 70- . — «», Node-RED. — , - , . .



, : . - , , , , .



Node-RED Node.js, («Flow») . («Node») . «Deploy» .



, , JSON.



Node-RED 2013 ' - IBM Emerging Technology Services.



Message Queuing Telemetry Transport (MQTT). Node-RED , .



2013 . , Node-RED JS Foundation 2016 .



Node-RED?



:

, «Code Red».

, .

«Node» (/) Node.JS.

, «RED», .

— «Rapid Event Developer» ( ), - .

Node-RED."


Node-RED Apache 2.0. .



, . : Node-RED ( OpenJS Foundation) ; , (Liability/Warranty) — .



— Node-RED c Yandex IoT Core



: . , , . , , Node-RED ( MQTT) IoT Core.



:



  • Node-RED
  • IoT Core
  • IoT- Node-RED
  • IoT-


, , — « », . .



Node-RED





, Node-RED, Yandex.Cloud . Compute Cloud .



CentOS. Node-RED , CentOS.



操作系统选择



, . , Node-RED .



分配资源



SSH, .



SSH . SSH- ssh-keygen -t rsa -b 2048 , .



~/.ssh/is_rsa.pub, SSH- .



网络和SSH





Compute Cloud IPv4.



, . SSH $ ssh <login>@<IPv4>. , .



$ ssh <login>@<IPv4>
Enter passphrase for key '/Users/<user>/.ssh/id_rsa': 

Last login: Wed Jul 15 08:42:53 2020 from <your host ip>
[<login>@node-red ~]$ 


Node-RED



Node-RED. , — Linux installers for Node-RED . CentOS 8, , RPM:



$ bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/rpm/update-nodejs-and-nodered)

...
  Stop Node-RED                       
  Install Node.js LTS                    Node v10.19.0   Npm 6.13.4
  Install Node-RED core                  1.1.2 
  Add shortcut commands               
  Update systemd script               
  Update public zone firewall rule    

Any errors will be logged to   /var/log/nodered-install.log
All done.
  You can now start Node-RED with the command  node-red-start
  Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880
...


LTS- Node.js, Node-RED, systemd 1880 . :



$ node-red-start


: Node-RED Ctrl+C.



systemctl:



$ sudo systemctl enable --now nodered.service


http://{ip }:1880 Node-RED.



启动Node-RED



Yandex IoT Core



, IoT Core . . .



IoT Core : -. , . — 14 .



注册创建



.



.



ID ( ), . : ID.



Node-RED



http://{ip }:1880. , .



Node-RED Import. Flow .json , select a file to import.



flow testing connection.



. Send dataInject, flow.



Device payload — -, JavaScript , .



device mqtt-out- MQTT-, .



设备流量



device.



<id_> ID IoT Core. Server. Security username — ID , password — , . Update, Done.



: Deploy. device connected.



flow dashboard . , . Manage palette. Install node-red-dashboard . node-red-contrib-web-worldmap.



Flow , .



, registrymqtt-in-, .



, json. JSON- JS- .



Parsing JSON JSON , , Dashboard.



应用流程



registry. flow ID iot-core-subscription.



Security , Deploy.



, registry connected.



( ) Dashboard. Dashboard :



仪表板链接



flow testing connection , , flow Smart Utilities, , Dashboard , IoT Core.



仪表板





Node-RED , . "debug" "debug messages". , . — - , , , , , JSON . "Network", "mqtt in/out", Yandex IoT Core .



, , JSON. Node-RED , « , , ». .







:






All Articles