[ { "id": "831518904a3450aa", "type": "tab", "label": "電力データ取得/MQTT通信", "disabled": false, "info": "", "env": [] }, { "id": "081024cde6a0ad84", "type": "group", "z": "831518904a3450aa", "style": { "stroke": "#999999", "stroke-opacity": "1", "fill": "none", "fill-opacity": "1", "label": true, "label-position": "nw", "color": "#a4a4a4" }, "nodes": [ "625c44dce8ea826c", "3f2053f1c9b58f7e", "10ba58a9c5c05e1f" ], "x": 864, "y": 214, "w": 427, "h": 127 }, { "id": "4125ab23585ce006", "type": "group", "z": "831518904a3450aa", "style": { "stroke": "#999999", "stroke-opacity": "1", "fill": "none", "fill-opacity": "1", "label": true, "label-position": "nw", "color": "#a4a4a4" }, "nodes": [ "88df81c1ab8ae059", "61ee97ded5a0ee8b", "bfcafe7abb441d9d", "9137be4b20fd64dc", "35cd92335aa15cd4", "8d34c538739d9ec6" ], "x": 199, "y": 64, "w": 632, "h": 232 }, { "id": "c5b76275c84f2c22", "type": "group", "z": "831518904a3450aa", "style": { "stroke": "#999999", "stroke-opacity": "1", "fill": "none", "fill-opacity": "1", "label": true, "label-position": "nw", "color": "#a4a4a4" }, "nodes": [ "4600341c8de19c21", "a6ece2fe223ee883", "c7f574c106fc247c", "62597c76e92db67b" ], "x": 864, "y": 64, "w": 632, "h": 127 }, { "id": "dad909a7a0bd1271", "type": "group", "z": "831518904a3450aa", "style": { "stroke": "#999999", "stroke-opacity": "1", "fill": "none", "fill-opacity": "1", "label": true, "label-position": "nw", "color": "#a4a4a4" }, "nodes": [ "20b8949d456e456f", "aa4b8e98d7c05b38", "c94c2188cf0ebb54", "7d72fce8d119e3cc", "12999af31f848398" ], "x": 209, "y": 679, "w": 837, "h": 127 }, { "id": "47544d16bdfa8e2a", "type": "group", "z": "831518904a3450aa", "style": { "stroke": "#999999", "stroke-opacity": "1", "fill": "none", "fill-opacity": "1", "label": true, "label-position": "nw", "color": "#a4a4a4" }, "nodes": [ "29a51ff20ababa3b", "5bafce1711d0f051", "9e546c85dd00e47f", "5a2117c385e7c553", "67b123fc6b48a7c2" ], "x": 209, "y": 529, "w": 837, "h": 127 }, { "id": "43288f5ea823c31f", "type": "group", "z": "831518904a3450aa", "style": { "stroke": "#999999", "stroke-opacity": "1", "fill": "none", "fill-opacity": "1", "label": true, "label-position": "nw", "color": "#a4a4a4" }, "nodes": [ "e63657b1010a68aa", "bdf53f6fa471e2c6", "8d7daa962b436db5", "ea7789c2d0b7284b", "16faee32cc6309d1" ], "x": 209, "y": 379, "w": 737, "h": 127 }, { "id": "02c6312074a39c65", "type": "group", "z": "831518904a3450aa", "style": { "stroke": "#999999", "stroke-opacity": "1", "fill": "none", "fill-opacity": "1", "label": true, "label-position": "nw", "color": "#a4a4a4" }, "nodes": [ "7394bcb210d54d41", "3a399af662d80b3e", "97377c3a5bd9abe1" ], "x": 214, "y": 829, "w": 352, "h": 127 }, { "id": "bfcafe7abb441d9d", "type": "change", "z": "831518904a3450aa", "g": "4125ab23585ce006", "name": "エラーカウント初期化", "rules": [ { "t": "set", "p": "error.source.count", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 460, "y": 150, "wires": [ [ "35cd92335aa15cd4" ] ] }, { "id": "88df81c1ab8ae059", "type": "change", "z": "831518904a3450aa", "g": "4125ab23585ce006", "name": "初期値/MAX値の設定", "rules": [ { "t": "set", "p": "count", "pt": "global", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 325, "y": 255, "wires": [ [ "9137be4b20fd64dc" ] ] }, { "id": "4600341c8de19c21", "type": "mqtt out", "z": "831518904a3450aa", "g": "c5b76275c84f2c22", "name": "", "topic": "", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "e894cd50b6f2fa81", "x": 1420, "y": 150, "wires": [] }, { "id": "a6ece2fe223ee883", "type": "function", "z": "831518904a3450aa", "g": "c5b76275c84f2c22", "name": "MQTTアップロードデータを設定", "func": "msg.topic = env.get(\"ENERGY_TYPE\") + \"/\" + global.get(\"date1\") + \"/\" + global.get(\"thing_name\") + global.get(\"datetime2\") + \".json\";\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1210, "y": 150, "wires": [ [ "4600341c8de19c21", "d6863027ad6e55ce" ] ] }, { "id": "51d324283e7fdf48", "type": "link in", "z": "831518904a3450aa", "name": "HEAD", "links": [ "9893886abbdf19ee" ], "x": 165, "y": 255, "wires": [ [ "88df81c1ab8ae059" ] ] }, { "id": "d6863027ad6e55ce", "type": "debug", "z": "831518904a3450aa", "name": "debug 8", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1440, "y": 30, "wires": [] }, { "id": "6a16d4693a07e6d5", "type": "debug", "z": "831518904a3450aa", "name": "debug 9", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 810, "y": 870, "wires": [] }, { "id": "c7f574c106fc247c", "type": "file in", "z": "831518904a3450aa", "g": "c5b76275c84f2c22", "name": "", "filename": "/root/mqtt.json", "filenameType": "str", "format": "utf8", "chunk": false, "sendError": false, "encoding": "none", "allProps": false, "x": 970, "y": 150, "wires": [ [ "a6ece2fe223ee883" ] ] }, { "id": "625c44dce8ea826c", "type": "file", "z": "831518904a3450aa", "g": "081024cde6a0ad84", "name": "", "filename": "/root/mqtt.json", "filenameType": "str", "appendNewline": true, "createDir": false, "overwriteFile": "delete", "encoding": "none", "x": 1165, "y": 300, "wires": [ [ "cf26ead0b7fd5fed" ] ] }, { "id": "3f2053f1c9b58f7e", "type": "comment", "z": "831518904a3450aa", "g": "081024cde6a0ad84", "name": "mqttアップロードファイル削除", "info": "", "x": 1025, "y": 255, "wires": [] }, { "id": "62597c76e92db67b", "type": "comment", "z": "831518904a3450aa", "g": "c5b76275c84f2c22", "name": "MQTT送信", "info": "", "x": 950, "y": 105, "wires": [] }, { "id": "61ee97ded5a0ee8b", "type": "comment", "z": "831518904a3450aa", "g": "4125ab23585ce006", "name": "LOOP_MAXまでループ", "info": "", "x": 325, "y": 105, "wires": [] }, { "id": "77441adec7dca7c8", "type": "link in", "z": "831518904a3450aa", "name": "HEAD", "links": [ "d791a329f0af27c5" ], "x": 165, "y": 210, "wires": [ [ "35cd92335aa15cd4" ] ] }, { "id": "d791a329f0af27c5", "type": "link out", "z": "831518904a3450aa", "name": "積算有効電力量(Wh)", "mode": "link", "links": [ "77441adec7dca7c8" ], "x": 765, "y": 930, "wires": [] }, { "id": "10ba58a9c5c05e1f", "type": "complete", "z": "831518904a3450aa", "g": "081024cde6a0ad84", "name": "", "scope": [ "4600341c8de19c21" ], "uncaught": false, "x": 960, "y": 300, "wires": [ [ "625c44dce8ea826c" ] ] }, { "id": "cf26ead0b7fd5fed", "type": "debug", "z": "831518904a3450aa", "name": "debug 12", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1425, "y": 300, "wires": [] }, { "id": "20b8949d456e456f", "type": "modbus-flex-getter", "z": "831518904a3450aa", "g": "dad909a7a0bd1271", "name": "", "showStatusActivities": false, "showErrors": true, "showWarnings": true, "logIOActivities": false, "server": "d6c967a84a7d56dd", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": true, "keepMsgProperties": true, "delayOnStart": false, "startDelayTime": "10", "x": 540, "y": 765, "wires": [ [], [ "7d72fce8d119e3cc" ] ] }, { "id": "aa4b8e98d7c05b38", "type": "function", "z": "831518904a3450aa", "g": "dad909a7a0bd1271", "name": "積算有効電力量(kWh)", "func": "msg.payload = { \n 'fc': 3,\n 'unitid': global.get(\"count\"),\n 'address': 544,\n 'quantity': 10\n};\n\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 335, "y": 765, "wires": [ [ "20b8949d456e456f" ] ] }, { "id": "c94c2188cf0ebb54", "type": "change", "z": "831518904a3450aa", "g": "dad909a7a0bd1271", "name": "積算有効電力量(kWh)を保存", "rules": [ { "t": "set", "p": "total_power_consumption2", "pt": "global", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 900, "y": 765, "wires": [ [ "7394bcb210d54d41" ] ] }, { "id": "7d72fce8d119e3cc", "type": "function", "z": "831518904a3450aa", "g": "dad909a7a0bd1271", "name": "換算", "func": "msg.payload = msg.payload.data[0] * 65535 + msg.payload.data[1];\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 710, "y": 765, "wires": [ [ "c94c2188cf0ebb54" ] ] }, { "id": "12999af31f848398", "type": "comment", "z": "831518904a3450aa", "g": "dad909a7a0bd1271", "name": "積算有効電力量(kWh)", "info": "積算有効電力量(kWh)\n16進数:0220\n10進数:544", "x": 340, "y": 720, "wires": [] }, { "id": "29a51ff20ababa3b", "type": "modbus-flex-getter", "z": "831518904a3450aa", "g": "47544d16bdfa8e2a", "name": "", "showStatusActivities": false, "showErrors": true, "showWarnings": true, "logIOActivities": false, "server": "d6c967a84a7d56dd", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": true, "keepMsgProperties": true, "delayOnStart": false, "startDelayTime": "10", "x": 540, "y": 615, "wires": [ [], [ "5a2117c385e7c553" ] ] }, { "id": "5bafce1711d0f051", "type": "function", "z": "831518904a3450aa", "g": "47544d16bdfa8e2a", "name": "積算有効電力量(Wh)", "func": "msg.payload = { \n 'fc': 3,\n 'unitid': global.get(\"count\"),\n 'address': 512,\n 'quantity': 10\n};\n\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 335, "y": 615, "wires": [ [ "29a51ff20ababa3b" ] ] }, { "id": "9e546c85dd00e47f", "type": "change", "z": "831518904a3450aa", "g": "47544d16bdfa8e2a", "name": "積算有効電力量(Wh)を保存", "rules": [ { "t": "set", "p": "total_power_consumption", "pt": "global", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 900, "y": 615, "wires": [ [ "aa4b8e98d7c05b38" ] ] }, { "id": "5a2117c385e7c553", "type": "function", "z": "831518904a3450aa", "g": "47544d16bdfa8e2a", "name": "換算", "func": "msg.payload = msg.payload.data[0] * 65535 + msg.payload.data[1];\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 710, "y": 615, "wires": [ [ "9e546c85dd00e47f" ] ] }, { "id": "67b123fc6b48a7c2", "type": "comment", "z": "831518904a3450aa", "g": "47544d16bdfa8e2a", "name": "積算有効電力量(Wh)", "info": "積算有効電力量(Wh)\n16進数:0200\n10進数:512\n", "x": 330, "y": 570, "wires": [] }, { "id": "2a7eab440c850b66", "type": "debug", "z": "831518904a3450aa", "name": "debug 14", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "$globalContext('count')", "targetType": "jsonata", "statusVal": "", "statusType": "auto", "x": 825, "y": 30, "wires": [] }, { "id": "9137be4b20fd64dc", "type": "switch", "z": "831518904a3450aa", "g": "4125ab23585ce006", "name": "", "property": "count", "propertyType": "global", "rules": [ { "t": "lte", "v": "LOOP_MAX", "vt": "env" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 755, "y": 255, "wires": [ [ "2a7eab440c850b66", "bdf53f6fa471e2c6" ], [ "c7f574c106fc247c" ] ] }, { "id": "35cd92335aa15cd4", "type": "change", "z": "831518904a3450aa", "g": "4125ab23585ce006", "name": "count++", "rules": [ { "t": "set", "p": "count", "pt": "global", "to": "$globalContext('count') + 1", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 645, "y": 210, "wires": [ [ "9137be4b20fd64dc" ] ] }, { "id": "e63657b1010a68aa", "type": "modbus-flex-getter", "z": "831518904a3450aa", "g": "43288f5ea823c31f", "name": "", "showStatusActivities": false, "showErrors": true, "showWarnings": true, "logIOActivities": false, "server": "d6c967a84a7d56dd", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": true, "keepMsgProperties": true, "delayOnStart": false, "startDelayTime": "10", "x": 540, "y": 465, "wires": [ [], [ "16faee32cc6309d1" ] ] }, { "id": "bdf53f6fa471e2c6", "type": "function", "z": "831518904a3450aa", "g": "43288f5ea823c31f", "name": "力率", "func": "msg.payload = { \n 'fc': 3,\n 'unitid': global.get(\"count\"),\n 'address': 12,\n 'quantity': 2\n};\n\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 285, "y": 465, "wires": [ [ "e63657b1010a68aa" ] ] }, { "id": "8d7daa962b436db5", "type": "change", "z": "831518904a3450aa", "g": "43288f5ea823c31f", "name": "力率を保存", "rules": [ { "t": "set", "p": "power_factor", "pt": "global", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 465, "wires": [ [ "5bafce1711d0f051" ] ] }, { "id": "ea7789c2d0b7284b", "type": "comment", "z": "831518904a3450aa", "g": "43288f5ea823c31f", "name": "力率", "info": "力率\n16進数:000c\n10進数:12\n", "x": 290, "y": 420, "wires": [] }, { "id": "16faee32cc6309d1", "type": "function", "z": "831518904a3450aa", "g": "43288f5ea823c31f", "name": "換算", "func": "msg.payload = msg.payload.data[0] * 65535 + msg.payload.data[1];\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 715, "y": 465, "wires": [ [ "8d7daa962b436db5" ] ] }, { "id": "8d34c538739d9ec6", "type": "catch", "z": "831518904a3450aa", "g": "4125ab23585ce006", "name": "", "scope": [ "20b8949d456e456f", "29a51ff20ababa3b", "e63657b1010a68aa" ], "uncaught": false, "x": 275, "y": 150, "wires": [ [ "bfcafe7abb441d9d" ] ] }, { "id": "7394bcb210d54d41", "type": "function", "z": "831518904a3450aa", "g": "02c6312074a39c65", "name": "結合", "func": "msg.payload = {\n \"timestamp\": global.get(\"datetime1\"),\n \"serial_number\": global.get(\"serial_number\"),\n \"ENERGY_TYPE\": env.get(\"ENERGY_TYPE\"),\n \"unitid\": global.get(\"count\"),\n \"power_factor\": global.get(\"power_factor\"),\n \"total_power_consumption_Wh\": global.get(\"total_power_consumption\"),\n \"total_power_consumption_kWh\": global.get(\"total_power_consumption2\"),\n};\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 290, "y": 915, "wires": [ [ "3a399af662d80b3e" ] ] }, { "id": "3a399af662d80b3e", "type": "file", "z": "831518904a3450aa", "g": "02c6312074a39c65", "name": "", "filename": "/root/mqtt.json", "filenameType": "str", "appendNewline": true, "createDir": false, "overwriteFile": "false", "encoding": "utf8", "x": 455, "y": 915, "wires": [ [ "6a16d4693a07e6d5", "d791a329f0af27c5" ] ] }, { "id": "97377c3a5bd9abe1", "type": "comment", "z": "831518904a3450aa", "g": "02c6312074a39c65", "name": "MQTT送信用ファイルへのレコード追記", "info": "", "x": 390, "y": 870, "wires": [] }, { "id": "e894cd50b6f2fa81", "type": "mqtt-broker", "name": "test", "broker": "a3djrqhqnehhjh-ats.iot.ap-northeast-1.amazonaws.com", "port": "8883", "tls": "c6c46a395a782fc4", "clientid": "", "autoConnect": true, "usetls": true, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "autoUnsubscribe": true, "birthTopic": "", "birthQos": "0", "birthRetain": "false", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closeRetain": "false", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willRetain": "false", "willPayload": "", "willMsg": {}, "userProps": "", "sessionExpiry": "" }, { "id": "d6c967a84a7d56dd", "type": "modbus-client", "name": "", "clienttype": "serial", "bufferCommands": true, "stateLogEnabled": true, "queueLogEnabled": false, "failureLogEnabled": true, "tcpHost": "127.0.0.1", "tcpPort": "502", "tcpType": "DEFAULT", "serialPort": "/dev/ttyUSB0", "serialType": "RTU-BUFFERD", "serialBaudrate": "9600", "serialDatabits": "8", "serialStopbits": "1", "serialParity": "even", "serialConnectionDelay": "100", "serialAsciiResponseStartDelimiter": "0x3A", "unit_id": 1, "commandDelay": 1, "clientTimeout": 100, "reconnectOnTimeout": false, "reconnectTimeout": 100, "parallelUnitIdsAllowed": true, "showErrors": true, "showWarnings": true, "showLogs": true }, { "id": "c6c46a395a782fc4", "type": "tls-config", "name": "test mqtt", "cert": "/root/pem_files/certificate.pem.crt", "key": "/root/pem_files/private.pem.key", "ca": "/root/pem_files/AmazonRootCA1.pem", "certname": "", "keyname": "", "caname": "AmazonRootCA1.pem", "servername": "", "verifyservercert": true, "alpnprotocol": "" } ]