「.NET 開発基盤部会 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。
ちょっと触ることになったので。
モノのインターネットを配線するための
Node-REDのダッシュボードUI
Open APIドキュメントや関数ノードのソースなど、
様々なソースからNode-REDノードモジュールを生成するCLI
Node-REDインスタンスをリモートで管理できるCLI
システム間の接続インタフェース(API)を統合管理する技術
Docker環境を準備して、以下を行う。
FROM nodered/node-red RUN mkdir -p $HOME/.node-red RUN cd $HOME/.node-red RUN npm install node-red-contrib-aedes
docker build -t nodered-sample:p1 .
version: '3.4' services: nodered_sample: image: nodered-sample:p1 ports: - "1880:1880" - "1883:1883"
※ portsは、ホスト側:コンテナ側で、1880は、HTTP。1883は、MQTT。
起動したら、以下のURLにアクセスする。
フロー・エディタが起動する。
フローの実装が完了したら、デプロイ・ボタンを押下。
フローのインポート / エクスポート
[ { "id": "f6f2187d.f17ca8", "type": "tab", "label": "Flow 1", "disabled": false, "info": "" }, { "id": "3e63d5c0.89476a", "type": "http in", "z": "f6f2187d.f17ca8", "name": "HTTP Endpoint", "url": "hoge/:param", "method": "get", "upload": false, "swaggerDoc": "", "x": 160, "y": 320, "wires": [ [ "3dcdaca5.9f0f64" ] ] }, { "id": "7027d3d1.6d81fc", "type": "debug", "z": "f6f2187d.f17ca8", "name": "Debug", "active": true, "tosidebar": true, "console": true, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 420, "y": 260, "wires": [] }, { "id": "4cd59e40.9521f", "type": "http response", "z": "f6f2187d.f17ca8", "name": "HTTP Response", "statusCode": "200", "headers": {}, "x": 500, "y": 340, "wires": [] }, { "id": "3dcdaca5.9f0f64", "type": "template", "z": "f6f2187d.f17ca8", "name": "page", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "<!DOCTYPE html>\n<html lang=”en”>\n<head>\n<title>Response Named Parameters</title>\n</head>\n<h1>Page found Named Parameters {{req.params.param}}</h1>\n</html>", "output": "str", "x": 330, "y": 340, "wires": [ [ "4cd59e40.9521f", "7027d3d1.6d81fc" ] ] } ]
[ { "id": "f6f2187d.f17ca8", "type": "tab", "label": "Flow 1", "disabled": false, "info": "" }, { "id": "1d2a9951.8880c7", "type": "aedes broker", "z": "f6f2187d.f17ca8", "name": "", "mqtt_port": 1883, "mqtt_ws_port": "", "cert": "", "key": "", "certname": "", "keyname": "", "dburl": "", "usetls": false, "x": 240, "y": 100, "wires": [ [ "b9d42de9.5a91f" ] ] }, { "id": "b9d42de9.5a91f", "type": "debug", "z": "f6f2187d.f17ca8", "name": "", "active": true, "tosidebar": true, "console": true, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 450, "y": 100, "wires": [] }, { "id": "70b86e52.71106", "type": "mqtt in", "z": "f6f2187d.f17ca8", "name": "", "topic": "hoge", "qos": "2", "datatype": "auto", "broker": "e9b0ae32.61f46", "x": 210, "y": 160, "wires": [ [ "ba2f427b.97b3f" ] ] }, { "id": "ba2f427b.97b3f", "type": "debug", "z": "f6f2187d.f17ca8", "name": "", "active": true, "tosidebar": true, "console": true, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 460, "y": 160, "wires": [] }, { "id": "e9b0ae32.61f46", "type": "mqtt-broker", "name": "hoge", "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": "" } ]
mosquitto_pub -h localhost -p 1883 -t message -m 'hoge' -d