Create device events

A device can undergo a state change, initiated by an Automation or by user interaction with the SmartThings app. Device events are then created by SmartThings Cloud, and are reflected on the SmartThings app.

However, when the device is actuated manually, or by a third-party application, the SmartApp Connector must explicitly create the device events corresponding to this device state change.

To inform the SmartApp Connector that the device state has changed, the device cloud can either notify the SmartApp Connector, or the SmartApp Connector can poll the device cloud at regular intervals.

The SmartApp Connector must then issue a POST request into SmartThings Cloud to create a corresponding device event.

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