Device plugin simulator
The simulator shows how the IoT device plugin would look within the SmartThings app, so that you can test the interaction between the device plugin in SmartThings and the device itself.
The simulator displays in a browser popup window, so you need to set up the browser to allow popups.
- In your Chrome browser, allow popups from localhost:5680:
- Select Settings > Advanced > Privacy and security > Content Settings > Popups > Allow > Add.
- Enter localhost:5680.
- Go to your project and use the following command.
st build project st install app --simulator st launch simulator
Next, launch the virtual device to test the interaction between the device plugin simulator and the device.
Test the Main State
You cannot simply change the value of the main state of a card with the device plugin simulator. You must also change the attribute value of the virtual device to change the value of the main state.
In this example, we will change the current temperature from the virtual device. Change the temperature value of:
/temperature/current/0from 20 to 16
In the device plugin simulator, confirm that the values of the main states of the device plugin are changed.
Test the Main Action
You can change the value of the main action of a card using both the device plugin simulator and the virtual device.
In the device plugin simulator, click the Main Action. This changes the power state from On to Off. You can confirm that the states of both the card and virtual device are changed.
In the virtual device, change the power value of
/power/vs/0 from Off to On and confirm that the states of both the card and virtual device have changed.
Test from the virtual device
You can change a plugin value through both the simulator as well as the virtual device. The example in this section shows how to change a value from the virtual device.
In this example, change the value of fan speed from the virtual device.
Change the fan speed value of
/fanSpeed/ from sleep to fast and confirm that the value of fan speed in the device plugin simulator has changed.