Another question for developers. Code for default tile/value

In the new mobile app there is a value shown on the default tile… I have some older device types namely the st814, a homi gas detector etc. that dont show a value just. “Checking Status”.

Does anyone have device type code examples that show how to enable this and show a value there. The examples in the ide (when creating device handler from example) still seem to be very old an dont have this code.

Thanks in advance

‘Checking status’ has been encountered on mobile devices that are not set to US English, but on my UK English devices it usually means the device handler has declared capabilities but not yet populated all the associated attributes with valid values and units. You will notice more recently updated device handlers make a point of initialising attributes.

In particular, specifying attribute units in events at least once can make a difference. Even though capabilities often have default units, the app seems to like them being explicitly defined.

What attribute you actually end up with on the tile rather depends on what capabilities you have defined. But that’s another battle.

thats not my issue as the devices are working fine and show temp humidity etc correctly when you click on the tile. so the values are there,. there definately is some code. missing.

here is the code and i did add unit but still not showing anythng.

tiles 
{
	valueTile("temperature", "device.temperature", width: 2, height: 2) {
    	tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
		state("temperature", label:'${currentValue}°', unit:"F",
            icon: "http://cdn.device-icons.smartthings.com/Weather/weather2-icn@2x.png",
			backgroundColors:[
            	[value: 1,  color: "#c8e3f9"],
            	[value: 10, color: "#dbdee2"],
            	[value: 20, color: "#c0d2e4"],
				[value: 32, color: "#153591"],
				[value: 44, color: "#1e9cbb"],
				[value: 59, color: "#90d2a7"],
				[value: 74, color: "#44b621"],
				[value: 84, color: "#f1d801"],
                [value: 92, color: "#d04e00"],
				[value: 98, color: "#bc2323"]

			]
		)
	}
    }

	valueTile("humidity", "device.humidity", inactiveLabel: false) {
		state "humidity", label:'Humidity\n ${currentValue}%', unit:"",
          icon: "http://cdn.device-icons.smartthings.com/Weather/weather12-icn@2x.png",
           backgroundColors : [
                [value: 01, color: "#724529"],
                [value: 11, color: "#724529"],
                [value: 21, color: "#724529"],
                [value: 35, color: "#44b621"],
                [value: 49, color: "#44b621"],
                [value: 50, color: "#1e9cbb"]
     ]        
}

The tile display is determined by the capabilities and/or the vid, and you can change it if you use the smartthings developer workspace.

Hello @Lgkahn

In this case, because you are using predefined capabilities (TemperatureMeasurement and Relative Humidity Measurement), the “checking status” message can be for the following reasons:

  1. In the DTH, there is no method to provide the “online” status of the device
  2. There is no device configuration presentation (VID)

You can check the code of “Simulated button” located in the “From Example” tab and use the simulator and see the role played by the initialize() method.
For the device configuration presentation, you can check this post to generate it using the DTH ID, this will provide the mobile application the information on how to display the device capabilities.
About the Fahrenheit unit, once you see the tile in the detail view, click on the configuration icon and you can select it (see the picture below).

If one of these posts answers your question, can you please mark it as solved? If not, let me know what’s going on and I can dig in further.

i dont think it is any of those . but thanks… it is also broken in the stock device type… i think it is a bug… i did try adding the follwing vid etc and it didnt break it but didnt fix it either.

definition (name: “EverSpring ST814 V4a”, namespace: “lgkapps”, author: “@Ben chad@monroe.io and lgkahn”, ocfDeviceType: “x.com.st.d.sensor.moisture”, mnmn: “SmartThings”, vid: “generic-humidity” )

i alos have health control in and added the following initialize function and called it from upated and configure and it still is showing checking status on the initial tile

private initialize() {
log.trace “Executing ‘initialize’”

sendEvent(name: "DeviceWatch-DeviceStatus", value: "online")
sendEvent(name: "healthStatus", value: "online")
sendEvent(name: "DeviceWatch-Enroll", value: [protocol: "cloud", scheme:"untracked"].encodeAsJson(), displayed: false)

}

even if this worked the tile would say online. how do i get it to show the temp ?

Also, i have another similiar custom device type that has none of that stuff other than health check
and it is showing a status albeit the wrong one as it has a configuration option for primary control which is currently set to temperature but is showing the “no motion” status due to the motion capability.

how do we control which capability shows on the initial tile. this seems screwy there needs to be a way to tell it which one.
See my device type/handler “Zooz/Monoprice 4-in-1 Multisensor v1.4.2”

I think the bug must be in your code for either the temperature or humidity measurement capability whichever it thinks is primary and that is also why the stock handler is not working as well.

these are not custom capabilities these are stock capabilities ie temp measurement , humidity measurement etc.

Also

i dont want to totaly rewrite a device handler in the new way as it will break it in the old app and they are still being used… That documentation is wholely irrelevant in my case… I need to know how to control what gets displayed on the tile in th eexisting device thpes and it seems there is no control over it . The system just choooses one of the capabilities and runs with it…

Anothe rreason I will most likely be transitioning to hubitat… Why not come out with a new interface that for the most part makes everything written irrelavant and is very limiting?

That thread also details how to create new device page UI elements and define the main tile for standard capabilities.

Hi @Lgkahn,

In the device configuration presentation, you specify which capability is displayed in the different views (dashboard, detail, automation). When you create it, the assigned VID must be added to the DTH definition. For example:

//Device configuration presentation
    "dashboard": {
        "states": [
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            }
        ]
    },
    "detailView": [
        {
            "component": "main",
            "capability": "temperatureMeasurement",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "relativeHumidityMeasurement",
            "version": 1,
            "values": [],
            "visibleCondition": null
        }
    ] 
    //DTH definition
    definition (name: "DTHName", author: "xxxx",deviceType:"Leak Sensor", ocfDeviceType: "x.com.st.d.sensor.moisture", namespace:"smartthings", vid: "xxxxx-xxx-xxxx", mnmn: "SmartThingsCommunity") {
		capability "temperatureMeasurement"
        capability "relativeHumidityMeasurement"
	}

In the picture below, you can see the device without defining the device UI and with the configuration shown in the sample above respectively.
temperature_dev_config

thats that all and good but seems to imply i have to totaly rewrite all my existing device handlers in the new way, which is not wht im looking to do…How do i easily retrofit an existing one written in groovey so it also work in the old and new app

Franky, you have a new platform which you have been rolling out for years… yet your example code in the IDE hasn’t been updated in the last 4-6 YEARS! Many of which no longer work.

Isn’t it about time you updated those examples? I get that proper docs were not realistic when you were a Kickstarter campaign run by amateurs without the resources of a real company, but this is Samsung… yet the lack of proper resources to the community continues.

greed i tried to go through the examples fo rthe new methods and they are incomplete .

says todo: link api etc… there is not one example that follows all the wayt thorugh.
in addition i tried to create the temperature measurement capability with the cli which is what i beive i have to do then link the presentation ib…

this is in windows it just hangs a finish and create and puts dots out forever and after 5 minutes CRASHES with unusefull message

C:\st>cli-win capabilities:create
? Capability Name: temperatureMeasurement
? Select an action… Add an attribute
? Attribute Name:
C:\st>cli-win capabilities:create
? Capability Name: temperatureMeasurement
? Select an action… Add an attribute
? Attribute Name: lastUpdate
? Select an attribute type: string
? Maximum length (default: no max length): 20
? Add a setter command for this attribute? No
? If you want to add a basic command, enter a command name now (or hit enter for none):
(Basic commands are simple commands that set the attribute to a specific value.)
? Select an action… Finish & Create

…[2020-08-05T16:08:31.656] [ERROR] cli - caught error TypeError: Cannot read property ‘response’ of undefined

Hi @Lgkahn,

There is no need for you to rewrite your DTH, sorry for the confusion, what I meant was, using the SmartThings CLI, you can generate the UI configuration based on which capabilities you defined in the DTH, then you edit it at your convenience and create it. You would only need to add in the DTH the VID and MNMN properties. Based on the tutorial, you would have to perform the last step explained in the “Generate / Post Device Configuration“ part because you are not using custom capabilities.

Please update the examples so we do not need to do this via the braille method. The overwhelming majority of DIY developers here have used these to work on their on devices since 2013, yet now many are obsolete.

I get you will deprecate all of this in the next year or two (and I will be moving on at that time), but why not throw us a bone until then?

1 Like

CLI and Custom capabilities are currently in developer preview. There are still missing components and APIs that have not been exposed yet. We are working with developers out in the open on these tools and the new direction forward. The goal is to deliver a complete and compelling developer experience.

ok and how do i do that since your example is incomplete for the api call it says

The CLI will make this call for generation of the device config, and here is what the API returned:

TODO: LINK API

i also dont even see an option in the cli to generate a device config as outlined in that document.
ie

C:\st>cli-win.exe
SmartThings unified CLI

VERSION
@smartthings/cli/0.0.0-pre.6 win32-x64 node-v12.18.1

USAGE
$ smartthings [COMMAND]

COMMANDS
apps get a specific app or a list of apps
autocomplete display autocomplete installation instructions
capabilities get a specific capability
config list config file entries
deviceprofiles list all device profiles available in a user account or retrieve a single profile
devices list all devices available in a user account or retrieve a single device
generate generate a Java starter app
help display help for smartthings
installedapps get a specific app or a list of apps
locations get a specific Location
plugins list installed plugins
presentation query device presentation by vid
rules get a specific rule
schema list all ST Schema Apps currently available in a user account

C:\st>cli-win.exe deviceprofiles
…[2020-08-06T12:16:15.120] [ERROR] cli - caught error undefined

C:\st>

C:\st>cli-win.exe presentation generic-humidity
[2020-08-06T12:39:50.893] [ERROR] cli - caught error Error: Request failed with status code 404: {“requestId”:“3D86CD49-180D-4889-9B82-E28FCEC1EF68”,“error”:{“code”:“NotFoundError”,“target”:null,“message”:“A resource could not be found.”,“details”:}}

C:\st>cli-win.exe presentation schema
[2020-08-06T12:40:08.772] [ERROR] cli - caught error Error: Request failed with status code 404: {“requestId”:“433F9758-F0C4-4553-B198-7832CA11F342”,“error”:{“code”:“NotFoundError”,“target”:null,“message”:“A resource could not be found.”,“details”:}}

also it seems the cli in general doesnt even work as no matter wha t i do i get error messages

Hi @Lgkahn,

Here are the steps to create the device configuration presentation:

  1. Your DTH must be saved and published, take its ID (the alphanumeric value in the URL).
  2. Use the tool to generate a standard presentation. You should see all of your defined capabilities in each view
smartthings presentation:device-config:generate dthID --dth -j


3. Copy that output in a JSON file and edit it, in the dashboard view you could leave only the Temperature Measurement capability in the “states” property, “actions” in the same view is for those capabilities that can receive a command, such as Switch.
4. Create the device config presentation and take the VID and MNMN values onto the DTH.

To see that presentation in JSON format, you could use the command:

smartthings presentation VID -j

Those commands are listed in the SmartThings CLI Readme and you can also check this document to see the API requests to generate and create the device configuration.