Hello @GypGC, and welcome aboard. As @zenofmud suggests, you should post your entire flow. If you have a working system that resolves issues specific to your situation, you might want to post to the "Share Your Projects" category so that people will understand that you have a fully functional project.
When you mention "optimally," it would help to know specifically what it is you want to optimize. I know a little bit about narrowboat electrics and would be interested in having a look at your flow.