Getting Started: A Quick Tour
Before jumping into making your own IoT project on MODE from scratch, let’s try out a few core features of the MODE Developer Console and see how IoT devices work with mobile apps on the MODE platform.
Create a MODE Account
First, you need to go to the MODE Console and sign up. Once you have finished your email confirmation and logged in to the MODE console, you will find an auto-generated sample project. Click on the project to enter. Notice the project ID shown on screen:
Install the Sample App
In this walk-through, you will be using a sample mobile app called Lumos. It is a simple controller for a smart lighting system.
Enter the project ID of the sample project you saw earlier. On iOS, press the Done button. On Android, tap on the back arrow at the top left corner.
After setting the project ID, you will see the Lumos launch screen:
Sign up as a Lumos User
Lumos is now acting as the mobile UI to the sample project. To use it, you need to sign up as an end user. Simply tap Sign Up on the launch screen and enter your name and phone number. On iOS, tap Next at the top right corner. On Android, press the Create Account button.
You will receive a verification code via SMS shortly. After entering the verification code, tap Next on iOS, or press the Authenticate button on Android.
If verification succeeds, you will see a welcome screen.
Launch Device Simulator and Activate Claim Mode
You are now logged in to Lumos but there is no device you can control yet. Let’s grab the ownership of a virtual device to control from Lumos. To do that, you need to launch Device Simulator. Go back to the MODE console and click Devices in the menu on the left. Notice the entry that reads
smart_light in the DEVICE CLASSES panel.
smart_light entry to open the device class. In the DEVICES LIST panel, you will see that some device instances have been created already. Click on one of the entries to view its details:
Although the actual hardware for this device does not exists, you can use the Device Simulator to view incoming commands and simulate outgoing events. Click LAUNCH SIMULATOR to open simulator.
And a new browser window will open and load the simulator. Notice that there is a QR code shown on the simulator screen. This is the Claim Code. In order for this device to be usable, you have to “claim” ownership of this device. On the simulator, click CLAIM MODE to start the process:
You will see the message
Claim Mode expiring in ... You should finish the next step before the expiration. Otherwise, click CLAIM MODE again to start over.
Grab the Device Ownership
Back to the Lumos app, which should be showing the welcome screen. Tap Begin Set Up on iOS, or Set Up Devices on Android. You will be prompted to enter the claim code of the device you want to take control over:
Tap the QR button and scan the QR code shown on the Device Simulator screen with your phone camera:
If the scan succeeds, the Claim Code box will be filled in automatically. If you have trouble scanning the QR code, you can also enter the code manually with the keypad.
SmartLight to the Nickname box, then tap Finish. You will now see a list of Homes that you are member of. You should see one entry labeled
My Home, which was automatically created for you when you signed up:
The device you just claimed belongs to this home. Click the
My Home entry to see a list of devices that are contained within this home:
Now you are ready to interact with your device (i.e. the Device Simulator).
Send Commands from Lumos
You can send commands using the toggle switch next to the device shown in the device list on Lumos.
Meanwhile on the Device Simulator, the INCOMING: COMMANDS panel shows a log of commands sent from MODE to this device. Whenever you toggle the switch on Lumos you will see a new entry appended to the command log. This means the mobile app can successfully communicate with the Device Simulator via the MODE cloud.
Trigger Events from Device Simulator
On the other hand, the Device Simulator can simulate triggering events. In the OUTGOING: EVENTS panel, enter
click for Event Type. For Event Data, enter
1 for Name and Value respectively.
Click the TRIGGER EVENT button to send the event to MODE. On Lumos, you should see the device entry flashes briefly whenever you click TRIGGER EVENT. This means MODE has successfully routed the events from the Device Simulator to Lumos.
And that’s how a basic project on MODE looks like. During the walk-through, you were introduced to concepts such as Device Classes and Homes. In the next tutorial, we will explain all the key concepts you need to understand before starting your own project on MODE.