Switch Device is suddenly shown offline even when stateRefreshResponse sends a value of "ON"

Hello,

I am developing a Schema app where I can now see my switch on SmartThings App in “My Testing Devices”. It was showing proper status and I could send ON/OFF command to my device.

Suddenly, one say it went offline with same stateRefreshResponse. And now I cannot get it online even though my stateRefreshResponse returns “ON”.

Please find request/response for reference. Will you please help me find the root cause?

Request:

{
“headers”: {
“schema”: “st-schema”,
“version”: “1.0”,
“interactionType”: “stateRefreshRequest”,
“requestId”: “68D68B13-D81B-4C9F-A2A3-76495A9CCA92”
},
“authentication”: {
“tokenType”: “Bearer”,
“token”: “abc”
},
“devices”: [
{
“externalDeviceId”: “e4b4af25-0dba-4255-a772-aded2d8027c0”,
“deviceCookie”: {}
}
]
}

Response

{
“headers”: {
“interactionType”: “stateRefreshResponse”,
“version”: “1.0”,
“schema”: “st-schema”,
“requestId”: “68D68B13-D81B-4C9F-A2A3-76495A9CCA92”
},
“deviceState”: [
{
“states”: [
{
“attribute”: “switch”,
“component”: “main”,
“capability”: “st.switch”,
“value”: “on”
}
],
“externalDeviceId”: “e4b4af25-0dba-4255-a772-aded2d8027c0”
}
]
}

I’ve never played with the schema apps myself but I have noticed in passing that a big deal is made of always sending the st.healthCheck capability with device states to indicate online or offline status. The developer documentation makes a point of highlighting this, even though the warning seems to be preceded by an example that doesn’t do it.

I’ll tag this for @nayelyz for a more informed response later in the day.

Hi, @Divya_Nagarajan
@orangebucket is right, you need to include the st.healthCheck capability to make it online again, otherwise, it stays the same.
This capability is mandatory in C2C integrations, so a StateCallback and a StateRefresh status should include it as follows:

{
  component: 'main',
  capability: 'st.healthCheck',
  attribute: 'healthStatus',
  value: "online"
}

Thanks for the tag, @orangebucket. I’ll check the example you mentioned.

@nayelyz @orangebucket Thanks a lot! It worked like a charm.