[ { "id": "2da26f14127c5a5b", "type": "tab", "label": "Enphase D7.6.175 v1", "disabled": false, "info": "", "env": [] }, { "id": "88d5c05d554748cf", "type": "group", "z": "2da26f14127c5a5b", "name": "", "style": { "fill": "#ffdf7f", "label": true }, "nodes": [ "f90c01c99e456b75", "d62d59660e84a794" ], "x": 14, "y": 39, "w": 432, "h": 82 }, { "id": "201ae4644171a8d7", "type": "http request", "z": "2da26f14127c5a5b", "name": "", "method": "POST", "ret": "txt", "paytoqs": "ignore", "url": "https://entrez.enphaseenergy.com/login", "tls": "", "persist": false, "proxy": "", "authType": "", "senderr": false, "credentials": { "user": "", "password": "" }, "x": 370, "y": 260, "wires": [ [ "195df7f299b788e6", "d696d3d69a0e916b" ] ] }, { "id": "195df7f299b788e6", "type": "function", "z": "2da26f14127c5a5b", "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": 570, "y": 260, "wires": [ [ "99dda79286c0d79d" ] ] }, { "id": "d696d3d69a0e916b", "type": "debug", "z": "2da26f14127c5a5b", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 530, "y": 180, "wires": [] }, { "id": "d5ed9909cd642a41", "type": "function", "z": "2da26f14127c5a5b", "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": 170, "y": 260, "wires": [ [ "201ae4644171a8d7" ] ] }, { "id": "99dda79286c0d79d", "type": "http request", "z": "2da26f14127c5a5b", "name": "", "method": "POST", "ret": "txt", "paytoqs": "ignore", "url": "https://entrez.enphaseenergy.com/entrez_tokens", "tls": "", "persist": false, "proxy": "", "authType": "", "senderr": false, "credentials": { "user": "", "password": "" }, "x": 790, "y": 260, "wires": [ [ "68977a96bd318f72", "0ff0d27c4bf9603b" ] ] }, { "id": "68977a96bd318f72", "type": "debug", "z": "2da26f14127c5a5b", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 950, "y": 180, "wires": [] }, { "id": "0ff0d27c4bf9603b", "type": "html", "z": "2da26f14127c5a5b", "name": "Parse HTML", "property": "payload", "outproperty": "payload", "tag": "#JWTToken", "ret": "text", "as": "single", "x": 990, "y": 260, "wires": [ [ "1883ced4eff0103a", "4870c349451542b1" ] ] }, { "id": "1883ced4eff0103a", "type": "debug", "z": "2da26f14127c5a5b", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1150, "y": 180, "wires": [] }, { "id": "4870c349451542b1", "type": "function", "z": "2da26f14127c5a5b", "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": 180, "y": 460, "wires": [ [ "78021083faab8f7a", "469835bfccc8a940" ] ] }, { "id": "78021083faab8f7a", "type": "http request", "z": "2da26f14127c5a5b", "name": "Check jwt", "method": "GET", "ret": "txt", "paytoqs": "ignore", "url": "https://{{envoyaddress}}/auth/check_jwt", "tls": "45b6751b593261a4", "persist": false, "proxy": "", "authType": "", "senderr": false, "credentials": { "user": "", "password": "" }, "x": 400, "y": 460, "wires": [ [ "bad4b1c4cc1159a3", "602ea3aca2dbc3c8" ] ] }, { "id": "bad4b1c4cc1159a3", "type": "debug", "z": "2da26f14127c5a5b", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 570, "y": 400, "wires": [] }, { "id": "469835bfccc8a940", "type": "debug", "z": "2da26f14127c5a5b", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 330, "y": 400, "wires": [] }, { "id": "602ea3aca2dbc3c8", "type": "function", "z": "2da26f14127c5a5b", "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": 690, "y": 460, "wires": [ [ "9163a50912169d51" ] ] }, { "id": "9163a50912169d51", "type": "sse-client", "z": "2da26f14127c5a5b", "name": "", "url": "https://{{envoyaddress}}/stream/meter", "events": [ "message" ], "headers": {}, "proxy": "", "restart": true, "rejectUnauthorized": false, "withCredentials": true, "timeout": "45", "x": 590, "y": 640, "wires": [ [ "a5a8dcaa97814793", "82ff2509c0cd55ac" ] ] }, { "id": "076f2bd0d72ea818", "type": "inject", "z": "2da26f14127c5a5b", "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": 130, "y": 660, "wires": [ [ "be912e72c9089d31" ] ] }, { "id": "be912e72c9089d31", "type": "change", "z": "2da26f14127c5a5b", "name": "", "rules": [ { "t": "set", "p": "pause", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 340, "y": 660, "wires": [ [ "9163a50912169d51" ] ] }, { "id": "bd099250ddf5a030", "type": "inject", "z": "2da26f14127c5a5b", "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": 130, "y": 620, "wires": [ [ "34eb69c0ad079912" ] ] }, { "id": "34eb69c0ad079912", "type": "change", "z": "2da26f14127c5a5b", "name": "", "rules": [ { "t": "set", "p": "stop", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 330, "y": 620, "wires": [ [ "9163a50912169d51" ] ] }, { "id": "a5a8dcaa97814793", "type": "json", "z": "2da26f14127c5a5b", "name": "", "property": "payload", "action": "", "pretty": false, "x": 750, "y": 640, "wires": [ [ "6697c3a40bb45d5a", "387fa9caa64bb2bc", "03138d0a037ad376", "274e2ca2338e0aa3" ] ] }, { "id": "e535692ba2149e87", "type": "mqtt out", "z": "2da26f14127c5a5b", "d": true, "name": "", "topic": "", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "c6b88f19.cc3fb", "x": 1330, "y": 640, "wires": [] }, { "id": "bbdb54589bf937bf", "type": "rbe", "z": "2da26f14127c5a5b", "name": "Filtre", "func": "deadbandEq", "gap": "2%", "start": "", "inout": "out", "septopics": true, "property": "payload", "topi": "topic", "x": 1190, "y": 640, "wires": [ [ "e535692ba2149e87" ] ] }, { "id": "6697c3a40bb45d5a", "type": "debug", "z": "2da26f14127c5a5b", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 850, "y": 760, "wires": [] }, { "id": "387fa9caa64bb2bc", "type": "function", "z": "2da26f14127c5a5b", "name": "production", "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": 950, "y": 600, "wires": [ [ "bbdb54589bf937bf" ] ] }, { "id": "03138d0a037ad376", "type": "function", "z": "2da26f14127c5a5b", "name": "net-consumption", "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": 970, "y": 640, "wires": [ [ "bbdb54589bf937bf" ] ] }, { "id": "274e2ca2338e0aa3", "type": "function", "z": "2da26f14127c5a5b", "name": "total-consumption", "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": 970, "y": 680, "wires": [ [ "bbdb54589bf937bf" ] ] }, { "id": "82ff2509c0cd55ac", "type": "debug", "z": "2da26f14127c5a5b", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 650, "y": 720, "wires": [] }, { "id": "f90c01c99e456b75", "type": "inject", "z": "2da26f14127c5a5b", "g": "88d5c05d554748cf", "name": "Paramètres Envoy", "props": [ { "p": "envoyaddress", "v": "", "vt": "str" }, { "p": "serialNum", "v": "", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 150, "y": 80, "wires": [ [ "d62d59660e84a794" ] ] }, { "id": "d62d59660e84a794", "type": "change", "z": "2da26f14127c5a5b", "g": "88d5c05d554748cf", "name": "Identifiants", "rules": [ { "t": "set", "p": "username", "pt": "msg", "to": "", "tot": "str" }, { "t": "set", "p": "password", "pt": "msg", "to": "", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 350, "y": 80, "wires": [ [ "d5ed9909cd642a41" ] ] }, { "id": "45b6751b593261a4", "type": "tls-config", "name": "no check server certificat", "cert": "", "key": "", "ca": "", "certname": "", "keyname": "", "caname": "", "servername": "", "verifyservercert": false, "alpnprotocol": "" }, { "id": "c6b88f19.cc3fb", "type": "mqtt-broker", "name": "Mosquitto", "broker": "10.0.1.102", "port": "1883", "clientid": "16", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "birthTopic": "Node-red-router", "birthQos": "2", "birthRetain": "false", "birthPayload": "1", "birthMsg": {}, "closeTopic": "Node-red-router", "closeQos": "2", "closeRetain": "false", "closePayload": "0", "closeMsg": {}, "willTopic": "Node-red-router", "willQos": "2", "willPayload": "0", "willMsg": {}, "sessionExpiry": "" } ]