Schema Devices and Custom Capabilities

Thanks @philh30 and @zldxkdlrj_dlcmaldml for your help,

I am now able to create or update my custom capability and presentation.
The problem is nothing is ever displayed in the Smartthings app.

Here is my capability:

{
    "id": "summerweather37297.orpmeasurement",
    "version": 1,
    "status": "proposed",
    "name": "ORPMeasurement",
    "attributes": {
        "ORP": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                    },
					"unit":{
						"type": "string",
						"enum": [
							"mV"
						]
					}	
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "enumCommands": []
        }
    },
    "commands": {}
}

Here is my presentation:

{
    "dashboard": {
        "states": [
            {
                "label": "{{ORP.value}} {{ORP.unit}}"
            }
        ],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "label": "ORP",
            "displayType": "state",
			"state": {
			    "label": "{{ORP.value}} {{ORP.unit}}",
				"unit": "ORP.unit",
			},
        },
    ],
    "id": "summerweather37297.orpmeasurement",
    "version": 1
}

And here is the response I send from my AWS Lambda to Smartthings:

{
    "headers": {
        "schema": "st-schema",
        "version": "1.0",
        "interactionType": "stateRefreshResponse",
        "requestId": "61154B2B-ED02-41A4-99DB-2C787D87CA43"
    },
    "deviceState": [
        {
            "externalDeviceId": "PoolBoy-0001",
            "states": [
                {
                    "component": "main",
                    "capability": "st.temperatureMeasurement",
                    "attribute": "temperature",
                    "value": 68,
                    "unit": "F"
                },
                {
                    "component": "main",
                    "capability": "summerweather37297.orpmeasurement",
                    "attribute": "ORP",
                    "value": 560,
                    "unit": "mV"
                },
                {
                    "component": "main",
                    "capability": "st.healthCheck",
                    "attribute": "healthStatus",
                    "value": "online"
                }
            ]
        }
    ]
}

The temperature is displayed properly in the app, but my other capability is never shown.
If I look at the events in the IDE, I can event see that Smartthings receives the value:

What am I doing wrong?
Is there a way to debug, or do I have access to Smartthings server logs that could help me ?

Thanks for your help,

Charles

Well, actually I’m suffering same problem with custom capability…
My custom cap also looks good and no error returns about state refresh, but there is nothing on ST APP.

Hello @cdelasablonniere,

As a workaround, create manually the device configuration and then modify the device profile with the new VID and MNMN. Here are the steps:

  1. Get the current device profile configuration
    smartthings deviceprofiles deviceProfileID -j -o=devProfile.json
  2. Create the device configuration. For this step, there are two ways to do it:
  • Take the file generated in Developer Workspace and modify it accordingly (use its name in the create command)
  • Generating the device configuration using the device profile ID
    smartthings presentation:device-config:generate deviceProfileID -j -o=DevConfig.json
  • Create the device config
    smartthings presentation:device-config:create -i DevConfig.json
  1. Copy and replace the VID and MNMN in the device profile and update the configuration
    smartthings deviceprofiles:update deviceProfileID -i devProfile.json

Let me know if you have any questions.

1 Like

Dear @nayelyz,

As recommended by @erickvI in another thread I completed all the steps you identified above and on the last step , I received β€œalready-published”.

Do I need to delete the existing published deviceProfile or can I un-publish it?

smartthings deviceprofiles:update b905ad36-0398-4954-a788-eb517d9028ee -i devProfile.json
[2020-09-01T14:39:12.973] [ERROR] cli - caught error Error: Request failed with status code 409: {"requestId":"537E91C9-2084-4FFC-9EB2-C659F93A288B","error":{"code":"ConflictError","target":null,"message":"already-published","details":[]}}

smartthings deviceprofiles

β”Œβ”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ # β”‚ Name                                  β”‚ Status    β”‚ Id                                   β”‚
β”œβ”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1 β”‚ Ambient Weather Station               β”‚ PUBLISHED β”‚ b905ad36-0398-4954-a788-eb517d9028ee β”‚
β”‚ 2 β”‚ Ambient Weather Station Remote Sensor β”‚ PUBLISHED β”‚ 948c96cb-e96d-4b23-b065-094c78a422a0 β”‚
β””β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

DevConfig.json

{
    "mnmn": "SmartThingsCommunity",
    "vid": "a6e74e5a-f265-3296-9757-23f70087351a",
    "type": "profile",
    "dpInfo": null,
    "iconUrl": null,
    "dashboard": {
        "states": [
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "relativeHumidityMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "illuminanceMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "ultravioletIndex",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "motionSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "waterSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "battery",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "powerMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "energyMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "powerConsumptionReport",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "refresh",
                "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": "illuminanceMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "ultravioletIndex",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "motionSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "waterSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "battery",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "powerMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "energyMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "powerConsumptionReport",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "refresh",
                "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": "illuminanceMeasurement",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "ultravioletIndex",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "motionSensor",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "waterSensor",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "battery",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "powerMeter",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "energyMeter",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "powerConsumptionReport",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "refresh",
            "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": "illuminanceMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "ultravioletIndex",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "motionSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "waterSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "battery",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "powerMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "energyMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "powerConsumptionReport",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "refresh",
                "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": "illuminanceMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "ultravioletIndex",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "motionSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "waterSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "battery",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "powerMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "energyMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "powerConsumptionReport",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "refresh",
                "version": 1,
                "values": [],
                "visibleCondition": null
            }
        ]
    }
}

devProfile.json

{
    "id": "b905ad36-0398-4954-a788-eb517d9028ee",
    "name": "Ambient Weather Station",
    "components": [
        {
            "label": "main",
            "id": "main",
            "capabilities": [
                {
                    "id": "temperatureMeasurement",
                    "version": 1
                },
                {
                    "id": "relativeHumidityMeasurement",
                    "version": 1
                },
                {
                    "id": "illuminanceMeasurement",
                    "version": 1
                },
                {
                    "id": "ultravioletIndex",
                    "version": 1
                },
                {
                    "id": "motionSensor",
                    "version": 1
                },
                {
                    "id": "waterSensor",
                    "version": 1
                },
                {
                    "id": "battery",
                    "version": 1
                },
                {
                    "id": "powerMeter",
                    "version": 1
                },
                {
                    "id": "energyMeter",
                    "version": 1
                },
                {
                    "id": "powerConsumptionReport",
                    "version": 1
                },
                {
                    "id": "refresh",
                    "version": 1
                }
            ],
            "categories": []
        }
    ],
    "metadata": {
        "vid": "5cf77327-f54d-4c2b-be9a-4ec31a3bfcd6",
        "deviceType": "Others",
        "mnmn": "0Av0",
        "ocfDeviceType": "oic.wk.d",
        "deviceTypeId": "Others",
        "ocfSpecVer": "core 1.1.0",
        "mnid": "0Av0",
        "mnId": "0Av0"
    },
    "status": "PUBLISHED",
    "owner": {
        "ownerType": "USER",
        "ownerId": "7692c84c-669b-4b98-996c-98b610925d98"
    },
    "restrictions": null
}
1 Like

Hello @kurtsanders,
Once you publish a device profile, it cannot be modified. As a workaround, you can do the following:

  1. Save the current device profile configuration in a JSON file.
  2. Delete the published device profile.
  3. Create a new one based on the saved configuration omitting unnecessary fields (ID, status).

It will appear in the list of the device profiles in Developer Workspace.

Note: Make sure to modify both VID and MNMN values, remember that the VID changes only if the capabilities used are different to avoid duplicates.

Ok, I am totally confused and I was better at developing groovy DTH’s… arg… So I hope someone in this thread can enlighten me, once I get the basics, I can be back up and running… Sorry I am so dense with this, I am very comfortable with creating json files, but the deviceProfile and devConfig have me going crazy.

I have decided to ONLY re-create the existing Ambient Weather Station groovy DTH with only the standard capabilities, later on I will add custom fields when I conquer basic!

The new ST app device tile I would like would create would look like the following:

Main

  • temperatureMeasurement

Details

  • temperatureMeasurement
  • relativeHumidityMeasurement
  • illuminanceMeasurement
  • ultravioletIndex
  • waterSensor
  • motionSensor
  • battery
  • powerMeter
  • energyMeter

So what’s going on here, I create a DTH manually on the developers workspace with these capabilities. I downloaded it using:

smartthings deviceprofiles a4ec3aaf-e48d-43be-ae04-ba2fa19f02ea -j -o=devProfile.json

{
    "id": "a4ec3aaf-e48d-43be-ae04-ba2fa19f02ea",
    "name": "Ambient Weather Station",
    "components": [
        {
            "label": "main",
            "id": "main",
            "capabilities": [
                {
                    "id": "temperatureMeasurement",
                    "version": 1
                }
            ],
            "categories": []
        },
        {
            "label": "details",
            "id": "details",
            "capabilities": [
                {
                    "id": "temperatureMeasurement",
                    "version": 1
                },
                {
                    "id": "relativeHumidityMeasurement",
                    "version": 1
                },
                {
                    "id": "illuminanceMeasurement",
                    "version": 1
                },
                {
                    "id": "ultravioletIndex",
                    "version": 1
                },
                {
                    "id": "waterSensor",
                    "version": 1
                },
                {
                    "id": "motionSensor",
                    "version": 1
                },
                {
                    "id": "battery",
                    "version": 1
                },
                {
                    "id": "powerMeter",
                    "version": 1
                },
                {
                    "id": "energyMeter",
                    "version": 1
                }
            ],
            "categories": []
        }
    ],
    "metadata": {
        "vid": "5cf77327-f54d-4c2b-be9a-4ec31a3bfcd6",
        "deviceType": "Others",
        "mnmn": "0Av0",
        "ocfDeviceType": "oic.wk.d",
        "deviceTypeId": "Others",
        "ocfSpecVer": "core 1.1.0",
        "mnid": "0Av0",
        "mnId": "0Av0"
    },
    "status": "DEVELOPMENT",
    "owner": {
        "ownerType": "USER",
        "ownerId": "7692c84c-669b-4b98-996c-98b610925d98"
    },
    "restrictions": null
}

when I issue the command below, the display output goes to the screen:

smartthings presentation:device-config:create -i DevConfig.json

{
    "mnmn": "SmartThingsCommunity",
    "vid": "39a73291-d8be-3f61-b574-9e69b3b86545",
    "type": "profile",
    "dpInfo": null,
    "iconUrl": null,
    "dashboard": {
        "states": [
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "relativeHumidityMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "illuminanceMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "ultravioletIndex",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "waterSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "motionSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "battery",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "powerMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "energyMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            }
        ],
        "actions": [
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "relativeHumidityMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "illuminanceMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "ultravioletIndex",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "waterSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "motionSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "battery",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "powerMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "energyMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            }
        ]
    },
    "detailView": [
        {
            "component": "main",
            "capability": "temperatureMeasurement",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "details",
            "capability": "temperatureMeasurement",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "details",
            "capability": "relativeHumidityMeasurement",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "details",
            "capability": "illuminanceMeasurement",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "details",
            "capability": "ultravioletIndex",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "details",
            "capability": "waterSensor",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "details",
            "capability": "motionSensor",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "details",
            "capability": "battery",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "details",
            "capability": "powerMeter",
            "version": 1,
            "values": [],
            "visibleCondition": null
        },
        {
            "component": "details",
            "capability": "energyMeter",
            "version": 1,
            "values": [],
            "visibleCondition": null
        }
    ],
    "automation": {
        "conditions": [
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "relativeHumidityMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "illuminanceMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "ultravioletIndex",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "waterSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "motionSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "battery",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "powerMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "energyMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            }
        ],
        "actions": [
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "relativeHumidityMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "illuminanceMeasurement",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "ultravioletIndex",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "waterSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "motionSensor",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "battery",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "powerMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            },
            {
                "component": "details",
                "capability": "energyMeter",
                "version": 1,
                "values": [],
                "visibleCondition": null
            }
        ]
    }
}

After that, I am {totally} confused which to do next, and what to change in which file, and what to re-load, and then when I update the vid in the IDE DTH, it never changes, even if I change the DTH, reboot the SP App, change the DTH, and reboot the ST APP.

Can one give me the steps next to do, one by one, and/or show me the file I should upload to update the deviceProfile.

Thank you in advance, I would be drowning if not for the expertise of community support!

I haven’t played in the developer workspace, but since you’re working with a groovy DTH you can do this completely in the CLI. Apologies if I have any syntax errors here - typing on my phone - but the steps below should be what you need to do:

  • Run this:
smartthings presentation:device-config:generate <UUID of your DTH> --dth -o DevConfig.json
  • Take your DevConfig.json, delete everything from the dashboard section except the one state capability and one action capability you want to show there.

  • Rearrange the detailView section to be in the order you want it, and delete any capabilities you don’t want to show in the detail.

  • Save.

  • Run this:

smartthings presentation:device-config:create -i DevConfig.json
  • Scroll up through what’s displayed to find the new vid and add that to your DTH.

  • Edit the name of your device to (hopefully) trigger a refresh of the display.

2 Likes

Hi, @philh30, @kurtsanders

  • About this step:

The only issue while getting the device configuration with the --dth flag is that the output won’t reflect the current components supported. Therefore, the path would be:

  • Generate the device configuration passing the device profile Id:
smartthings presentation:device-config:generate <device_profile_id> --json --output <device_config.json>
  • Then proceed to create the device configuration. just as you’ve mentioned above:
smartthings presentation:device-config:create --input <device_config.json>

Finally, update your DTH with the new vid and mnmn. Also, events must be sent to the proper componentName.

1 Like

I’m suggesting that the step of creating a device configuration in the developer workspace is superfluous at this point for a groovy DTH.

Is there a benefit to generating a device configuration in the developer workspace for a groovy DTH as opposed to going straight through the steps I laid out?

Hi, @philh30

The benefit would be that if your device uses different components (e.g. using the Child Temperature Sensor dth), the device configuration will be referring to these child components as well.

On the other hand, creating the metadata based on the dth’s Id, the device configuration will be only referring to the capabilities at the dth’s definition (main component).

Is there anywhere in the docs that gives a good explanation of components? I saw them referenced in the custom capability/presentation docs but only in passing.

WOW , thank you :moneybag: @philh30!

Those two CLI steps along with editing the output file worked like a charm to create the basic β€˜standard capabilities’ Main (temperature and refresh action) and Detail sensors views!

I am so glad you pointed out to use the new VID and MNMN from the display output of the second command. I was using the one in the input file (head banging)…

ComfortableSmugIndri-max-1mb

Now to move on learning how to add back the custom attributes, icons and titles/values…

3 Likes

It would be nice to use icons from new added weather status to main (dashboard)

Can we get a tutorial on creating a simple virtual device type in Developer Workspace?

I have the following DTH in the Groovy IDE, and would like to know how to port it to the new way.

metadata {
	definition (name: "Virtual Presence Sensor", namespace: "unraunet.com", author: "Jack Unrau") {
		capability "Presence Sensor"
		capability "Actuator"
		capability "Sensor"
		capability "Switch"
		command "on"
		command "off"
	}
}

def installed() {
	log.trace "Executing 'installed'"
	off()
}

def on() {
	log.trace "Executing 'on'"
	sendEvent(name: "presence", value: "present")
sendEvent(name: "switch", value: "on")
}


def off() {
	log.trace "Executing 'off'"
	sendEvent(name: "presence", value: "not present")
sendEvent(name: "switch", value: "off")
}

Hi there! you can create virtual devices using the SmartThings Schema following the steps above, the thing that changes between devices is mainly the connector.js file.
The device profile is used to define the capabilities used by it and the presentation (which capabilities are shown in dashboard - state and action, etc.)
Here’s the profile I created based on your DTH:

Note: the capabilities Actuator and Sensor are deprecated.

Below are my ST Schema project and screen captures of the device:


1 Like

So I would have to host code somewhere just to make a simple virtual device like this work? With my Groovy DTH, I just make a call to the device in SmartThings.

Yes, you would need to host the ST Schema connector, there are several tools that would allow you to do it (e.g. AWS Lambda functions). I know this may be different from what you are used to, but changes make life less boring :slight_smile:

I do not appreciate this change. It makes life more difficult for developers. All I need is probably a small custom code to get the job done which makes the current Groovy implementation awesome.

With the new change, I have to host it. And if I share with others, I have to host (pay) for other people usage. We spend hours developing custom codes/apps to enhance ST for free, now we are penalized (by paying hosting costs)!

1 Like

then…After making custom capability and presentation, I created Device Profiles in developer Workspace and used the my capability. But I couldn’t voice control the capability I created in the smartthings app.
Is there a way?

@junrau, What’s the purpose of the virtual device? You may use other tools and have the same result.

You can share your code or use case details and I would help you find an alternative too.