Not receiving stateRefreshRequest

I have a webhook endpoint setup as a cloud connector. After auth the system receives a discoveryRequest and sends devices on the response but smartthings is not sending the stateRefreshRequest.
I am not getting a interactionResult so i guess the response for discovery should be fine. When I check on the smartthing app it shows checking… under the device. Is there something that I am missing.

Thank you

Hello, @Rustam_Niraula

I have faced that same issue before. Can you please share your discoveryResponse?

@andresg
Here is the discoveryResponse

{
    "headers": {
        "schema": "st-schema",
        "version": "1.0",
        "interactionType": "discoveryResponse",
        "requestId": "f96011d5-0fac-4ea9-8116-826f59f77d6c"
    },
    "devices": [
        {
            "externalDeviceId": "f70eec73-7a28-426b-9c1c-6f6226f233ed",
            "deviceCookie": {
                "deviceType": "LIGHT"
            },
            "friendlyName": "Dell",
            "manufacturerInfo": {
                "manufacturerName": "SkyPlug",
                "modelName": "SkyPlug"
            },
            "deviceContext": {
                "roomName": "Sky",
                "groups": [
                    "LIGHT"
                ]
            },
            "deviceHandlerType": "c2c-dimmer",
            "deviceUniqueId": "f70eec73-7a28-426b-9c1c-6f6226f233ed"
        },
        {
            "externalDeviceId": "fef60523-a435-44e3-b92a-8aeb5c192aaa",
            "deviceCookie": {
                "deviceType": "FAN"
            },
            "friendlyName": "Mac",
            "manufacturerInfo": {
                "manufacturerName": "SkyPlug",
                "modelName": "SkyPlug"
            },
            "deviceContext": {
                "roomName": "Sky",
                "groups": [
                    "FAN"
                ]
            },
            "deviceHandlerType": "c2c-fan-controller-4speed",
            "deviceUniqueId": "fef60523-a435-44e3-b92a-8aeb5c192aaa"
        }
    ],
    "requestGrantCallbackAccess": false
}

Hi, @Rustam_Niraula

Regarding the issue about the device that always shows in Checking…, it will get fixed whenever the device changes the state for the first time.

Regarding the other issue, I’ve been trying to replicate it but couldn’t make it. I always recieve the stateRefreshRequest. Make sure your connector is handling the stateRefreshRequest properly, and if you’re using the st-schema-nodejs SDK you can configure it as follows:

.stateRefreshHandler((accessToken, response) => {
    for (device of devices) {
      response.addDevice(device.externalDeviceId, device.states);
    }
  })

Can you share your implementation?

Hi @andresg
I have a webhook endpoint in java which handles the request sent by smartthings.

switch (interactionType) {
    case discoveryRequest:
        // handle discovery
    case stateRefreshRequest:
         // handle state refresh
    case integrationDeleted:
        // handle unlink
    case commandRequest:
        // handle command
    case grantCallbackAccess:
        // handle grant callback
}

I am receiving other requests but couldn’t get the stateRefreshRequest. I even configured a different project for testing and production but couldn’t receive stateRefreshRequest on both of them.