[ { "id": "68c6d91c06f17fc2", "type": "tab", "label": "Enphase V7", "disabled": false, "info": "", "env": [] }, { "id": "33e5861da9a00392", "type": "group", "z": "68c6d91c06f17fc2", "name": "Watchdog", "style": { "stroke": "#ffff00", "fill": "#ffff3f", "label": true }, "nodes": [ "5d52c934073b7912", "426f3178b9aee0fd", "454a73c2bb566cf7", "1cf9d246f27ce543", "c73418dec3d226f3", "68d1f5816cce27de" ], "x": 334, "y": 239, "w": 912, "h": 122 }, { "id": "be864635e872dc2c", "type": "group", "z": "68c6d91c06f17fc2", "name": "Connect", "style": { "stroke": "#ffC000", "fill": "#ffcf3f", "label": true }, "nodes": [ "544baec976bd200a", "d6fb139589257c39" ], "x": 334, "y": 119, "w": 912, "h": 82 }, { "id": "3e3828b33a8925e4", "type": "http request", "z": "68c6d91c06f17fc2", "name": "", "method": "POST", "ret": "txt", "paytoqs": "ignore", "url": "https://entrez.enphaseenergy.com/login", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 630, "y": 520, "wires": [ [ "dfd2d1444660c99f" ] ] }, { "id": "dfd2d1444660c99f", "type": "function", "z": "68c6d91c06f17fc2", "name": "set payload", "func": "msg.payload = {\n'serialNum': msg.serialNum\n};\n\nmsg.headers = {\n 'Cookie': 'SESSION=' + msg.responseCookies.SESSION.value,\n 'Content-type' : 'application/x-www-form-urlencoded'\n}\n\nreturn msg;\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 830, "y": 520, "wires": [ [ "c685e06106b1000f" ] ] }, { "id": "18956fce5be93658", "type": "function", "z": "68c6d91c06f17fc2", "name": "set payload", "func": "msg.payload = {\n'username': msg.username,\n'password': msg.password,\n'authFlow': 'entrezSession',\n};\n\nmsg.headers = {\n \"content-type\": \"application/x-www-form-urlencoded\",\n};\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 430, "y": 520, "wires": [ [ "3e3828b33a8925e4" ] ] }, { "id": "c685e06106b1000f", "type": "http request", "z": "68c6d91c06f17fc2", "name": "", "method": "POST", "ret": "txt", "paytoqs": "ignore", "url": "https://entrez.enphaseenergy.com/entrez_tokens", "tls": "", "persist": false, "proxy": "", "authType": "", "senderr": false, "x": 1050, "y": 520, "wires": [ [ "583b5c178a27fef0" ] ] }, { "id": "583b5c178a27fef0", "type": "html", "z": "68c6d91c06f17fc2", "name": "Parse HTML", "property": "payload", "outproperty": "payload", "tag": "#JWTToken", "ret": "text", "as": "single", "x": 1250, "y": 520, "wires": [ [ "0af3d435283c1591" ] ] }, { "id": "0af3d435283c1591", "type": "function", "z": "68c6d91c06f17fc2", "name": "Token jwt", "func": "flow.set(\"bearer_token\", \"Bearer \" + msg.payload[0]);\n//flow.set(\"ts_token\", msg.payload.expires_at);\nmsg.headers = {\n 'Authorization' : flow.get(\"bearer_token\")\n};\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 440, "y": 720, "wires": [ [ "e8124231df707c8c" ] ] }, { "id": "e8124231df707c8c", "type": "http request", "z": "68c6d91c06f17fc2", "name": "Check jwt", "method": "GET", "ret": "txt", "paytoqs": "ignore", "url": "https://{{envoyaddress}}/auth/check_jwt", "tls": "45b6751b593261a4", "persist": false, "proxy": "", "authType": "", "senderr": false, "x": 660, "y": 720, "wires": [ [ "05465650d43ad06d" ] ] }, { "id": "05465650d43ad06d", "type": "function", "z": "68c6d91c06f17fc2", "name": "Set Cookie", "func": "msg.headers = {\n 'Cookie': 'sessionId=' + msg.responseCookies.sessionId.value,\n 'Authorization' : flow.get(\"bearer_token\")\n}\nreturn msg;\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 950, "y": 720, "wires": [ [ "539bceec64f6dd8f" ] ] }, { "id": "0c04e27597858d1a", "type": "sse-client", "z": "68c6d91c06f17fc2", "name": "", "url": "https://{{envoyaddress}}/stream/meter", "events": [ "message" ], "headers": {}, "proxy": "", "restart": true, "rejectUnauthorized": false, "withCredentials": true, "timeout": "45", "x": 850, "y": 900, "wires": [ [ "2241572953b446ae", "5d52c934073b7912", "454a73c2bb566cf7" ] ] }, { "id": "613d71da62c0bc31", "type": "inject", "z": "68c6d91c06f17fc2", "name": "Pause stream", "props": [ { "p": "payload", "v": "", "vt": "date" }, { "p": "topic", "v": "", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 390, "y": 920, "wires": [ [ "d735ca10b2d4d63d" ] ] }, { "id": "d735ca10b2d4d63d", "type": "change", "z": "68c6d91c06f17fc2", "name": "", "rules": [ { "t": "set", "p": "pause", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 600, "y": 920, "wires": [ [ "0c04e27597858d1a" ] ] }, { "id": "84dc464464c3c932", "type": "inject", "z": "68c6d91c06f17fc2", "name": "Stop stream", "props": [ { "p": "payload", "v": "", "vt": "date" }, { "p": "topic", "v": "", "vt": "string" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 390, "y": 880, "wires": [ [ "0ad0af62df68d3e8" ] ] }, { "id": "0ad0af62df68d3e8", "type": "change", "z": "68c6d91c06f17fc2", "name": "", "rules": [ { "t": "set", "p": "stop", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 590, "y": 880, "wires": [ [ "0c04e27597858d1a" ] ] }, { "id": "2241572953b446ae", "type": "json", "z": "68c6d91c06f17fc2", "name": "", "property": "payload", "action": "", "pretty": false, "x": 1070, "y": 900, "wires": [ [ "f6f584b7915d8899", "bd3ef89e3369ee8b", "c8b84f7569b8eeb4" ] ] }, { "id": "f6f584b7915d8899", "type": "function", "z": "68c6d91c06f17fc2", "name": "production[\"ph-a\"].p", "func": "msg.payload = msg.payload.production[\"ph-a\"].p;\nmsg.topic = \"Node-RED/Envoy/Stream/Prod\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1450, "y": 840, "wires": [ [] ] }, { "id": "bd3ef89e3369ee8b", "type": "function", "z": "68c6d91c06f17fc2", "name": "[\"net-consumption\"][\"ph-a\"].p", "func": "msg.payload = msg.payload[\"net-consumption\"][\"ph-a\"].p;\nmsg.topic = \"Node-RED/Envoy/Stream/NetConso\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1480, "y": 900, "wires": [ [] ] }, { "id": "c8b84f7569b8eeb4", "type": "function", "z": "68c6d91c06f17fc2", "name": "[\"total-consumption\"][\"ph-a\"].p", "func": "msg.payload = msg.payload[\"total-consumption\"][\"ph-a\"].p;\nmsg.topic = \"Node-RED/Envoy/Stream/TotConso\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1490, "y": 960, "wires": [ [] ] }, { "id": "539bceec64f6dd8f", "type": "msg-resend", "z": "68c6d91c06f17fc2", "interval": "20", "intervalUnit": "secs", "maximum": "1", "bytopic": false, "clone": false, "firstDelayed": false, "addCounters": false, "waitForResend": true, "highRate": true, "outputCountField": "", "outputMaxField": "", "name": "Try first to reconnect with last recorded token ", "x": 1250, "y": 720, "wires": [ [ "0c04e27597858d1a" ] ] }, { "id": "5d52c934073b7912", "type": "mytimeout", "z": "68c6d91c06f17fc2", "g": "33e5861da9a00392", "name": "", "outtopic": "", "outsafe": "", "outwarning": "", "outunsafe": "restart", "warning": "0", "timer": "10", "debug": false, "ndebug": false, "ignoreCase": false, "repeat": false, "again": false, "x": 430, "y": 280, "wires": [ [ "426f3178b9aee0fd" ], [] ] }, { "id": "426f3178b9aee0fd", "type": "change", "z": "68c6d91c06f17fc2", "g": "33e5861da9a00392", "name": "Set msg-resend to true", "rules": [ { "t": "set", "p": "resend_messages", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 620, "y": 280, "wires": [ [ "1cf9d246f27ce543" ] ] }, { "id": "454a73c2bb566cf7", "type": "change", "z": "68c6d91c06f17fc2", "g": "33e5861da9a00392", "name": "Set msg-resend to false", "rules": [ { "t": "set", "p": "resend_messages", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 630, "y": 320, "wires": [ [ "1cf9d246f27ce543" ] ] }, { "id": "1cf9d246f27ce543", "type": "msg-resend", "z": "68c6d91c06f17fc2", "g": "33e5861da9a00392", "interval": "20", "intervalUnit": "secs", "maximum": "0", "bytopic": false, "clone": false, "firstDelayed": false, "addCounters": false, "waitForResend": false, "highRate": true, "outputCountField": "", "outputMaxField": "", "name": "msg-resend 20sec", "x": 890, "y": 280, "wires": [ [ "c73418dec3d226f3" ] ] }, { "id": "c73418dec3d226f3", "type": "switch", "z": "68c6d91c06f17fc2", "g": "33e5861da9a00392", "name": "If msg-resend true", "property": "resend_messages", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1130, "y": 280, "wires": [ [ "68d1f5816cce27de", "d6fb139589257c39" ], [] ] }, { "id": "68d1f5816cce27de", "type": "change", "z": "68c6d91c06f17fc2", "g": "33e5861da9a00392", "name": "", "rules": [ { "t": "set", "p": "resend_last_msg", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1110, "y": 320, "wires": [ [ "539bceec64f6dd8f" ] ] }, { "id": "544baec976bd200a", "type": "inject", "z": "68c6d91c06f17fc2", "g": "be864635e872dc2c", "name": "Auto Start", "props": [], "repeat": "", "crontab": "", "once": true, "onceDelay": "4", "topic": "", "x": 450, "y": 160, "wires": [ [ "d6fb139589257c39" ] ] }, { "id": "d6fb139589257c39", "type": "change", "z": "68c6d91c06f17fc2", "g": "be864635e872dc2c", "name": "Settings", "rules": [ { "t": "set", "p": "username", "pt": "msg", "to": "ENLIGHTEN LOGIN (mail address)", "tot": "str" }, { "t": "set", "p": "password", "pt": "msg", "to": "ENLIGHTEN PASSWORD", "tot": "str" }, { "t": "set", "p": "envoyaddress", "pt": "msg", "to": "IP ADDRESS", "tot": "str" }, { "t": "set", "p": "serialNum", "pt": "msg", "to": "ENVOY SN", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1160, "y": 160, "wires": [ [ "18956fce5be93658" ] ] }, { "id": "45b6751b593261a4", "type": "tls-config", "name": "no check server certificat", "cert": "", "key": "", "ca": "", "certname": "", "keyname": "", "caname": "", "servername": "", "verifyservercert": false, "alpnprotocol": "" } ]