node-red-contrib / node-red-contrib-renault-ze

node-red extension to fetch the status from your renault connected car
Apache License 2.0
19 stars 6 forks source link

Username & Password data from DB #44

Closed IAlves2022 closed 2 years ago

IAlves2022 commented 2 years ago

Hy, first of all, thank you for your work in this node!

Can you please help me, clarify if its possible to get data from a DB, or other nodes, and fill the username and password fields in the node?

Best regards

konne commented 2 years ago

@IAlves2022 please check the new 1.3.0 release

IAlves2022 commented 2 years ago

Hello, thank you for the reply.

I was reading about your reply, but i dont have a lot of knowledge on nodered, so i dont know here should i put that script.

I have a printscreen of my flow, can you help me using the credentials node? here should i put it?

Screenshot from 2022-01-17 16-25-32

And the Flow is:

``` [ { "id": "721ff49fd35fa748", "type": "tab", "label": "Zoe Dashboard", "disabled": false, "info": "", "env": [] }, { "id": "ab166e9e1b0d34c4", "type": "inject", "z": "721ff49fd35fa748", "name": "no topic -> charge /cockpit", "props": [], "repeat": "900", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 180, "y": 440, "wires": [ [ "cbfab7db0c9b67a9" ] ] }, { "id": "cbfab7db0c9b67a9", "type": "renault-ze", "z": "721ff49fd35fa748", "name": "IAlves", "x": 510, "y": 440, "wires": [ [ "74c570e2c6c49c09" ] ] }, { "id": "74c570e2c6c49c09", "type": "trigger", "z": "721ff49fd35fa748", "name": "", "op1": "", "op2": "", "op1type": "nul", "op2type": "pay", "duration": "250", "extend": false, "overrideDelay": false, "units": "ms", "reset": "", "bytopic": "topic", "topic": "topic", "outputs": 1, "x": 680, "y": 440, "wires": [ [ "ec42725aebc5d70c" ] ] }, { "id": "1e9a631878572f1b", "type": "debug", "z": "721ff49fd35fa748", "name": "CAR DATA", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 870, "y": 380, "wires": [] }, { "id": "d2d93133ae7b16db", "type": "function", "z": "721ff49fd35fa748", "name": "GET iD", "func": "msg.payload = msg.payload.data.id;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 160, "y": 560, "wires": [ [ "e92b2ed176fc45a2" ] ] }, { "id": "6e159439233b6fe6", "type": "comment", "z": "721ff49fd35fa748", "name": "LER INFORMAÇÕES", "info": "", "x": 150, "y": 400, "wires": [] }, { "id": "304b459f9213151d", "type": "link in", "z": "721ff49fd35fa748", "name": "", "links": [ "6c07e79f50327831", "4040cd49d80c2858" ], "x": 55, "y": 560, "wires": [ [ "d2d93133ae7b16db" ] ] }, { "id": "cc7abe8d67ded089", "type": "ui_text", "z": "721ff49fd35fa748", "group": "82675c788c857d9c", "order": 1, "width": 0, "height": 0, "name": "", "label": "Matricula", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 500, "y": 560, "wires": [] }, { "id": "e92b2ed176fc45a2", "type": "change", "z": "721ff49fd35fa748", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "85-XT-95", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 320, "y": 560, "wires": [ [ "cc7abe8d67ded089" ] ] }, { "id": "0ab56af9bd9d419b", "type": "comment", "z": "721ff49fd35fa748", "name": "GET Matricula", "info": "", "x": 110, "y": 520, "wires": [] }, { "id": "4de5ebcf212d8d71", "type": "function", "z": "721ff49fd35fa748", "name": "GET Total KM", "func": "msg.payload = msg.payload.data.attributes.totalMileage;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 780, "y": 560, "wires": [ [ "00e99feac49b506f" ] ] }, { "id": "6d1c9fcde3207d34", "type": "link in", "z": "721ff49fd35fa748", "name": "", "links": [ "6c07e79f50327831", "4040cd49d80c2858" ], "x": 655, "y": 560, "wires": [ [ "4de5ebcf212d8d71" ] ] }, { "id": "00e99feac49b506f", "type": "ui_text", "z": "721ff49fd35fa748", "group": "82675c788c857d9c", "order": 2, "width": 0, "height": 0, "name": "", "label": "Total KM", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 960, "y": 560, "wires": [] }, { "id": "b4ac517b7141d41e", "type": "comment", "z": "721ff49fd35fa748", "name": "GET Total KM", "info": "", "x": 710, "y": 520, "wires": [] }, { "id": "d0baf2d0ac24a512", "type": "function", "z": "721ff49fd35fa748", "name": "GET Bat Dispo", "func": "msg.payload = msg.payload.data.attributes.batteryLevel;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 180, "y": 860, "wires": [ [ "dcbb3118027ac830", "8718bb37d94894bb" ] ] }, { "id": "8c26fbe769318aed", "type": "link in", "z": "721ff49fd35fa748", "name": "", "links": [ "6c07e79f50327831", "47581ca40163a3b2" ], "x": 55, "y": 860, "wires": [ [ "d0baf2d0ac24a512" ] ] }, { "id": "f228c1aa18d71697", "type": "comment", "z": "721ff49fd35fa748", "name": "GET Bat Disponivel", "info": "", "x": 130, "y": 820, "wires": [] }, { "id": "15b2715f3a431b8d", "type": "function", "z": "721ff49fd35fa748", "name": "GET Autonomia", "func": "msg.payload = msg.payload.data.attributes.batteryAutonomy;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 820, "y": 940, "wires": [ [ "5c5126ae0a5f28f7", "53c40dacb0265828" ] ] }, { "id": "68f294626f3165a5", "type": "link in", "z": "721ff49fd35fa748", "name": "", "links": [ "6c07e79f50327831", "47581ca40163a3b2" ], "x": 695, "y": 940, "wires": [ [ "15b2715f3a431b8d" ] ] }, { "id": "1a734bdd531b439f", "type": "comment", "z": "721ff49fd35fa748", "name": "GET Total KM", "info": "", "x": 750, "y": 900, "wires": [] }, { "id": "dcbb3118027ac830", "type": "ui_gauge", "z": "721ff49fd35fa748", "name": "Nivel Bat", "group": "c9e7e2cf22a03b07", "order": 1, "width": 0, "height": 0, "gtype": "gage", "title": "Nível Bateria", "label": "%", "format": "{{value}}", "min": 0, "max": "100", "colors": [ "#ff0000", "#e6e600", "#8c8cff" ], "seg1": "25", "seg2": "65", "className": "", "x": 440, "y": 860, "wires": [] }, { "id": "ec42725aebc5d70c", "type": "switch", "z": "721ff49fd35fa748", "name": "", "property": "topic", "propertyType": "msg", "rules": [ { "t": "eq", "v": "location", "vt": "str" }, { "t": "eq", "v": "cockpit", "vt": "str" }, { "t": "eq", "v": "battery-status", "vt": "str" }, { "t": "eq", "v": "", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 4, "x": 850, "y": 440, "wires": [ [ "831b8f0bb05ed9ba" ], [ "4040cd49d80c2858" ], [ "47581ca40163a3b2" ], [] ] }, { "id": "831b8f0bb05ed9ba", "type": "link out", "z": "721ff49fd35fa748", "name": "", "mode": "link", "links": [], "x": 995, "y": 400, "wires": [] }, { "id": "4040cd49d80c2858", "type": "link out", "z": "721ff49fd35fa748", "name": "", "mode": "link", "links": [ "304b459f9213151d", "6d1c9fcde3207d34" ], "x": 1035, "y": 440, "wires": [] }, { "id": "47581ca40163a3b2", "type": "link out", "z": "721ff49fd35fa748", "name": "", "mode": "link", "links": [ "8c26fbe769318aed", "68f294626f3165a5", "f61b7dbc6fbba4c3", "74476a1adac80af5", "70ac03519b66a4ef" ], "x": 975, "y": 460, "wires": [] }, { "id": "8d486bc1c4204dbf", "type": "debug", "z": "721ff49fd35fa748", "name": "REM. CHARGE TIME", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1200, "y": 820, "wires": [] }, { "id": "5c5126ae0a5f28f7", "type": "ui_gauge", "z": "721ff49fd35fa748", "name": "Autonomia", "group": "95f6861ef85f2d58", "order": 1, "width": 0, "height": 0, "gtype": "gage", "title": "Autonomia Disp.", "label": "Km", "format": "{{value}}", "min": 0, "max": "400", "colors": [ "#ff0000", "#e6e600", "#8c8cff" ], "seg1": "100", "seg2": "200", "className": "", "x": 1030, "y": 940, "wires": [] }, { "id": "8c088a0e96e11781", "type": "ui_gauge", "z": "721ff49fd35fa748", "name": "", "group": "afbc3f96963b2421", "order": 1, "width": 0, "height": 0, "gtype": "gage", "title": "Temp. Bateria", "label": "ºC", "format": "{{value}}", "min": 0, "max": "100", "colors": [ "#ff0000", "#e6e600", "#8c8cff" ], "seg1": "", "seg2": "", "className": "", "x": 420, "y": 960, "wires": [] }, { "id": "70d1d71563ac8362", "type": "function", "z": "721ff49fd35fa748", "name": "GET Bat Temp", "func": "msg.payload = msg.payload.data.attributes.batteryTemperature;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 180, "y": 960, "wires": [ [ "8c088a0e96e11781", "81fcb5c359205f65" ] ] }, { "id": "f61b7dbc6fbba4c3", "type": "link in", "z": "721ff49fd35fa748", "name": "", "links": [ "6c07e79f50327831", "47581ca40163a3b2" ], "x": 55, "y": 960, "wires": [ [ "70d1d71563ac8362" ] ] }, { "id": "6ef1171ed7fd3c2d", "type": "comment", "z": "721ff49fd35fa748", "name": "GET Bat Temp", "info": "", "x": 120, "y": 920, "wires": [] }, { "id": "53c40dacb0265828", "type": "ui_chart", "z": "721ff49fd35fa748", "name": "", "group": "95f6861ef85f2d58", "order": 2, "width": 0, "height": 0, "label": "Autonomia Disp.", "chartType": "line", "legend": "false", "xformat": "HH:mm", "interpolate": "bezier", "nodata": "", "dot": false, "ymin": "0", "ymax": "400", "removeOlder": "1", "removeOlderPoints": "", "removeOlderUnit": "3600", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1040, "y": 980, "wires": [ [] ] }, { "id": "81fcb5c359205f65", "type": "ui_chart", "z": "721ff49fd35fa748", "name": "", "group": "afbc3f96963b2421", "order": 2, "width": 0, "height": 0, "label": "Bat Temp", "chartType": "line", "legend": "false", "xformat": "HH:mm", "interpolate": "step", "nodata": "", "dot": false, "ymin": "0", "ymax": "50", "removeOlder": "30", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 400, "y": 1000, "wires": [ [] ] }, { "id": "8718bb37d94894bb", "type": "ui_chart", "z": "721ff49fd35fa748", "name": "", "group": "c9e7e2cf22a03b07", "order": 2, "width": 0, "height": 0, "label": "Nivel Bateria", "chartType": "line", "legend": "false", "xformat": "HH:mm", "interpolate": "step", "nodata": "", "dot": false, "ymin": "0", "ymax": "100", "removeOlder": "1", "removeOlderPoints": "", "removeOlderUnit": "3600", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 450, "y": 900, "wires": [ [] ] }, { "id": "a3ed2e0e39f98d73", "type": "function", "z": "721ff49fd35fa748", "name": "GET TimeStamp", "func": "msg.payload = msg.payload.data.attributes.timestamp;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 200, "y": 680, "wires": [ [ "9c1b74914d2d29c4" ] ] }, { "id": "74476a1adac80af5", "type": "link in", "z": "721ff49fd35fa748", "name": "", "links": [ "6c07e79f50327831", "47581ca40163a3b2" ], "x": 65, "y": 680, "wires": [ [ "a3ed2e0e39f98d73" ] ] }, { "id": "ea061ae1659676e1", "type": "comment", "z": "721ff49fd35fa748", "name": "GET TimeSamp", "info": "", "x": 130, "y": 640, "wires": [] }, { "id": "d74f3c68032c081f", "type": "ui_text", "z": "721ff49fd35fa748", "group": "82675c788c857d9c", "order": 3, "width": 0, "height": 0, "name": "", "label": "Data / Hora", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 460, "y": 740, "wires": [] }, { "id": "70ac03519b66a4ef", "type": "link in", "z": "721ff49fd35fa748", "name": "", "links": [ "6c07e79f50327831", "47581ca40163a3b2" ], "x": 655, "y": 680, "wires": [ [ "34faa22b4724628b" ] ] }, { "id": "0798a3e1725c096d", "type": "comment", "z": "721ff49fd35fa748", "name": "GET Temp para Carregamento", "info": "", "x": 770, "y": 640, "wires": [] }, { "id": "9c1b74914d2d29c4", "type": "moment", "z": "721ff49fd35fa748", "name": "", "topic": "", "input": "", "inputType": "msg", "inTz": "Europe/Lisbon", "adjAmount": 0, "adjType": "days", "adjDir": "add", "format": "DD.MM.YYYY / HH:mm", "locale": "pt-PT", "output": "", "outputType": "msg", "outTz": "Europe/Lisbon", "x": 210, "y": 740, "wires": [ [ "d74f3c68032c081f" ] ] }, { "id": "34faa22b4724628b", "type": "switch", "z": "721ff49fd35fa748", "name": "", "property": "payload.data.attributes.chargingStatus", "propertyType": "msg", "rules": [ { "t": "eq", "v": "-1", "vt": "str" }, { "t": "eq", "v": "1", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 750, "y": 680, "wires": [ [ "83526efc2d137176" ], [ "637461aee6879ea4" ] ] }, { "id": "034b973fa04e5ce6", "type": "ui_text", "z": "721ff49fd35fa748", "group": "82675c788c857d9c", "order": 4, "width": 0, "height": 0, "name": "", "label": "Tempo Restante", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1240, "y": 780, "wires": [] }, { "id": "1f2f7717e5be338e", "type": "function", "z": "721ff49fd35fa748", "name": "GET RemainingTime", "func": "msg.payload = msg.payload.data.attributes.chargingRemainingTime;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 760, "y": 740, "wires": [ [ "f59326bfdecab25d" ] ] }, { "id": "f59326bfdecab25d", "type": "change", "z": "721ff49fd35fa748", "name": "To millisecs", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "msg.payload/60", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 970, "y": 740, "wires": [ [ "e68c557914c74683" ] ] }, { "id": "e68c557914c74683", "type": "function", "z": "721ff49fd35fa748", "name": "", "func": "msg.payload = Number(msg.payload.toFixed(2));\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 720, "y": 780, "wires": [ [ "8469ee8fbce10c56" ] ] }, { "id": "8469ee8fbce10c56", "type": "change", "z": "721ff49fd35fa748", "name": "Change Decimal to HH:mm", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$fromMillis($$.payload * 3600000, \"[H]h:[m]m\")", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 940, "y": 780, "wires": [ [ "034b973fa04e5ce6", "8d486bc1c4204dbf" ] ] }, { "id": "d759730433853499", "type": "inject", "z": "721ff49fd35fa748", "name": "no topic -> charge /cockpit", "props": [], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 170, "y": 1280, "wires": [ [ "b2764af185fe9371" ] ] }, { "id": "b2764af185fe9371", "type": "renault-ze", "z": "721ff49fd35fa748", "name": "DFerreira", "x": 420, "y": 1280, "wires": [ [ "726d3b392b72bab8" ] ] }, { "id": "726d3b392b72bab8", "type": "trigger", "z": "721ff49fd35fa748", "name": "", "op1": "", "op2": "", "op1type": "nul", "op2type": "pay", "duration": "250", "extend": false, "overrideDelay": false, "units": "ms", "reset": "", "bytopic": "topic", "topic": "topic", "outputs": 1, "x": 680, "y": 1280, "wires": [ [ "12aa19af713be84c" ] ] }, { "id": "b61026fdb618e8d3", "type": "comment", "z": "721ff49fd35fa748", "name": "LER INFORMAÇÕES", "info": "", "x": 140, "y": 1240, "wires": [] }, { "id": "12aa19af713be84c", "type": "debug", "z": "721ff49fd35fa748", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 900, "y": 1280, "wires": [] }, { "id": "637461aee6879ea4", "type": "switch", "z": "721ff49fd35fa748", "name": "", "property": "payload.data.attributes.batteryLevel", "propertyType": "msg", "rules": [ { "t": "gte", "v": "99", "vt": "str" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 890, "y": 700, "wires": [ [ "83526efc2d137176" ], [ "1f2f7717e5be338e" ] ] }, { "id": "83526efc2d137176", "type": "change", "z": "721ff49fd35fa748", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "------", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1060, "y": 680, "wires": [ [ "034b973fa04e5ce6", "8d486bc1c4204dbf" ] ] }, { "id": "82675c788c857d9c", "type": "ui_group", "name": "Dados", "tab": "171903a14ed0044c", "order": 1, "disp": false, "width": "5", "collapse": false, "className": "" }, { "id": "c9e7e2cf22a03b07", "type": "ui_group", "name": "Bat Status", "tab": "171903a14ed0044c", "order": 2, "disp": false, "width": "6", "collapse": false, "className": "" }, { "id": "95f6861ef85f2d58", "type": "ui_group", "name": "Graficos", "tab": "171903a14ed0044c", "order": 3, "disp": false, "width": "6", "collapse": false, "className": "" }, { "id": "afbc3f96963b2421", "type": "ui_group", "name": "Graficos #2", "tab": "171903a14ed0044c", "order": 4, "disp": false, "width": "6", "collapse": false, "className": "" }, { "id": "171903a14ed0044c", "type": "ui_tab", "name": "ZOE Dashboard", "icon": "dashboard", "disabled": false, "hidden": false } ] ```

Best regards

konne commented 2 years ago

Hi, you can just add an payload.username = .... and payload.password = ... that should just work

IAlves2022 commented 2 years ago

Hello,

Can you please be a bit more specific on the steps i should take? Best regards