question

motylu avatar image
motylu asked

EVCS feature request - change ESS min. SOC during manual charging

Hello Lucian @Lucian Popescu (Victron Energy Staff),

we already discussed more things about EVCS, but I have one feature request, which in my opinion will be useful for many other customers.

Mainly I use auto charging mode, but I have some situations (and these will increase as autumn and winter approach) when I must charge the EV in afternoon hours or during night. But problem is that charging power is drawn from the home batteries as other devices in home installation. Yes, is it possible to connect EVCS before Multis, but then I will not be able to charge EV from solar panels during grid outage.

In my opinion charging EV battery from the home batteries makes no sense (economically and also physically due to power losses, battery cycling and so on), so I made simple flow in Node-RED for change ESS min. SOC during manual EV charging (automatically change value according to actual value and set back when charging finished), so EV is charged only from solar panels (in case of sufficient power) or from the grid, but not from the home battery.

Will it be possible to add simple function/option to EVCS setting for automatic change ESS min. SOC during manual charging?

Thank you very much,

Lukas

feature requestevcs
7 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Everything is possible, but why not doing that in node-red?

The EVCS interface is already very complex, and there are lots of other parameters available over modbus.
Adding another setting will make it even more complicated. I'm not sure if that's something that we want.

0 Likes 0 ·
motylu avatar image motylu Lucian Popescu (Victron Energy Staff) ♦♦ commented ·

Thanks for reply @Lucian Popescu (Victron Energy Staff) ,

for me, it is not problem, I made it using Node-RED, the great "weapon" in Victron PV system. But for other customers, this could be a problem, and for me this makes no sense to charge for example 50 kWh EV battery from 20 kWh home batteries - inefficient charging battery from another battery with DC to AC and back AC to DC lossy conversions...

1 Like 1 ·
Show more comments
luphi avatar image luphi commented ·
I had something similar in mind, but instead of modifying the ESS min. SOC value, I changed the grid set point. That allows the rest of the house to continue running on batteries.




0 Likes 0 ·
7 Answers
stefanwb avatar image
stefanwb answered ·

@motylu would you mind sharing your node red with me/us.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

We are planning to add the automatic mode algorithm inside ess, but I can't tell you when
0 Likes 0 ·
motylu avatar image
motylu answered ·

Yes, of course, I can share my simple solution. I am not professional programmer, so maybe some parts could be done more effectively, but is functional...

It is based on actual battery SOC (I am using Pylontech batteries), ESS min. SOC setting, actual EVCS mode and change of EVCS status. This algorithm allows to discharge Pylontech batteries down to 90% - this can be changed in "Set ESS min. SOC" node. When EVCS is in manual mode and status is changed to Charging, then algorithm save actual ESS min. SOC setting to file in OS filesystem and change it according to actual battery SOC:

  • If actual battery SOC is higher than or equal to 90%, ESS min. SOC is set to 90%.
  • If actual battery SOC is lower than 90%, ESS min. SOC is set to actual battery SOC.

When EVCS status is changed to another than Charging, algorithm automatically set ESS min. SOC setting to previous value according to saved value from file.

[{"id":"d456f73ce560c1e1","type":"tab","label":"EVCS & ESS","disabled":false,"info":"ESS setting according to EVCS state.","env":[]},{"id":"a07422d0fbffad4f","type":"comment","z":"d456f73ce560c1e1","name":"Control ESS setting","info":"","x":110,"y":100,"wires":[]},{"id":"18ebb840016053a3","type":"victron-input-evcharger","z":"d456f73ce560c1e1","service":"com.victronenergy.evcharger/40","path":"/Status","serviceObj":{"service":"com.victronenergy.evcharger/40","name":"EVCS-HQ2236ZDCZF"},"pathObj":{"path":"/Status","type":"enum","name":"Status","enum":{"0":"Disconnected","1":"Connected","2":"Charging","3":"Charged","4":"Waiting for sun","5":"Waiting for RFID","6":"Waiting for start","7":"Low SOC","8":"Ground fault","9":"Welded contacts","10":"CP Input shorted","11":"Residual current detected","12":"Under voltage detected","13":"Overvoltage detected","14":"Overheating detected"}},"initial":"","name":"","onlyChanges":true,"x":160,"y":540,"wires":[["d37c6411780a535f"]]},{"id":"ec0ffb3fdd3c0506","type":"comment","z":"d456f73ce560c1e1","name":"Check actual EVCS status","info":"","x":150,"y":500,"wires":[]},{"id":"d37c6411780a535f","type":"function","z":"d456f73ce560c1e1","name":"Save actual EVCS status","func":"// Save setting\nflow.set(\"ActualEVCSState\", msg.payload);\n\n// Set output message\nmsg_actual_evcs_state = { payload: msg.payload };\nmsg_actual_evcs_state.topic = \"ActualEVCSState\";\n\n// Send output message\nreturn msg_actual_evcs_state;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":540,"wires":[["6382a240761616fb"]]},{"id":"437a60443095e1f5","type":"comment","z":"d456f73ce560c1e1","name":"Check actual EVCS mode","info":"","x":150,"y":380,"wires":[]},{"id":"94fd2faa76cb1502","type":"victron-input-evcharger","z":"d456f73ce560c1e1","service":"com.victronenergy.evcharger/40","path":"/Mode","serviceObj":{"service":"com.victronenergy.evcharger/40","name":"EVCS-HQ2236ZDCZF"},"pathObj":{"path":"/Mode","type":"enum","name":"Mode","enum":{"0":"Manual","1":"Auto","2":"Schedule"}},"initial":"","name":"","onlyChanges":false,"x":160,"y":420,"wires":[["e302e4ca5a1e4d32"]]},{"id":"e302e4ca5a1e4d32","type":"function","z":"d456f73ce560c1e1","name":"Save actual EVCS mode","func":"// Save setting\nflow.set(\"ActualEVCSMode\", msg.payload);\n\n// Set output message\nmsg_actual_evcs_mode = { payload: msg.payload };\nmsg_actual_evcs_mode.topic = \"ActualEVCSMode\";\n\n// Send output message\nreturn msg_actual_evcs_mode;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":420,"wires":[[]]},{"id":"033522ecda4ff371","type":"function","z":"d456f73ce560c1e1","name":"Set ESS min. SOC","func":"// Get value\nlet ActualBatterySOC = flow.get(\"ActualBatterySOC\") || 100;\n\n// Set variables\nlet ESSMinSOCCharging = 90;\nlet ESSMinSOCSetting;\n\n\n// Check actual battery SOC and set min. SOC\nif ( ActualBatterySOC < ESSMinSOCCharging )\n    {\n        ESSMinSOCSetting = ActualBatterySOC;\n    }\nelse\n    {\n        ESSMinSOCSetting = ESSMinSOCCharging;\n    }\n\n// Set output message\nmsg_ess_soc = { payload: ESSMinSOCSetting };\nmsg_ess_soc.topic = \"ESSMinSOCSetting\";\n\n// Send output message\nreturn msg_ess_soc;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1810,"y":660,"wires":[["89e5f426b047518b"]]},{"id":"07fa9a708130af48","type":"comment","z":"d456f73ce560c1e1","name":"Set min. SOC","info":"","x":110,"y":620,"wires":[]},{"id":"b8f82b578c9aaec5","type":"victron-input-battery","z":"d456f73ce560c1e1","service":"com.victronenergy.battery/512","path":"/Soc","serviceObj":{"service":"com.victronenergy.battery/512","name":"Pylontech battery"},"pathObj":{"path":"/Soc","type":"float","name":"State of charge (%)"},"name":"","onlyChanges":false,"roundValues":"0","x":190,"y":180,"wires":[["da10af03d5b0f488"]]},{"id":"5c9d8a57cb650b0e","type":"comment","z":"d456f73ce560c1e1","name":"Load battery SOC","info":"","x":130,"y":140,"wires":[]},{"id":"da10af03d5b0f488","type":"function","z":"d456f73ce560c1e1","name":"Save actual battery SOC","func":"// Save setting\nflow.set(\"ActualBatterySOC\", msg.payload);\n\n// Set output message\nmsg_actual_soc = { payload: msg.payload };\nmsg_actual_soc.topic = \"ActualBatterySOC\";\n\n// Send output message\nreturn msg_actual_soc;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":180,"wires":[[]]},{"id":"fbad39ff55cbb006","type":"file in","z":"d456f73ce560c1e1","name":"Load ESS min. SOC from file","filename":"/data/home/nodered/ESSMinSOC","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":1160,"y":740,"wires":[["a8b633695f60abbd"]]},{"id":"a8b633695f60abbd","type":"json","z":"d456f73ce560c1e1","name":"Convert string to number","property":"payload","action":"obj","pretty":false,"x":1430,"y":740,"wires":[["89e5f426b047518b"]]},{"id":"6382a240761616fb","type":"switch","z":"d456f73ce560c1e1","name":"Check if EVCS mode is 0 (manual)","property":"ActualEVCSMode","propertyType":"flow","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":460,"y":700,"wires":[["d84ead4c0e28c0ef"]]},{"id":"89e5f426b047518b","type":"victron-output-ess","z":"d456f73ce560c1e1","service":"com.victronenergy.settings","path":"/Settings/CGwacs/BatteryLife/MinimumSocLimit","serviceObj":{"service":"com.victronenergy.settings","name":"Venus settings"},"pathObj":{"path":"/Settings/CGwacs/BatteryLife/MinimumSocLimit","type":"integer","name":"Minimum Discharge SOC (%)","writable":true},"initial":"","name":"","onlyChanges":false,"x":2120,"y":700,"wires":[]},{"id":"d84ead4c0e28c0ef","type":"switch","z":"d456f73ce560c1e1","name":"Check if EVCS status is 2 (charging) or another","property":"ActualEVCSState","propertyType":"flow","rules":[{"t":"eq","v":"2","vt":"num"},{"t":"neq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":820,"y":700,"wires":[["6a4fb9de2455a630"],["fbad39ff55cbb006"]]},{"id":"6c4a4ebed848bb55","type":"file","z":"d456f73ce560c1e1","name":"Save ESS min. SOC to file before change","filename":"/data/home/nodered/ESSMinSOC","filenameType":"str","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1520,"y":660,"wires":[["033522ecda4ff371"]]},{"id":"6a4fb9de2455a630","type":"function","z":"d456f73ce560c1e1","name":"Load actual ESS min. SOC setting","func":"// Get value\nlet value = flow.get(\"ActualESSMinSOCSetting\") || 100;\n\n// Set output message\nmsg_ess_actual_min_soc = { payload: value };\nmsg_ess_actual_min_soc.topic = \"ActualESSMinSOCSetting\";\n\n// Send output message\nreturn msg_ess_actual_min_soc","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":660,"wires":[["6c4a4ebed848bb55"]]},{"id":"b5c50028dedc9e3b","type":"comment","z":"d456f73ce560c1e1","name":"Load ESS min. SOC setting","info":"","x":160,"y":260,"wires":[]},{"id":"7685ffe6edcea0c8","type":"function","z":"d456f73ce560c1e1","name":"Save actual ESS min. SOC","func":"// Save setting\nflow.set(\"ActualESSMinSOCSetting\", msg.payload);\n\n// Set output message\nmsg_actual_ess_min_soc = { payload: msg.payload };\nmsg_actual_ess_min_soc.topic = \"ActualESSMinSOCSetting\";\n\n// Send output message\nreturn msg_actual_ess_min_soc;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":300,"wires":[[]]},{"id":"af8be1e0a7b86137","type":"victron-input-ess","z":"d456f73ce560c1e1","service":"com.victronenergy.settings","path":"/Settings/CGwacs/BatteryLife/MinimumSocLimit","serviceObj":{"service":"com.victronenergy.settings","name":"Venus settings"},"pathObj":{"path":"/Settings/CGwacs/BatteryLife/MinimumSocLimit","type":"integer","name":"Minimum Discharge SOC (%)"},"name":"","onlyChanges":false,"x":210,"y":300,"wires":[["7685ffe6edcea0c8"]]}]
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

stefanwb avatar image stefanwb commented ·
@motylu sorry for the late response and thanks for the code! I'll try it in the next two weeks.
0 Likes 0 ·
motylu avatar image
motylu answered ·

A made some improvements and also added rounding for SOC setting (rounding down to nearest multiple of 5 due to possible ESS setting in Cerbo GX).

[{"id":"d456f73ce560c1e1","type":"tab","label":"EVCS & ESS","disabled":false,"info":"ESS setting according to EVCS state.","env":[]},{"id":"a07422d0fbffad4f","type":"comment","z":"d456f73ce560c1e1","name":"Control ESS setting","info":"","x":110,"y":100,"wires":[]},{"id":"18ebb840016053a3","type":"victron-input-evcharger","z":"d456f73ce560c1e1","service":"com.victronenergy.evcharger/40","path":"/Status","serviceObj":{"service":"com.victronenergy.evcharger/40","name":"EVCS-HQ2236ZDCZF"},"pathObj":{"path":"/Status","type":"enum","name":"Status","enum":{"0":"Disconnected","1":"Connected","2":"Charging","3":"Charged","4":"Waiting for sun","5":"Waiting for RFID","6":"Waiting for start","7":"Low SOC","8":"Ground fault","9":"Welded contacts","10":"CP Input shorted","11":"Residual current detected","12":"Under voltage detected","13":"Overvoltage detected","14":"Overheating detected"}},"initial":"","name":"","onlyChanges":true,"x":160,"y":540,"wires":[["d37c6411780a535f"]]},{"id":"ec0ffb3fdd3c0506","type":"comment","z":"d456f73ce560c1e1","name":"Check actual EVCS status","info":"","x":150,"y":500,"wires":[]},{"id":"d37c6411780a535f","type":"function","z":"d456f73ce560c1e1","name":"Save actual EVCS status","func":"// Save value\nflow.set(\"ActualEVCSState\", msg.payload);\n\n// Set output message\nmsg_actual_evcs_state = { payload: msg.payload };\nmsg_actual_evcs_state.topic = \"ActualEVCSState\";\n\n// Send output message\nreturn msg_actual_evcs_state;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":540,"wires":[["6382a240761616fb"]]},{"id":"437a60443095e1f5","type":"comment","z":"d456f73ce560c1e1","name":"Check actual EVCS mode","info":"","x":150,"y":380,"wires":[]},{"id":"94fd2faa76cb1502","type":"victron-input-evcharger","z":"d456f73ce560c1e1","service":"com.victronenergy.evcharger/40","path":"/Mode","serviceObj":{"service":"com.victronenergy.evcharger/40","name":"EVCS-HQ2236ZDCZF"},"pathObj":{"path":"/Mode","type":"enum","name":"Mode","enum":{"0":"Manual","1":"Auto","2":"Schedule"}},"initial":"","name":"","onlyChanges":false,"x":160,"y":420,"wires":[["e302e4ca5a1e4d32"]]},{"id":"e302e4ca5a1e4d32","type":"function","z":"d456f73ce560c1e1","name":"Save actual EVCS mode","func":"// Save value\nflow.set(\"ActualEVCSMode\", msg.payload);\n\n// Set output message\nmsg_actual_evcs_mode = { payload: msg.payload };\nmsg_actual_evcs_mode.topic = \"ActualEVCSMode\";\n\n// Send output message\nreturn msg_actual_evcs_mode;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":420,"wires":[[]]},{"id":"033522ecda4ff371","type":"function","z":"d456f73ce560c1e1","name":"Set ESS min. SOC","func":"// Get value\nlet ActualBatterySOC = flow.get(\"ActualBatterySOC\") || 90;\nlet ActualESSMinSOCSetting = flow.get(\"ActualESSMinSOCSetting\") || 90;\n\n// Set variables\nlet ESSMinSOCCharging = 90;\nlet ESSMinSOCSetting;\n\n\n// Check actual battery SOC and set min. SOC\nif ( ActualBatterySOC < ESSMinSOCCharging )\n    {\n        ESSMinSOCSetting = Math.max(( Math.floor(ActualBatterySOC / 5) * 5 ), ActualESSMinSOCSetting);\n    }\nelse\n    {\n        ESSMinSOCSetting = ESSMinSOCCharging;\n    }\n\n// Set output message\nmsg_ess_soc = { payload: ESSMinSOCSetting };\nmsg_ess_soc.topic = \"ESSMinSOCSetting\";\n\n// Send output message\nreturn msg_ess_soc;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1810,"y":660,"wires":[["89e5f426b047518b"]]},{"id":"07fa9a708130af48","type":"comment","z":"d456f73ce560c1e1","name":"Set min. SOC","info":"","x":110,"y":620,"wires":[]},{"id":"b8f82b578c9aaec5","type":"victron-input-battery","z":"d456f73ce560c1e1","service":"com.victronenergy.battery/512","path":"/Soc","serviceObj":{"service":"com.victronenergy.battery/512","name":"Pylontech battery"},"pathObj":{"path":"/Soc","type":"float","name":"State of charge (%)"},"name":"","onlyChanges":false,"roundValues":"0","x":190,"y":180,"wires":[["da10af03d5b0f488"]]},{"id":"5c9d8a57cb650b0e","type":"comment","z":"d456f73ce560c1e1","name":"Load battery SOC","info":"","x":130,"y":140,"wires":[]},{"id":"da10af03d5b0f488","type":"function","z":"d456f73ce560c1e1","name":"Save actual battery SOC","func":"// Save value\nflow.set(\"ActualBatterySOC\", msg.payload);\n\n// Set output message\nmsg_actual_soc = { payload: msg.payload };\nmsg_actual_soc.topic = \"ActualBatterySOC\";\n\n// Send output message\nreturn msg_actual_soc;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":180,"wires":[[]]},{"id":"fbad39ff55cbb006","type":"file in","z":"d456f73ce560c1e1","name":"Load ESS min. SOC from file","filename":"/data/home/nodered/ESSMinSOC","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":1160,"y":740,"wires":[["a8b633695f60abbd"]]},{"id":"a8b633695f60abbd","type":"json","z":"d456f73ce560c1e1","name":"Convert string to number","property":"payload","action":"obj","pretty":false,"x":1430,"y":740,"wires":[["89e5f426b047518b"]]},{"id":"6382a240761616fb","type":"switch","z":"d456f73ce560c1e1","name":"Check if EVCS mode is 0 (manual)","property":"ActualEVCSMode","propertyType":"flow","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":460,"y":700,"wires":[["d84ead4c0e28c0ef"]]},{"id":"89e5f426b047518b","type":"victron-output-ess","z":"d456f73ce560c1e1","service":"com.victronenergy.settings","path":"/Settings/CGwacs/BatteryLife/MinimumSocLimit","serviceObj":{"service":"com.victronenergy.settings","name":"Venus settings"},"pathObj":{"path":"/Settings/CGwacs/BatteryLife/MinimumSocLimit","type":"integer","name":"Minimum Discharge SOC (%)","writable":true},"initial":"","name":"","onlyChanges":false,"x":2120,"y":700,"wires":[]},{"id":"d84ead4c0e28c0ef","type":"switch","z":"d456f73ce560c1e1","name":"Check if EVCS status is 2 (charging) or another","property":"ActualEVCSState","propertyType":"flow","rules":[{"t":"eq","v":"2","vt":"num"},{"t":"neq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":820,"y":700,"wires":[["6a4fb9de2455a630"],["fbad39ff55cbb006"]]},{"id":"6c4a4ebed848bb55","type":"file","z":"d456f73ce560c1e1","name":"Save ESS min. SOC to file before change","filename":"/data/home/nodered/ESSMinSOC","filenameType":"str","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1520,"y":660,"wires":[["033522ecda4ff371"]]},{"id":"6a4fb9de2455a630","type":"function","z":"d456f73ce560c1e1","name":"Load actual ESS min. SOC setting","func":"// Get value\nlet value = flow.get(\"ActualESSMinSOCSetting\") || 100;\n\n// Set output message\nmsg_ess_actual_min_soc = { payload: value };\nmsg_ess_actual_min_soc.topic = \"ActualESSMinSOCSetting\";\n\n// Send output message\nreturn msg_ess_actual_min_soc","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":660,"wires":[["6c4a4ebed848bb55"]]},{"id":"b5c50028dedc9e3b","type":"comment","z":"d456f73ce560c1e1","name":"Load ESS min. SOC setting","info":"","x":160,"y":260,"wires":[]},{"id":"7685ffe6edcea0c8","type":"function","z":"d456f73ce560c1e1","name":"Save actual ESS min. SOC","func":"// Save setting\nflow.set(\"ActualESSMinSOCSetting\", msg.payload);\n\n// Set output message\nmsg_actual_ess_min_soc = { payload: msg.payload };\nmsg_actual_ess_min_soc.topic = \"ActualESSMinSOCSetting\";\n\n// Send output message\nreturn msg_actual_ess_min_soc;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":300,"wires":[[]]},{"id":"af8be1e0a7b86137","type":"victron-input-ess","z":"d456f73ce560c1e1","service":"com.victronenergy.system/0","path":"/Control/ActiveSocLimit","serviceObj":{"service":"com.victronenergy.system/0","name":"Venus system"},"pathObj":{"path":"/Control/ActiveSocLimit","type":"integer","name":"Active SOC limit (%)"},"name":"","onlyChanges":false,"x":180,"y":300,"wires":[["7685ffe6edcea0c8"]]}]
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

vvv avatar image
vvv answered ·

Hi!
I imported and past flow but not working. do you have any sugestions? Thanks

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

motylu avatar image motylu commented ·
Hello @VVV ,

flow of course depends on your batteries and EVCS. You must probably reload (re-setting) battery node for load actual SOC according to your batteries (Pylontech batteries in my case) and EVCS node (each EVCS has unique S/N). Also nodes for load and set ESS min. SOC depends on FW version in Cerbo GX...

0 Likes 0 ·
motylu avatar image
motylu answered ·

Here is new version. I made some changes and improvements regarding new Cerbo GX and EVCS firmware versions. Now I am using the latest versions - Venus OS 3.12 and EVCS 1.27.

For example I added automatic enable/disable feed-in in EVCS automatic mode, primary for better recognition of excess energy and start EV charging... I used set global variable on another flow, but if you directly add "ESS Control" node from Victron palette with appropriate properties (ESS = "Venus setting" and Measurement = "Feed excess DC-coupled PV into grid") behind the "Set disable/enable feed-in (based on EVCS mode and status)" node, it will be also functional.

[{"id":"d456f73ce560c1e1","type":"tab","label":"EVCS & ESS","disabled":false,"info":"Control ESS setting based on EVCS mode/status.","env":[]},{"id":"a07422d0fbffad4f","type":"comment","z":"d456f73ce560c1e1","name":"Control ESS setting","info":"","x":110,"y":100,"wires":[]},{"id":"18ebb840016053a3","type":"victron-input-evcharger","z":"d456f73ce560c1e1","service":"com.victronenergy.evcharger/40","path":"/Status","serviceObj":{"service":"com.victronenergy.evcharger/40","name":"EVCS-HQ2236ZDCZF"},"pathObj":{"path":"/Status","type":"enum","name":"Status","enum":{"0":"Disconnected","1":"Connected","2":"Charging","3":"Charged","4":"Waiting for sun","5":"Waiting for RFID","6":"Waiting for start","7":"Low SOC","8":"Ground fault","9":"Welded contacts","10":"CP Input shorted","11":"Residual current detected","12":"Under voltage detected","13":"Overvoltage detected","14":"Overheating detected"}},"initial":"","name":"","onlyChanges":true,"x":160,"y":540,"wires":[["d37c6411780a535f"]]},{"id":"ec0ffb3fdd3c0506","type":"comment","z":"d456f73ce560c1e1","name":"Check actual EVCS status","info":"","x":150,"y":500,"wires":[]},{"id":"d37c6411780a535f","type":"function","z":"d456f73ce560c1e1","name":"Save actual EVCS status","func":"// Save value\nflow.set(\"ActualEVCSState\", msg.payload);\n\n// Set output message\nmsg_actual_evcs_state = { payload: msg.payload };\nmsg_actual_evcs_state.topic = \"ActualEVCSState\";\n\n// Send output message\nreturn msg_actual_evcs_state;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":540,"wires":[["6382a240761616fb","390208c9a4972891"]]},{"id":"437a60443095e1f5","type":"comment","z":"d456f73ce560c1e1","name":"Check actual EVCS mode","info":"","x":150,"y":380,"wires":[]},{"id":"94fd2faa76cb1502","type":"victron-input-evcharger","z":"d456f73ce560c1e1","service":"com.victronenergy.evcharger/40","path":"/Mode","serviceObj":{"service":"com.victronenergy.evcharger/40","name":"EVCS-HQ2236ZDCZF"},"pathObj":{"path":"/Mode","type":"enum","name":"Mode","enum":{"0":"Manual","1":"Auto","2":"Schedule"}},"initial":"","name":"","onlyChanges":false,"x":160,"y":420,"wires":[["e302e4ca5a1e4d32"]]},{"id":"e302e4ca5a1e4d32","type":"function","z":"d456f73ce560c1e1","name":"Save actual EVCS mode","func":"// Save value\nflow.set(\"ActualEVCSMode\", msg.payload);\n\n// Set output message\nmsg_actual_evcs_mode = { payload: msg.payload };\nmsg_actual_evcs_mode.topic = \"ActualEVCSMode\";\n\n// Send output message\nreturn msg_actual_evcs_mode;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":420,"wires":[[]]},{"id":"033522ecda4ff371","type":"function","z":"d456f73ce560c1e1","name":"Set ESS min. SOC","func":"// Get value\nlet ActualBatterySOC = flow.get(\"ActualBatterySOC\") ?? 90;\nlet ActualESSMinSOCSetting = flow.get(\"ActualESSMinSOCSetting\") ?? 90;\n\n// Set variables\nlet ESSMinSOCCharging = 90;\nlet ESSMinSOCSetting;\n\n\n// Check actual battery SOC and set min. SOC\nif ( ActualBatterySOC < ESSMinSOCCharging )\n    {\n        ESSMinSOCSetting = Math.max( ( Math.floor( ActualBatterySOC / 5 ) * 5 ), ActualESSMinSOCSetting);\n    }\nelse\n    {\n        ESSMinSOCSetting = ESSMinSOCCharging;\n    }\n\n// Set output message\nmsg_ess_soc = { payload: ESSMinSOCSetting };\nmsg_ess_soc.topic = \"ESSMinSOCSetting\";\n\n// Send output message\nreturn msg_ess_soc;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3050,"y":680,"wires":[["89e5f426b047518b"]]},{"id":"07fa9a708130af48","type":"comment","z":"d456f73ce560c1e1","name":"Set min. SOC (based on EVCS mode and status)","info":"","x":220,"y":620,"wires":[]},{"id":"b8f82b578c9aaec5","type":"victron-input-battery","z":"d456f73ce560c1e1","service":"com.victronenergy.battery/512","path":"/Soc","serviceObj":{"service":"com.victronenergy.battery/512","name":"Pylontech battery"},"pathObj":{"path":"/Soc","type":"float","name":"State of charge (%)"},"name":"","onlyChanges":false,"roundValues":"0","x":190,"y":180,"wires":[["da10af03d5b0f488"]]},{"id":"5c9d8a57cb650b0e","type":"comment","z":"d456f73ce560c1e1","name":"Load battery SOC","info":"","x":130,"y":140,"wires":[]},{"id":"da10af03d5b0f488","type":"function","z":"d456f73ce560c1e1","name":"Save actual battery SOC","func":"// Save value\nflow.set(\"ActualBatterySOC\", msg.payload);\n\n// Set output message\nmsg_actual_soc = { payload: msg.payload };\nmsg_actual_soc.topic = \"ActualBatterySOC\";\n\n// Send output message\nreturn msg_actual_soc;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":180,"wires":[[]]},{"id":"fbad39ff55cbb006","type":"file in","z":"d456f73ce560c1e1","name":"Load ESS min. SOC from file","filename":"/data/home/nodered/ESSMinSOC","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":2400,"y":720,"wires":[["a8b633695f60abbd"]]},{"id":"a8b633695f60abbd","type":"json","z":"d456f73ce560c1e1","name":"Convert string to number","property":"payload","action":"obj","pretty":false,"x":2670,"y":720,"wires":[["89e5f426b047518b"]]},{"id":"6382a240761616fb","type":"switch","z":"d456f73ce560c1e1","name":"Check if EVCS mode is 0 (manual) or another","property":"ActualEVCSMode","propertyType":"flow","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":370,"y":740,"wires":[["d84ead4c0e28c0ef"],["8d52341f0e1a55d4"]]},{"id":"89e5f426b047518b","type":"victron-output-ess","z":"d456f73ce560c1e1","service":"com.victronenergy.settings","path":"/Settings/CGwacs/BatteryLife/MinimumSocLimit","serviceObj":{"service":"com.victronenergy.settings","name":"Venus settings"},"pathObj":{"path":"/Settings/CGwacs/BatteryLife/MinimumSocLimit","type":"integer","name":"Minimum Discharge SOC (%)","writable":true},"initial":"","name":"","onlyChanges":false,"x":3360,"y":700,"wires":[]},{"id":"d84ead4c0e28c0ef","type":"switch","z":"d456f73ce560c1e1","name":"Check if EVCS status is 2 (charging) or another","property":"ActualEVCSState","propertyType":"flow","rules":[{"t":"eq","v":"2","vt":"num"},{"t":"neq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":760,"y":700,"wires":[["6a114cf1cbdf0f3a"],["8d52341f0e1a55d4"]]},{"id":"6c4a4ebed848bb55","type":"file","z":"d456f73ce560c1e1","name":"Save ESS min. SOC to file before change","filename":"/data/home/nodered/ESSMinSOC","filenameType":"str","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":2760,"y":680,"wires":[["033522ecda4ff371"]]},{"id":"6a4fb9de2455a630","type":"function","z":"d456f73ce560c1e1","name":"Load actual ESS min. SOC setting","func":"// Get value\nlet value = flow.get(\"ActualESSMinSOCSetting\") ?? 100;\n\n// Set output message\nmsg_ess_actual_min_soc = { payload: value };\nmsg_ess_actual_min_soc.topic = \"ActualESSMinSOCSetting\";\n\n// Send output message\nreturn msg_ess_actual_min_soc","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2420,"y":680,"wires":[["6c4a4ebed848bb55"]]},{"id":"b5c50028dedc9e3b","type":"comment","z":"d456f73ce560c1e1","name":"Load ESS min. SOC setting","info":"","x":160,"y":260,"wires":[]},{"id":"7685ffe6edcea0c8","type":"function","z":"d456f73ce560c1e1","name":"Save actual ESS min. SOC","func":"// Save setting\nflow.set(\"ActualESSMinSOCSetting\", msg.payload);\n\n// Set output message\nmsg_actual_ess_min_soc = { payload: msg.payload };\nmsg_actual_ess_min_soc.topic = \"ActualESSMinSOCSetting\";\n\n// Send output message\nreturn msg_actual_ess_min_soc;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":300,"wires":[[]]},{"id":"af8be1e0a7b86137","type":"victron-input-ess","z":"d456f73ce560c1e1","service":"com.victronenergy.system/0","path":"/Control/ActiveSocLimit","serviceObj":{"service":"com.victronenergy.system/0","name":"Venus system"},"pathObj":{"path":"/Control/ActiveSocLimit","type":"integer","name":"Active SOC limit (%)"},"name":"","onlyChanges":false,"x":180,"y":300,"wires":[["7685ffe6edcea0c8"]]},{"id":"646571a79d315809","type":"file","z":"d456f73ce560c1e1","name":"Set EVCS manual charging state flag in file","filename":"/data/home/nodered/EVCSManualChargingFlag","filenameType":"str","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":2070,"y":680,"wires":[["6a4fb9de2455a630"]]},{"id":"f34c947361320d49","type":"change","z":"d456f73ce560c1e1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1780,"y":680,"wires":[["646571a79d315809"]]},{"id":"5238f9224def7025","type":"change","z":"d456f73ce560c1e1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1780,"y":720,"wires":[["33b32fe3df7c1399"]]},{"id":"33b32fe3df7c1399","type":"file","z":"d456f73ce560c1e1","name":"Clear EVCS manual charging state flag in file","filename":"/data/home/nodered/EVCSManualChargingFlag","filenameType":"str","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":2070,"y":720,"wires":[["fbad39ff55cbb006"]]},{"id":"afc0306a01d0cabd","type":"switch","z":"d456f73ce560c1e1","name":"Check if EVCS manual charging flag is 0","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1500,"y":680,"wires":[["f34c947361320d49"]]},{"id":"6a114cf1cbdf0f3a","type":"file in","z":"d456f73ce560c1e1","name":"Load EVCS manual charging flag from file","filename":"/data/home/nodered/EVCSManualChargingFlag","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":1140,"y":680,"wires":[["afc0306a01d0cabd"]]},{"id":"f4adad25b50e890a","type":"comment","z":"d456f73ce560c1e1","name":"Enable/disable feed-in to grid (based on EVCS mode and status)","info":"","x":270,"y":820,"wires":[]},{"id":"390208c9a4972891","type":"function","z":"d456f73ce560c1e1","name":"Set disable/enable feed-in (based on EVCS mode and status)","func":"// Get values\nlet ActualEVCSMode = flow.get(\"ActualEVCSMode\") ?? 0;\nlet ActualEVCSState = flow.get(\"ActualEVCSState\") ?? 0;\n\n// Set variables\nlet FeedInEVCSSetting;\n\n\n// Check if actual EVCS mode is 1 (auto) and state is 2 (charging) or 4 (waiting for sun)\nif ( ( ActualEVCSMode == 1 ) && ( ( ActualEVCSState == 2 ) || ( ActualEVCSState == 4 ) ) )\n    {\n        // Enable feed-in to grid\n        FeedInEVCSSetting = 1;\n    }\nelse\n    {\n        // Disable feed-in to grid\n        FeedInEVCSSetting = 0;\n    }\n    \n// Save setting\nglobal.set(\"FeedInEVCS\", FeedInEVCSSetting);\n\n// Set output message\nmsg_evcs_feedin = { payload: FeedInEVCSSetting };\nmsg_evcs_feedin.topic = \"EVCSFeedInSetting\";\n\n// Send output message\nreturn msg_evcs_feedin;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":860,"wires":[[]]},{"id":"8d52341f0e1a55d4","type":"file in","z":"d456f73ce560c1e1","name":"Load EVCS manual charging flag from file","filename":"/data/home/nodered/EVCSManualChargingFlag","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":1140,"y":720,"wires":[["fb1f58b52fe3d41c"]]},{"id":"fb1f58b52fe3d41c","type":"switch","z":"d456f73ce560c1e1","name":"Check if EVCS manual charging flag is 1","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1500,"y":720,"wires":[["5238f9224def7025"]]}]
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

hbraak avatar image
hbraak answered ·

Hello everyone,
I would very much welcome such a feature.
So far I have written a small Python script that remembers the min_SOC (all via modbus to the CERBO GX). If the charging process is started when setting the sceduled or manual mode, the min_SOC of the ESS is set to the current SOC. If the charging process is ended, the initial min_SOC is restored. This prevents the Pylontec battery from discharging while the car is being charged in manual mode (or sceduled).

Enclosed is the programme.

Translated with DeepL.com (free version)

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

hbraak avatar image hbraak commented ·
script runs on a raspi2, which performs other services...
0 Likes 0 ·
hbraak avatar image
hbraak answered ·

ev-cerbopy.txt (3.3 KiB)
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

hbraak avatar image hbraak commented ·
​added .txt, because side doesn't allow .py upload..
0 Likes 0 ·

Related Resources

Additional resources still need to be added for this topic

The feature requests topic tag can help Victron R&D find feature suggestions for products. 

There are many factors that go into the Victron product roadmap, and feedback from end-users can help.