My device crashes the new app? Please help

I’m working on migrating my custom device handler to the new app or (non-classic app). However, ever since the new app has been available my device will crash the app when selecting it. I have also been following the documentation which was really sparse in the beginning. Eventually I gave up and I just came back today to discover custom capabilities are out and I think I can finally migrate my device over. I’ve been reading all evening and I have some good direction to go on but I have a few questions before I start and on the state of things.

  1. I can’t seem to figure out how my DTH could cause the new app on my phone to crash (happens in different devices). Is this normal behavior? I was expecting to see everything but the two custom capabilities my device has. I’m hoping this has happened to someone else and there is a specific reason. I also don’t even know how to debug the app crashing.

  2. My device is connected to LAN to Hub via WIFI and there is a service manager smart app that uses SSDP. Is LAN WIFI device not supported in the new app? If so, is SSDP with a service manager still the recommended way?

Thanks

I got the device to not crash the app by removing it and re-adding it through the service manager in the new app. I also updated the namespaces for the DTH and service manager to the generated one.

However, I added a color temperature capability like the guide but it’s not showing up in the device settings?

I added another custom capability just called ‘effect’, I just wanted a list control with 3 options, I can follow the guide and each step works, of course with changing it to the proper display configuration JSON. However, I can’t get the list control to show up. Even after deleting the device and re-adding it. What am I doing wrong?

Hi there! Verify the VID used in your device by getting the device list, the value is in the presentationId property.
Can you give me more details? This means your capability presentation and definition, and your device configuration with the generated VID.

I checked the VID (presentationID) from the device list and it’s referencing an out of date one. When I look it up it doesn’t have my new ‘effect’ capability.

How do I update it?

Uh, I hit the device/id endpoint again via Postman and I see the presentationId toggle back and forth between my old and new values. Is there some sort of node propagation issue?

I created a new DTH and that solved the flipping presentationID, still the same issue though. Here are the files you requested.

Capability Config:

Capability Presentation:

Device Config:

I used your capability in my device and it appears correctly. Can you share with me a screen capture of how your device appears in the app, please?
Here’s my DTH definition and the initialize function:

definition (name: "testEffectCap", author:"nayely",vid: "54efeafb-2857-3924-a25f-2676b2ed7717", mnmn: "SmartThingsCommunity") {
    capability "switchLevel"
    capability "colorControl"
    capability "switch"
    capability "colorTemperature"
    capability "organicorange40017.effect"
}
//Initialize the capability's attribute value
private initialize() {
	log.trace "Executing 'initialize'"
    sendEvent(name: "effect", value: "solid")
    //...
}

I just don’t see the the list control I added. This is a childDevice, but even If I make a virtual device using my DTH, I still don’t see it in the app.


I updated my DTH to use the VID you posted here and re added the device. I now see the control. So somehow I must be generating the VID wrong when executing smartthings presentation:device-config:create

Can you share how you got this VID? maybe the config file you submitted?

Sure, the steps I followed were:

  1. I created and published my DTH
  2. I generated the device presentation file using the DTH ID which is at the end of its URL, eg. https://graph.api.smartthings.com/ide/app/editor/xxxx-xxxx-xxxx
smartthings presentation:device-config:generate dthID --dth -j -o=devConfigPres.json
  1. I edited the file to look like this one.
  2. I created the device presentation
smartthings presentation:device-config:create -i devConfigPres.json
  1. I took the values of the vid and mnmn properties and add them to my DTH, then saved and published it again.

A few things I noticed because that is basically what I did. Did you on mean to leave off -j on step 5?
Also, for the device config, I see you left the automation values defined but not in the details view? Was that intentional as well? I originally added them because I was testing if values needed to be defined, I guess not?

This is the command I use to create the device presentation, it is accepted as well as:

smartthings presentation:device-config:create -i devConfigPres.json -j

You’re right, now I added the enabledValues in the Detail View and created a new presentation. The list also appears. (I updated the file)

devicePresentation

@nayelyz I’ve been working on rewriting my device to use the new direct-connected model (MQTT). I had everything working, even my custom capability “effect”.

I wanted to add a new value to the the “effect” capability so I used the CLI to add a new value but using update and updating the capability presentation. Then I regenerated the UI for my new device via the Developer Workspace. It worked, and I see my new value.

However, I’ve somehow broken the capability, now when I select any value I get a network error. The other capabilities still work. I’ve deleted and re-added my device and event so far as to create a whole new project (new keys, and profile). It still doesn’t work. I don’t see any errors on the console output on my device. When connecting to SmartThings the capability is accepted and the default value is applied. It’s just communication from the app to the device is broken.

Any idea what I did wrong updating the capability?

Edit: I can control the device from the SmartThings CLI (Not the console cli over uart) using my “effect” capabilities new value just fine. So I’m at a even a further lost why the SmartThings App doesn’t want to sent the value.

I figured out what was wrong. When I updated the capability I didn’t have the setter property set thus it got deleted. I was thinking PUT would work like PATCH.

Hey, @bban! That’s great, so, is the “effect” capability working now?

Yes. The documentation on the capabilities page doesn’t have any examples with a setter defined. I was going by those examples when I formed my update request.

Is there more in depth documentation anywhere? At work, I would just read the code, but I can’t do that here =).

That’s great!

You can take a look at the SmartThings API reference documentation. Or, query the capability configuration through the CLI, based on the capabilities reference, you can know when a capability uses a setter by the command name, which is setAttributeName, then, on the CLI, you can use these commands:

//Get Capability definition
smartthings capabilities switchLevel -j
smartthings capabilities thermostatCoolingSetpoint -j

//Get Capability presentation
smartthings capabilities:presentation switchLevel -j
smartthings capabilities:presentation thermostatCoolingSetpoint -j

@nayelyz How does the numberOfButtons property on the button capability work?

If I had 2, or 3, or 4 buttons where are these states stored?

The other way I think this can be done by just adding the capability multiple times, maybe under different components?

Even the reference capability C code doesn’t really appear to work with the idea of multiple buttons in on button capability. As you can see nothing in there indicated which button is being changed.

Yes, you’re right, to have multiple buttons on the device, you need to add this capability in different components, the numberOfButtons property doesn’t create them. It was mostly used on the DTHs to create the child devices (components), look at this handler.
If you have more questions about the Direct-connected integrations, you can post them at this thread: