Is there code that acts as the smart things hub?

So, if I understand you correctly, you basically have a Zigbee device currently connected to the ST Hub. You want to add a custom device between the ST Hub and the Zigbee device. Is that correct? May I ask why you need to filter the communications between this the device and ST hub? I can think of a few ways to accomplish this, but they all involve inserting another home automation ‘hub’ between the ST Hub and the Zigbee device. For example, you could insert a Hubitat Hub, which has very good Zigbee support, and allows you to write your own drivers (very similar to SmartThings, but is 100% local processing.) There are apps you can load on ST and Hubitat that then allow data to be transferred between them.

ST_Anything allows you to create your own devices. For example, I have pre-wiring in my home for an alarm system. Instead of buying Zigbee/Z-Wave door and window sensors, I simply hooked up the existing wiring to an Arduino. This in turns results in SmartThings devices being created. I also use it to control a relay for each garage door, allowing me to open/close the doors when away from home (have you even forgotten to close your garage door, or had to turn around to prove to yourself that you did?). I also have a motion detector attached, as well as temperature and humidity sensors. The library is pretty extensive and implements many of the ST Device Capabilities.

Take a look at

You can also simply use the communications libraries to completely roll-your-own Arduino sketch, if desired. Let me know if you have any additional questions.