As the Cerbo only has 4 digital inputs and 2 relays you need extension modules. See attached links. Coding should be doable in Node-RED.
https://community.victronenergy.com/t/remotegpio-adding-relays-and-digital-inputs/5896
https://www.victronenergy.com/communication-centres/gx-io-extender-150