Can't add SmartApp from code

I just installed a SmartThings Hub and have a few existing TP-Link WiFi switches I wanted to integrate with it. So I found a SmartApp code that is supposed to allow that. However, when I copy and paste the code, it fails. What’s more, the error message changes every time I click save even without touching the code. Here’s what the message is:

No signature of method: script_app_metadata_ec13e314_c74d_44a7_b737_6d4572b12981.metadata() is applicable for argument types: (script_app_metadata_ec13e314_c74d_44a7_b737_6d4572b12981$_run_closure1) values: [script_app_metadata_ec13e314_c74d_44a7_b737_6d4572b12981$_run_closure1@51eaf030] Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)

The part with the various hex code is what changes every time. I’ve also tried code to configure my Zooz Zen21 switches and the same type of error code appears. So I know it’s not the code. Is there a setting in my account that’s not letting me save code? Developer is enabled which allows me to access the building my own SmartApps from code.

You’re trying to install code for a device type handler as a SmartApp. Make sure the code you have is for a device type handler, and then create your own custom one in the IDE.


Thanks. Of course I spent over a week trying to figure this out on my own and just minutes after posting this, I figured it out! Figures. Thanks!