Hi everyone i would like to know how to setup a nodered to start about 20:00 every night to discharge the batteries when its above 40% SOC for maximum discharge and stop discharging at 40% SOC. I’m doing this for a maintance point to veiw in the ESS system as i charge the system up every night from 2330, i’m using a Multiplus2 10000 and have 4 pylontech US5000
Is this to discharge to grid or load?
Hi Yes to discharge to the grids the battery is getting better cycles ie below the 50% that i’m looking at the moment going into winter just trying to extend the battery life and keep the capacity This is for and ESS
Off the top of my head. (So untested)
Inject node with a time. Feeds the (venus os) ess min soc w/o battery life.
Second feed to grid set point and second to grid set point and set it back wards - you max is likely 10kw adapting this one.
https://community.victronenergy.com/questions/163615/node-red-set-value-for-grid-set-point.html
And then of course set also an inject a time to stop and charge up again to a set soc or set the system to keep batteries charged
Hi struggling with this so I’ve changed it to between 2000 and 2300
And only done -7000 as when I done -8100 the inverter over loaded for 23seconds. But I have no idea how the SOC bit to get it to stop and start this is what I have
@nickdb I’ve got a thread over on the old forum that you closed https://community.victronenergy.com/questions/328661/battery-maintenance-using-nodered-help.html?childToView=328701#answer-328701 it doesn’t seem like @matt1309 is on the new forum he tried to help me with this but the post was locked i’ve tried implementing his code but seem to get errors when i run it through the Debug saying ReferenceError: ReferenceError: soc is not defined (line 3, col 1) Ive not connected it to the ESS bit yet as I’m just trying to see if the SOC bit works as intended first. Anyone that knows NodeRed well able to help?
//set variables being soc, gridsetpoint
if(soc >40) {
msg.payload = -7000 //export 7kw if doc greater than 40%
} else if(gridsetpoint = -50 && soc <40){ //if grid setpoint not equal to -50 or whatever default is then set it to -50
msg.payload = -50;
return msg;
}
I amended the closing post to mention his username and provide a direct link here.
Where are you defining the variable SOC?
Is that your complete function listed above?
Every variable needs to be declared before it can be used, else you will get errors like you are.
You would typically have a “var soc = x;” where x is what you want it initially set to.
Top tip, when practicing javascript, or any code for that matter, chatgpt is really good at it. So you can also ask it questions about why it is wrong or how to write x function.
Thank you i’ll look at Chatgpt thanks
@nickdb this is the complete flow but its doing doing my noggin in!
[
{
“id”: “5bf16744899d4f0d”,
“type”: “tab”,
“label”: “battery example”,
“disabled”: true,
“info”: “”,
“env”:
},
{
“id”: “a1d8cf2aadf1dee0”,
“type”: “inject”,
“z”: “5bf16744899d4f0d”,
“name”: “Battery Maintanance Discharge”,
“props”: [
{
“p”: “payload”
}
],
“repeat”: “”,
“crontab”: “00 20 * * *”,
“once”: false,
“onceDelay”: “”,
“topic”: “”,
“payload”: “-6500”,
“payloadType”: “flow”,
“x”: 190,
“y”: 80,
“wires”: [
[
“eb81a2eb4b31e1ad”
]
]
},
{
“id”: “0ffbc60c29df0454”,
“type”: “change”,
“z”: “5bf16744899d4f0d”,
“name”: “Grid Setpoint -6500W”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “flow”,
“to”: “-6500”,
“tot”: “num”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 520,
“y”: 200,
“wires”: [
[
“d1d5e8370643788e”
]
]
},
{
“id”: “d1d5e8370643788e”,
“type”: “victron-output-settings”,
“z”: “5bf16744899d4f0d”,
“service”: “com.victronenergy.settings”,
“path”: “/Settings/CGwacs/AcPowerSetPoint”,
“serviceObj”: {
“service”: “com.victronenergy.settings”,
“name”: “Venus settings”
},
“pathObj”: {
“path”: “/Settings/CGwacs/AcPowerSetPoint”,
“type”: “float”,
“name”: “ESS control loop setpoint (W)”,
“writable”: true
},
“name”: “”,
“onlyChanges”: false,
“x”: 600,
“y”: 260,
“wires”:
},
{
“id”: “76478c5b712f229f”,
“type”: “inject”,
“z”: “5bf16744899d4f0d”,
“name”: “Battery Maintanance Stop”,
“props”: [
{
“p”: “payload”
}
],
“repeat”: “”,
“crontab”: “45 20 * * *”,
“once”: false,
“onceDelay”: “”,
“topic”: “”,
“payload”: “-50”,
“payloadType”: “num”,
“x”: 160,
“y”: 140,
“wires”: [
[
“eb81a2eb4b31e1ad”
]
]
},
{
“id”: “eb81a2eb4b31e1ad”,
“type”: “function”,
“z”: “5bf16744899d4f0d”,
“name”: “SOC”,
“func”: “// Initialize soc and gridsetpoint with appropriate values\nvar soc = 20; // Example value, replace with your actual logic to set soc\nvar gridsetpoint = -50; // Example value, replace with your actual logic to set gridsetpoint\n\n// Set variables: soc, gridsetpoint\nif (soc > 40) {\n msg.payload = -6700; // Export 7kW if SOC is greater than 40%\n return msg;\n} else if (gridsetpoint == -50 && soc < 41) { // If grid setpoint equals -50 and SOC is less than 40%\n msg.payload = -50; // Set the payload to -50\n return msg;\n}”,
“outputs”: 1,
“timeout”: “0”,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 370,
“y”: 140,
“wires”: [
[
“0ffbc60c29df0454”
]
]
}
]
Hopefully this is now working well for you.
Mate it works a treat, I’ve just got a power up session so free electric as a storm is brewing so they want to keep the turbines spinning. Just need to see how to put SOC in my other session I’ll bug ChatGPT to see if he can inject it somewhere lol thanks again mate you are a legend!