Pv Overload with batterystorage ( if then else)

Hey im new to node red and have some questions about if then. i only coded some scripts in auto it v3.
can maybe someone correct my function.

if msg.carpluged = 1 & msg.socvartabattery > 75% & msg.PVoverload = 1 then
if msg.Netzpower => 500 then
msg.load = msg.currentAmps + 500
msg.payload = {"current": msg.load}
else
if msg.Netzpower => -500 & msg.currentAmps > 6500 then
msg.load = msg.currentAmps - 500
msg.payload = {"current": msg.load}
endif
endif
else
msg.payload = {"current":6000}
endif

Node-RED is a "low code" programming tool. Most or all of your script can be done with the basic switch, change, trigger etc nodes.
Or you could translate it into Javascript and use a function node.

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.

something like below

if (msg.carpluged === 1 && msg.socvartabattery > 75 && msg.PVoverload === 1){
   if (msg.Netzpower >= 500){
       msg.load = msg.currentAmps + 500
       msg.payload = {"current": msg.load}
   }else if (msg.Netzpower >= -500 && msg.currentAmps > 6500){ // this may want to be <=
       msg.load = msg.currentAmps - 500
        msg.payload = {"current": msg.load}
   }else{
       msg.payload = {"current":6000}
   }
}
return msg;

Maybe tell us what you are trying to achieve here ?

I hope to god you are no really playing around with 6500 amps and really mean milliamps i.e. 6.5 amps ?

Craig

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.