Creating the device events

Normally when a device state changes, either because of an Automation or by interaction with the mobile app, device events are created by SmartThings Cloud, and are reflected on the user’s mobile app.

However, when the device is actuated manually, or is actuated by an app outside of the SmartThings platform, then the SmartThings Connector must explicitly create the device events corresponding to this device state change.

This sequence will be initiated by the device cloud, informing the SmartThings Connector that the device state has changed.

NOTE

How the SmartThings Connector is notified of a change in the device state, can be handled either by the device cloud notifying the SmartThings Connector, or by the SmartThings Connector polling the device cloud at regular intervals.

Upon being notified by the device cloud that the device state has changed, the SmartThings Connector must issue a POST request into SmartThings Cloud to create a corresponding device event.

See the picture below:

Create event for device change

Here is an example of a POST request body to create a device event.

{
 	"stateEvents": [
   	{
      "component": "main",
      "capability": "switchLevel",
      "attribute": "level",
      "value": 0,
      "unit": null
   	}
 	]
}
[
	{}
]