Normally that error occurs when you take code which is a device type handler but you paste it in as a smart app. These are two completely different types of code.
The good news is that yes, once you have the correct code correctly installed then you will be able to use the device in automations. That’s kind of the whole point of using the custom DTH.