I’ve searched the forums quite a bit for an answer to this, and if I have missed it, please direct me to where.
Reading through webcore basics series in this forum has been greatly helpful, and I have found some changes in my code in question I need to make to align with the best practices found there.
My question is, is it better to accomplish all related tasks in one large piston, executing sub pistons in one organized place, or have a bunch of individual pistons accomplishing these tasks, sharing information with global variables?
An example to this is I have a space I use HE/Webcore to automate everything from HVAC to lighting and security. For the HVAC, I created one large piston that controls two units and an economizer in concert with outdoor air temps and averaging multiple sensors across the space. This works well, but it is a little clunky I’m sure based on my own limited experience in writing webcore “code”. It spans about 350 lines and uses 13K+ of memory.
In my security applications, I experimented in using individual pistons running maybe ten lines a piece, all sharing data between the pistons using global variables. What’s the opinion on correct operation here? I suspect both are acceptable, but to me it seems more logical to place everything in one large piston.