Sending commands to custom device type from SmartApp

I feel like I’ve hit a brick wall when it comes to communicating with my custom device via a smart app.

I’m getting an error in my logs that looks like this: groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.notification() is applicable for argument types: (java.lang.String) values: (my JSON string here)

I’ll post some abstracted code to illustrate the flow of what I’m trying to do:

Device Type Handler

metadata {
    definition (name: "CustomDevice", namespace: "xxxxx.xxxxx", author: "xxxxxx", oauth: true) {

        capability "Switch"
        capability "Switch Level"
        capability "Refresh"

        //notification command that takes a JSON string
        command "notification", ["string"]

def notification(params) {
  log.debug "params: ${params}"

My Smart App using the custom device


def setPermissions() {
	log.debug "setPermissions"
    return dynamicPage(name:"setPermissions", title:"Select Things", uninstall:true, install:true) {
        section("") {
        	paragraph "xxxxxx"

            input "contactSensors", "capability.contactSensor", title: "Which Contact Sensors? (DEBUG)", multiple: true, required: false

			paragraph ""
          	input "customs", "device.customdevice", title: "Select device to show the notification?", multiple: true, required: false, submitOnChange: true

def installed() {
	log.debug "Installed with settings: ${settings}"

def updated() {
	log.debug "Updated with settings: ${settings}"

def initialize() {

def setupSubscriptions() {
    subscribe(contactSensors, "contact", Handler_baseHandler, [filterEvents: false])

def Handler_baseHandler(evt) {
    def notification =  new org.json.JSONObject([
        id: "1234456",
        title: "Some Title",
        body: "Some Body"
    //send off the notification to our devices
    if(notification != null) {
       //this line of code is what throws the error

Would love any help that people could give :slightly_smiling:

Not sure this will help, but I’ll toss anything out there just in case it gets you unstuck.

I seldom use arguments with ad hoc Commands. (Though I believe your syntax is correct).

Still… What happens if you just say

command "notification"


Thanks a lot for the reply, but that didn’t work.

The device has the “Switch” capability and even calling on() or off() doesn’t work from my SmartApp.

Does this cause the same error in Live Logging?

Unfortunately, SmartThings has no debugging tools, and/or bugs are often caused by a bug on the platform, not our own code.

More than once I’ve had to strip a Device Type or SmartApp to the bone and build it up again or even start in a new copy entirely.

Since Capability Switch (on/off) is standard, I suggest stripping down the device type bit by bit until you isolate and fix on/off… (or start with on/off and build up until something breaks, testing every step of the way).

This might be a wild goose chase or good recollection of a past thread, but I see you’re selecting your custom device by searching directly for devices of its type. For some reason, I recall there being an issue where this method doesn’t actually return the actual device object, and only a stripped down version of its attributes or something.

If it has Switch capability, try using that as your filter in the input line and see if it works.


Alright, that’s a serious bug they need to sort out.

Sure enough I changed it to capability.switch from device.customdevice and sure enough it worked like a dream.

Time for me to pick some random capability (maybe Sleep Sensor?! haha) to add to my custom device so that all my switches don’t come up.


I do this with one of my custom Device Types and it works fine. But, yes, I’ve heard of issues. Just don’t think I’ve experienced any such problem. Not sure if my situation is the same though.

1 Like

Maybe check out this full list and pick one that isn’t even documented like SamsungTV…


The irony of your suggestion would blow your mind. Thanks so much for the list!

1 Like