How to automatically Update MaxCurrentCharge

of course, I mean, in a situation like this, if the system is charging, I need to tell him to stop, either with passthrough or invert, now with Node-RED I have many possibilities I do not had before… I will find a way, but someone should have some advise.