Hey i want that the number (8000) is a variable that i can load from a stored variable called (msg.Netz)
msg.payload = {"current":8000}
return msg;
Hey i want that the number (8000) is a variable that i can load from a stored variable called (msg.Netz)
msg.payload = {"current":8000}
return msg;
Is this what you mean?
msg.payload = {"current": msg.Netz}
return msg;
thanks bro im so stupid is working
how can i save a variable and load it on a other flow
var math1 = Number(msg.payload[2].col3) * Number(msg.payload[2].col6) / Number(100) + Number(msg.payload[2].col4) * Number(msg.payload[2].col7) / Number(100)
+ Number(msg.payload[2].col5) * Number(msg.payload[2].col8) / Number(100);
msg.Netz = math1;
return msg;
msg.Netz= Math.round(var.math1 / 230 * 1000)
msg.payload = {"current": msg.Netz}
return msg;
how can i load math1 into the second code
Since you assign math1
to msg.Netz
it will be available in the next function in msg.Netz
So in 2nd function...
msg.Netz= Math.round(msg.Netz / 230 * 1000)
im getting Netz: NaN
Feed the input and output of each node into debug nodes. Give them names so you can see where it goes wrong. If you want to see msg.Netz
then you will have to set that debug node to show Complete Message.
[{"id":"8587e399.4eec2","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"82f9aae9.4b5008","type":"debug","z":"8587e399.4eec2","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":80,"wires":[]},{"id":"1b7c69d8.2eee96","type":"inject","z":"8587e399.4eec2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":80,"wires":[["a8ecac09.1c037"]]},{"id":"a8ecac09.1c037","type":"http request","z":"8587e399.4eec2","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.178.10/cgi/ems_data.xml","tls":"","persist":false,"proxy":"","authType":"","x":310,"y":80,"wires":[["421abbd6.d74814"]]},{"id":"421abbd6.d74814","type":"xml","z":"8587e399.4eec2","name":"","property":"payload","attr":"","chr":"","x":510,"y":80,"wires":[["82f9aae9.4b5008"]]},{"id":"c102206e.80227","type":"debug","z":"8587e399.4eec2","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":380,"y":320,"wires":[]},{"id":"6f8b5bf0.1fd754","type":"inject","z":"8587e399.4eec2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":140,"wires":[["23dd931b.85a1ec"]]},{"id":"23dd931b.85a1ec","type":"http request","z":"8587e399.4eec2","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.178.10/cgi/ems_data.js","tls":"","persist":false,"proxy":"","authType":"","x":130,"y":200,"wires":[["c4841e3f.db645"]]},{"id":"c4841e3f.db645","type":"csv","z":"8587e399.4eec2","name":"","sep":",","hdrin":"","hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":false,"include_empty_strings":false,"include_null_values":false,"x":130,"y":260,"wires":[["c102206e.80227","164d0d8.65491f3","d18a952c.b87eb8","d591f53c.0bbe98","7f50324e.f4f74c"]]},{"id":"164d0d8.65491f3","type":"function","z":"8587e399.4eec2","name":"Netz Bezug / Einspeisung","func":"var math1 = Number(msg.payload[2].col3) * Number(msg.payload[2].col6) / Number(100) + Number(msg.payload[2].col4) * Number(msg.payload[2].col7) / Number(100) \n+ Number(msg.payload[2].col5) * Number(msg.payload[2].col8) / Number(100);\nmsg.Netz = math1;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":180,"wires":[["98bfa975.52df78"]]},{"id":"98bfa975.52df78","type":"debug","z":"8587e399.4eec2","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"Netz","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":180,"wires":[]},{"id":"d18a952c.b87eb8","type":"function","z":"8587e399.4eec2","name":"Produktionsleistung","func":"var math = Number(msg.payload[2].col3) * Number(msg.payload[2].col15) / Number(100) + Number(msg.payload[2].col4) * Number(msg.payload[2].col16) / Number(100) \n+ Number(msg.payload[2].col5) * Number(msg.payload[2].col17) / Number(100);\nmsg.Produktionsleistung = math;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":140,"wires":[["888952da.6e599"]]},{"id":"888952da.6e599","type":"debug","z":"8587e399.4eec2","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"Produktionsleistung","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":140,"wires":[]},{"id":"d591f53c.0bbe98","type":"function","z":"8587e399.4eec2","name":"Laden / Entladen","func":"var math = Number(msg.payload[1].col12) * Number(msg.payload[1].col15) / Number(100) + Number(msg.payload[1].col13) * Number(msg.payload[1].col16) / Number(100) \n+ Number(msg.payload[1].col14) * Number(msg.payload[1].col17) / Number(100);\nmsg.Batterie = math;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":220,"wires":[["efcb00d4.2a18c"]]},{"id":"efcb00d4.2a18c","type":"debug","z":"8587e399.4eec2","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"Batterie","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":220,"wires":[]},{"id":"7f50324e.f4f74c","type":"function","z":"8587e399.4eec2","name":"Energieverbrauch","func":"var math = (Number(msg.payload[2].col3) * Number(msg.payload[2].col15) / Number(100) + Number(msg.payload[2].col4) * Number(msg.payload[2].col16) / Number(100) \n+ Number(msg.payload[2].col5) * Number(msg.payload[2].col17) / Number(100)) - (Number(msg.payload[1].col12) * Number(msg.payload[1].col15) / Number(100) + Number(msg.payload[1].col13) * Number(msg.payload[1].col16) / Number(100) \n+ Number(msg.payload[1].col14) * Number(msg.payload[1].col17) / Number(100)) - (Number(msg.payload[2].col3) * Number(msg.payload[2].col6) / Number(100) + Number(msg.payload[2].col4) * Number(msg.payload[2].col7) / Number(100) \n+ Number(msg.payload[2].col5) * Number(msg.payload[2].col8) / Number(100));\nmsg.Energieverbrauch = math;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":260,"wires":[["f2ad70e0.286c2"]]},{"id":"f2ad70e0.286c2","type":"debug","z":"8587e399.4eec2","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"Energieverbrauch","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":260,"wires":[]},{"id":"2eaacfef.e05aa","type":"http request","z":"8587e399.4eec2","name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"http://192.168.178.56/evse/current_limit","tls":"","persist":false,"proxy":"","authType":"","x":650,"y":400,"wires":[["4def35b7.116dac"]]},{"id":"4def35b7.116dac","type":"debug","z":"8587e399.4eec2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":400,"wires":[]},{"id":"917dca45.ee7ee8","type":"function","z":"8587e399.4eec2","name":"","func":"msg.Netz= Math.round(msg.Netz / 230 * 1000)\nmsg.payload = {\"current\": msg.Netz}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":400,"wires":[["2eaacfef.e05aa","bd9edfac.b2147"]]},{"id":"9d591701.9a7a58","type":"inject","z":"8587e399.4eec2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":400,"wires":[["917dca45.ee7ee8"]]},{"id":"bd9edfac.b2147","type":"debug","z":"8587e399.4eec2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":630,"y":460,"wires":[]}]
You need to look at the output of the debug nodes in the debug pane and see if they make sense. If you don't understand what I mean then I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.