[ { "id": "1289abb55256e08f", "type": "tab", "label": "デバイス登録フロー", "disabled": false, "info": "", "env": [] }, { "id": "6f2f53804ee549f0", "type": "credentials", "z": "1289abb55256e08f", "name": " 接続情報の登録", "props": [ { "value": "aws_access_key", "type": "msg" }, { "value": "aws_secret_key", "type": "msg" }, { "value": "aws_iot_region", "type": "msg" }, { "value": "aws_iot_host", "type": "msg" } ], "x": 340, "y": 100, "wires": [ [ "9647264ebe471326" ] ] }, { "id": "6b5730ac0cbac476", "type": "inject", "z": "1289abb55256e08f", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 120, "y": 100, "wires": [ [ "6f2f53804ee549f0" ] ] }, { "id": "9647264ebe471326", "type": "function", "z": "1289abb55256e08f", "name": " デバイス登録の引数設定", "func": "msg.payload = msg.aws_access_key + \":\" + msg.aws_secret_key\n + \" \" + msg.aws_iot_region\n + \" \" + msg.aws_iot_host;\n return msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 570, "y": 100, "wires": [ [ "d95b5ec75023bd9d" ] ] }, { "id": "d95b5ec75023bd9d", "type": "exec queue", "z": "1289abb55256e08f", "name": "デバイス登録", "currentLine": { "row": 5, "column": 7 }, "command": " bash $file", "debugMode": true, "outputs": 1, "useSpawn": "false", "field": "payload", "fieldType": "msg", "format": "sh", "template": "AWS_ACCESS=\"$1\"\nAWS_REGION=\"$2\"\nENDPOINT=\"$3\"\nURI=/things/${AT_SERIAL_NUMBER}\ncurl \\\n --cacert /cert/AmazonRootCA1.pem \\\n --user \"${AWS_ACCESS}\" \\\n --aws-sigv4 \"aws:amz:${AWS_REGION}:execute-api\" \\\n --request POST -v \\\n -d \"{}\" \\\n \"https://${ENDPOINT}${URI}\"", "output": "str", "outputEmpty": false, "vimMode": false, "queue": 1, "addpayCB": true, "splitLine": false, "cleanQueue": true, "x": 140, "y": 160, "wires": [ [ "708d8cc64a6a6e16" ] ] }, { "id": "708d8cc64a6a6e16", "type": "function", "z": "1289abb55256e08f", "name": "デバイス名の取得", "func": "var str = msg.payload;\nvar json = str.substr(str.indexOf(\"{\"),str.indexOf(\"}\"));\nvar res = JSON.parse(json);\nmsg.payload=\"thingName:\" + res.thingName;\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 370, "y": 160, "wires": [ [ "8d0d01639944912c" ] ] }, { "id": "8d0d01639944912c", "type": "debug", "z": "1289abb55256e08f", "name": "debug 1", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 560, "y": 160, "wires": [] } ]