Hello, Support Team.
Please check and publish my Device Profile.
Device Profile ID: 4f9470cd-8f76-4af9-880f-87d87a633fee
Device Profile Name: c2c-monitoreal-hub
Thanks.
Hello, Support Team.
Please check and publish my Device Profile.
Device Profile ID: 4f9470cd-8f76-4af9-880f-87d87a633fee
Device Profile Name: c2c-monitoreal-hub
Thanks.
Hi, @olegin
I don’t know what you mean by checking the profile, are you working on certifying an integration?
You can publish the profile by using the SmartThings CLI, here’s the command:
smartthings deviceprofiles:publish profileID
Remember that once you publish a profile, you won’t be able to modify it
Hi, @nayelyz
{
"name": "Event",
"attributes": {
"message": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 1025
}
},
"additionalProperties": false,
"required": [
"value"
]
}
},
"noticeType": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"enum": [
"OBJECT_DETECTED",
"OBJECT_DISAPPEARED",
"OBJECT_STILL_PRESENT",
"CAMERA_ONLINE",
"CAMERA_OFFLINE"
]
}
},
"additionalProperties": false,
"required": [
"value"
]
}
}
}
}
It was created as shapemusic09254.event
Added it to the Device Profile c2c-monitoreal-hub
I make a Device State Callback using a POST request to https://c2c-eu.smartthings.com/device/events with json:
{
"headers": {
"schema": "st-schema",
"version": "1.0",
"interactionType": "stateCallback",
"requestId": "abc-123-456791"
},
"authentication": {
"tokenType": "Bearer",
"token": "XXXXXXXX"
},
"deviceState": [
{
"externalDeviceId": "30CM49BBH3601214",
"states": [
{
"component": "main",
"capability": "shapemusic09254.event",
"attribute": "message",
"value": "Test message",
"timestamp": 1722977363
},
{
"component": "main",
"capability": "shapemusic09254.event",
"attribute": "noticeType",
"value": "OBJECT_DETECTED",
"timestamp": 1722977393
}
]
}
]
}
And I get an error:
{
"deviceState": [
{
"externalDeviceId": "30CM49BBH3601214",
"deviceError": [
{
"errorEnum": "BAD-REQUEST",
"detail": "states[0].capability: shapemusic09254.event is not a valid value."
},
{
"errorEnum": "BAD-REQUEST",
"detail": "states[1].capability: shapemusic09254.event is not a valid value."
}
]
}
],
"originatingInteractionType": "stateCallback"
}
I read on the forum that this error may be due to the device profile not being published.
The documentation https://developer.smartthings.com/docs/devices/cloud-connected/device-handler-types states the following:
Once your integration is ready for submission through the Developer Workspace, create a ticket containing all of the device profiles IDs used for your devices in your integration for our support team to review and publish.
That’s why I decided to publish the device profile via a support ticket.
I’ve already done this. But the error is the same.
What could be the problem with the Device State Callback request?
Thanks in advance for your reply.
Are you using the correct externalDeviceId
30CM49BBH3601214
? If you have more than one device discovered by your integration, you might be using one that doesn’t contain that capability on its profile.
In the meantime, I’ll try to use your profile to see if I get the same error.
I only return one device per discovery request with externalDeviceId 30CM49BBH3601214
I’ll wait for the result.
Hi, @olegin
I was able to use the profile and capability “shapemusic09254.event” successfully in the stateRefresh and stateCallback.
I looked at some recent logs using the external device ID (30CM49BBH3601214
) and I saw this error for the discovery interaction:
That URL is outdated but it refers to this doc: Device Handler Types Reference | Developer Documentation | SmartThings
Are you seeing this error as well? Make sure you’re responding correctly to the discovery interaction.
This is an example using the NodeJS Schema SDK:
.discoveryHandler((accessToken, response) => {
const d = response.addDevice('testEventCap', 'testEventCap', '4f9470cd-8f76-4af9-880f-87d87a633fee')
//Device manufacturer
d.manufacturerName('Nayely');
//Device model
d.modelName('testEventCap');
})
This is the log of that response:
{
"headers": {
"schema": "st-schema",
"version": "1.0",
"interactionType": "discoveryResponse",
"requestId": "2b6fec6e-d9e2-4916-9b15-78aaf115891f"
},
"devices": [
{
"externalDeviceId": "testEventCap",
"friendlyName": "testEventCap",
"deviceHandlerType": "4f9470cd-8f76-4af9-880f-87d87a633fee",
"manufacturerInfo": {
"manufacturerName": "Nayely",
"modelName": "testEventCap"
}
}
]
}
Update: I found the original discovery request and see you used the profile’s name instead of the profile ID. In this case, you’re using a custom device profile, so you cannot use its name as shown in the documentation of Device Handler Types. Those are pre-made profiles owned by SmartThings so they can be identified by their name.
Hi, @nayelyz
My mistake was that I used the Device profile name as the deviceHandlerType when I should have used the Device profile ID.
I didn’t find in the documentation that you can use the Device profile ID instead of the Device profile name
Now everything works great.
Thanks a lot!
Just as a reference, that’s specified in the section of Discovery interaction > Example of the response. I mean this point:
Thanks. I missed that.