Node-RED

Node-RED の健全性チェック

Web ブラウザで、https://node-red.local を開いて、 Node-RED GUI にアクセスします。

Node-RED API へのアクセス

Node-RED Admin HTTP API にアクセスします。

Node-RED Admin HTTP API へのアクセス

リクエスト:

curl http://<your local IP address>:1880/settings

レスポンス:

{
  "httpNodeRoot": "/",
  "version": "3.1.0",
  "context": {
    "default": "memory",
    "stores": [
      "memory"
    ]
  },
  "codeEditor": {
    "lib": "monaco",
    "options": {}
  },
  "markdownEditor": {
    "mermaid": {
      "enabled": true
    }
  },
  "libraries": [
    {
      "id": "local",
      "label": "editor:library.types.local",
      "user": false,
      "icon": "font-awesome/fa-hdd-o"
    },
    {
      "id": "examples",
      "label": "editor:library.types.examples",
      "user": false,
      "icon": "font-awesome/fa-life-ring",
      "types": [
        "flows"
      ],
      "readOnly": true
    }
  ],
  "flowFilePretty": true,
  "externalModules": {},
  "flowEncryptionType": "system",
  "diagnostics": {
    "enabled": true,
    "ui": true
  },
  "runtimeState": {
    "enabled": false,
    "ui": false
  },
  "functionExternalModules": true,
  "functionTimeout": 0,
  "tlsConfigDisableLocalFiles": false,
  "editorTheme": {
    "palette": {},
    "projects": {
      "enabled": false,
      "workflow": {
        "mode": "manual"
      }
    },
    "languages": [
      "de",
      "en-US",
      "fr",
      "ja",
      "ko",
      "pt-BR",
      "ru",
      "zh-CN",
      "zh-TW"
    ]
  }
}

NGSI node の使用方法

エンティティを作成

リクエスト:

ngsi create \
  --host orion.local \
  entity \
  --data '{"id":"device001"}' \
  --keyValues

エンティティを取得

リクエスト:

ngsi get \
  --host orion.local \
  entity \
  --id device001 \
  --pretty

レスポンス:

{
  "id": "device001",
  "type": "Thing"
}

フローを作成

[{"id":"f5717ef56f6b92ee","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"d64a75632b691651","type":"NGSI Entity","z":"f5717ef56f6b92ee","openapis":"c574ed7e49fe8012","servicepath":"/","mode":"normalized","entitytype":"","attrs":"","x":410,"y":100,"wires":[["1600fecad297713b"]]},{"id":"ac8c9b2cb6a23119","type":"inject","z":"f5717ef56f6b92ee","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"device001","payloadType":"str","x":240,"y":100,"wires":[["d64a75632b691651"]]},{"id":"1600fecad297713b","type":"debug","z":"f5717ef56f6b92ee","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":100,"wires":[]},{"id":"c574ed7e49fe8012","type":"Open APIs","name":"","brokerEndpoint":"https://orion.local","service":"","idmEndpoint":"https://orion.local","idmType":"tokenproxy"}]

ノードの構成

NGSI Entity node の構成

新しい Open API エンドポイントを追加します。

  • Open APIs endpoint の構成

Context-Broker node の構成

ブローカー・エンドポイントとセキュリティ構成をセットアップします。

  • Broker Endpoint: http://<your local IP address>:1026

ペイロードを挿入

こちらの例を参照ください。

関連情報