Another question for developers. Code for default tile/value

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.

thank you getting closer… i did as you outlined and even saved the new vid in the device handler and republished but still getting “checking status” on the dashboard view

ie

C:\st>cli-win presentation:device-config:generate 7e6bf0ba-7cb0-40a1-876a-a56adcd2084c --dth -j > st814.json.orig

C:\st>copy st814.json.orig st814.json.new
1 file(s) copied.

C:\st>e st814.json.new

C:\st>dir /od
Volume in drive C is Windows
Volume Serial Number is B259-C6B9

Directory of C:\st

07/31/2020 01:04 PM 99,544,590 cli-win.exe
08/05/2020 03:35 PM 28,301,141 smartthings-win.zip
08/05/2020 03:41 PM 1,090 st814.dv
08/05/2020 03:42 PM smartthings-win
08/05/2020 03:42 PM 0 smartthings.log
08/06/2020 02:15 PM 7,647 st814.json.orig
08/06/2020 02:15 PM .
08/06/2020 02:15 PM …
08/06/2020 02:19 PM 4,480 st814.json.new
6 File(s) 127,858,948 bytes
3 Dir(s) 365,772,607,488 bytes free

C:\st>cli-win presentation:device-config:create -i st814.json.new
mnmn: SmartThingsCommunity
vid: 97ba8873-f610-3322-a2be-ec1650316228
type: dth
dpInfo: null
iconUrl: null
dashboard:
states:
- component: main
capability: temperatureMeasurement
version: 1
values:
visibleCondition: null
actions:
- 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
  • component: main
    capability: battery
    version: 1
    values:
    visibleCondition: null
  • component: main
    capability: configuration
    version: 1
    values:
    visibleCondition: null
  • component: main
    capability: healthCheck
    version: 1
    values:
    visibleCondition: null
    automation:
    conditions:
    • component: main
      capability: temperatureMeasurement
      version: 1
      values:
      visibleCondition: null
    • component: main
      capability: relativeHumidityMeasurement
      version: 1
      values:
      visibleCondition: null
    • component: main
      capability: battery
      version: 1
      values:
      visibleCondition: null
    • component: main
      capability: alarm
      version: 1
      values:
      visibleCondition: null
    • component: main
      capability: configuration
      version: 1
      values:
      visibleCondition: null
    • component: main
      capability: healthCheck
      version: 1
      values:
      visibleCondition: null
      actions:
    • component: main
      capability: temperatureMeasurement
      version: 1
      values:
      visibleCondition: null
    • component: main
      capability: relativeHumidityMeasurement
      version: 1
      values:
      visibleCondition: null
    • component: main
      capability: battery
      version: 1
      values:
      visibleCondition: null
    • component: main
      capability: alarm
      version: 1
      values:
      visibleCondition: null
    • component: main
      capability: configuration
      version: 1
      values:
      visibleCondition: null
    • component: main
      capability: healthCheck
      version: 1
      values:
      visibleCondition: null

C:\st>cli-win presentation 97ba8873-f610-3322-a2be-ec1650316228 -j
{
“mnmn”: “SmartThingsCommunity”,
“vid”: “97ba8873-f610-3322-a2be-ec1650316228”,
“iconUrl”: null,
“dashboard”: {
“states”: [
{
“label”: “{{temperature.value}} {{temperature.unit}}”,
“alternatives”: [
{
“key”: “C”,
“value”: “°C”,
“type”: “active”,
“description”: null
},
{
“key”: “K”,
“value”: “°K”,
“type”: “active”,
“description”: null
},
{
“key”: “F”,
“value”: “°F”,
“type”: “active”,
“description”: null
}
],
“group”: null,
“capability”: “temperatureMeasurement”,
“version”: 1,
“component”: “main”,
“visibleCondition”: null
}
],
“actions”: ,
“basicPlus”:
},
“detailView”: [
{
“capability”: “temperatureMeasurement”,
“version”: 1,
“label”: “___PO_CODE_SMARTTHINGS_DREAM_SAC_TMBODY_TEMPERATURE”,
“displayType”: “slider”,
“toggleSwitch”: null,
“standbyPowerSwitch”: null,
“switch”: null,
“slider”: {
“range”: [
-20,
50
],
“step”: null,
“unit”: “temperature.unit”,
“command”: null,
“value”: “temperature.value”
},
“pushButton”: null,
“playPause”: null,
“playStop”: null,
“list”: null,
“textField”: null,
“numberField”: null,
“stepper”: null,
“state”: null,
“multiArgCommand”: null,
“component”: “main”,
“visibleCondition”: null
},
{
“capability”: “relativeHumidityMeasurement”,
“version”: 1,
“label”: “___PO_CODE_SMARTTHINGS_DREAM_SAC_HEADER_HUMIDITY_CHN”,
“displayType”: “slider”,
“toggleSwitch”: null,
“standbyPowerSwitch”: null,
“switch”: null,
“slider”: {
“range”: [
0,
100
],
“step”: null,
“unit”: null,
“command”: null,
“value”: “humidity.value”
},
“pushButton”: null,
“playPause”: null,
“playStop”: null,
“list”: null,
“textField”: null,
“numberField”: null,
“stepper”: null,
“state”: null,
“multiArgCommand”: null,
“component”: “main”,
“visibleCondition”: null
},
{
“capability”: “battery”,
“version”: 1,
“label”: “___PO_CODE_SMARTTHINGS_DREAM_SAC_TMBODY_BATTERY”,
“displayType”: “slider”,
“toggleSwitch”: null,
“standbyPowerSwitch”: null,
“switch”: null,
“slider”: {
“range”: [
0,
100
],
“step”: null,
“unit”: null,
“command”: null,
“value”: “battery.value”
},
“pushButton”: null,
“playPause”: null,
“playStop”: null,
“list”: null,
“textField”: null,
“numberField”: null,
“stepper”: null,
“state”: null,
“multiArgCommand”: null,
“component”: “main”,
“visibleCondition”: null
}
],
“automation”: {
“conditions”: [
{
“capability”: “temperatureMeasurement”,
“version”: 1,
“label”: “___PO_CODE_SMARTTHINGS_DREAM_SAC_TMBODY_TEMPERATURE”,
“displayType”: “numberField”,
“slider”: null,
“list”: null,
“numberField”: {
“value”: “temperature.value”,
“unit”: “temperature.unit”,
“range”: [
-20,
50
]
},
“textField”: null,
“emphasis”: null,
“component”: “main”,
“visibleCondition”: null
},
{
“capability”: “relativeHumidityMeasurement”,
“version”: 1,
“label”: “___PO_CODE_SMARTTHINGS_DREAM_SAC_HEADER_HUMIDITY_CHN”,
“displayType”: “numberField”,
“slider”: null,
“list”: null,
“numberField”: {
“value”: “humidity.value”,
“unit”: null,

here is new header in the dth

metadata
{
definition (name: “EverSpring ST814 V4a”, namespace: “lgkapps”, author: “@Ben chad@monroe.io and lgkahn”, ocfDeviceType: “x.com.st.d.sensor.moisture”, mnmn: “SmartThingsCommunity”, vid: “97ba8873-f610-3322-a2be-ec1650316228” )
{
capability “Battery”
capability “Temperature Measurement”
capability “Relative Humidity Measurement”
capability “Configuration”
c

i also created a whole new device handerl ver 4b on the code in case that was the issue but still coming up with checking status