The device status update does not take effect. Device registration is successful and I get all the Tokens and callbacks I need. By responding the “stateRefreshRequest”, I get the values of the device’s sensors added to the SmartApp. When I try to update (State refresh) the data, nothing happens. I don’t even get an respond data.
If I have made mistakes in the device registration, I have always received the respond that something is wrong. When I use this callback (https://c2c-us.smartthings.com/oauth/token). StateCallback doesn’t answer anything. What am I doing wrong here?
I send the following data with the POST command.
URL = stateCallback = https://c2c-us.smartthings.com/device/events
Data = body: {
headers: {
schema: "st-schema",
version: "1.0",
interactionType: "stateCallback",
requestId: "abc-123-4567",
},
authentication: {
tokenType: "Bearer",
token: tokenObj.authToken,
},
deviceState: [
{
externalDeviceId: deviceId,
states: deviceData,
},
],
}
deviceData = [
{
"component": "main",
"capability": "st.equivalentCarbonDioxideMeasurement",
"attribute": "equivalentCarbonDioxideMeasurement",
"value": 200,
"unit": "ppm"
},
{
"component": "main",
"capability": "st.airQualitySensor",
"attribute": "airQuality",
"value": 10,
"unit": "CAQI"
},
{
"component": "main",
"capability": "st.temperatureMeasurement",
"attribute": "temperature",
"value": 22,
"unit": "C"
},
{
"component": "main",
"capability": "st.relativeHumidityMeasurement",
"attribute": "humidity",
"value": 30,
"unit": "%"
},
{
"component": "main",
"capability": "st.fineDustSensor",
"attribute": "fineDustLevel",
"value": 400,
"unit": "μg/m^3"
},
{
"component": "main",
"capability": "st.tvocMeasurement",
"attribute": "tvocLevel",
"value": 300,
"unit": "ppm"
},
{
"component": "main",
"capability": "st.battery",
"attribute": "battery",
"value": 40,
"unit": "%"
}
]