C2C device integration - online/offline status for builtin device types does not seem to work

I am using st-schema-nodejs and use builtin device handler for few devices, eg., c2c-rgb-color-bulb
How to send online/offline status of this device to ST platform so that the same is seen on SmartThings App.

Hi, @prakash_m!

In Schema Connector, the healthCheck capability is still a requirement, so, you can use it in this process.
To control the health status on demand, you need to send device state callbacks as follows:

  1. To set it offline, you need to send a device error of type “DEVICE-OFFLINE”. For example:
const deviceState = [
    {
     externalDeviceId:"externalDeviceId",
     deviceError:[
       {
         errorEnum: "DEVICE-OFFLINE",
         detail: "Device offline"
       }
     ]
   }
 ]
const updateRequest = new StateUpdateRequest(ST_CLIENT_ID, ST_CLIENT_SECRET);
    updateRequest.updateState(accessTokens.callbackUrls, accessTokens.callbackAuthentication, deviceState)
.catch((error)=>{
    console.log("offline success ", error)
})
  1. To set it back online, you must send a callback with an online “healthStatus”. For example:
const deviceState = [
    {
      externalDeviceId: 'externalDeviceId',
      states: [
        {
          component: 'main',
          capability: 'st.healthCheck',
          attribute: 'healthStatus',
          value: 'online'
        }
      ]
    }
  ];
const updateRequest = new StateUpdateRequest(process.env.ST_CLIENT_ID, process.env.ST_CLIENT_SECRET);
updateRequest.updateState(accessTokens.callbackUrls, accessTokens.callbackAuthentication, deviceState)
.then((response)=>{
    console.log("update successful ", response)
})

Other errors also set the device offline but you must use the correct one because it can be seen in the platform logs that are useful for troubleshooting.

Please, let me know if you have any questions.