Help With MySensors and Arduino Mega

Hi I need some help with the coding layout that is made in arduino IDE to then load on the mega to communicate with MySonsors home assistant addon.

I’m getting stuck on how to layout the code to combine features and report though the mega ethernet gateway.

for example I have a I/O controller that has the following in it

1 mega board
1 ethernet shield
3 relays
4 digital inputs
4 PWM outputs
1 onewire temperature sensor DS1822

I have 3 of there I/O boxes all the same but just different quantity’s of sensor and relays.

I can see lots of examples of the code for a single sensor , But I need multiple and the ethernet gateway or MQTT if it is easier.
Where do I start?