This section gives you a quick understanding of how to connect your device to WSO2 IoT Server and start using it. For this purpose, let's use the virtual fire alarm.
...
The following subsections explain how you can work with the virtual fire alarm:
Download WSO2 IoT Server
Insert excerpt |
---|
| Downloading the Product |
---|
| Downloading the Product |
---|
nopanel | true |
---|
|
...
Excerpt |
---|
Follow the instructions given below to start WSO2 IoTS, and sign into the IoTS device management console: Navigate to the WSO2 IoT pack plugins and run the plugins-deployer.xml . Example: Code Block |
---|
cd <IoT_HOME>/plugins
mvn clean install -f plugins-deployer.xml |
Start WSO2 IoT Server by starting the three profiles in the following order: Start the broker profile, which corresponds to the WSO2 Message Broker profile. Code Block |
---|
cd <IoTS_HOME>/broker/bin
./wso2server.sh |
The default port assigned for the broker is 9446. Start the core profile, which corresponds to the WSO2 Connected Device Management Framework (WSO2 CDMF) profile. Code Block |
---|
cd <IoTS_HOME>/core/bin
./wso2server.sh |
The default port assigned for the core is 9443. Start the analytics profile, which corresponds to the WSO2 Data Analytics Server profile. Code Block |
---|
cd <IoTS_HOME>/analytics/bin
./wso2server.sh |
The default port assigned for analytics is 9445.
Access the device management console by navigating to https://<HTTPS_HOST>:<HTTPS_PORT>/devicemgt . Example: https://localhost:9443/devicemgt Enter your username and password. If you are new to using WSO2 IoTS, you need to first register with IoTS before you can to log into the WSO2 IoTS device management console. Expand |
---|
title | Click here for more information on registering with WSO2 IoTS. |
---|
| Panel |
---|
borderColor | #6A98FA |
---|
bgColor | #ffffff |
---|
borderWidth | 1 |
---|
| Follow the instructions given below to register with WSO2 IoT: - Click Create an account.
Fill out the registration form.
- First Name: Provide your first name.
- Last Name: Provide your last name.
- Username: Provide a username. It should be at least 3 characters long with no white spaces.
- Email: Provide a valid email address.
- Password: Provide a password. It should be at least 8 characters long.
- Confirm Password: Provide the password again to confirm it.
- Click Register.
|
|
Click LOGIN.
|
...
Enroll the
...
device
Follow the steps given below to start enroll the virtual fire alarm device:
- Click Enroll New Device.
- Click Try to try out the Virtual Firealarm.
- Download the device:
- Click Download Agent to download the device agent.
Enter a preferred name for your device (e.g., "FireAlarm"), select the simple or advanced agent option, and click DOWNLOAD NOW.
Tip |
---|
Tip: Avoid using spaces or other characters for the device name. |
Start the virtual fire alarm
Follow the steps given below to start the virtual fire alarm device.
Localtabgroup |
---|
Localtab |
---|
active | true |
---|
id | simpleagent |
---|
title | Simple Agent |
---|
| Follow the steps below to start the Simple Agentsimple agent fire alarm. Navigate to the location of the unzipped device agent file on your terminal. Example: Navigate to the device agent file, which is in the <IOTS_HOME>/device_agents/virtual_firealarm directory. Code Block |
---|
cd <IOTS_HOME>/device_agents/virtual_firealarm |
Start the virtual fire alarm. Code Block |
---|
sh start-device.sh |
Once you start your virtual fire alarm, the fire alarm emulator will pop up.
Anchor |
---|
| simple_agent_tryout |
---|
| simple_agent_tryout |
---|
| Try out the virtual fire alarmOnce you start your virtual fire alarm, you can try out the following actions: |
Localtab |
---|
id | advancedagent |
---|
title | Advanced Agent |
---|
| Follow the steps below to define a policy for the fire alarm device and start the Advanced Agentadvanced agent fire alarm. Click the menu icon , and click Policy Management. Click Add New Policy and select the Virtual Fire Alarm platform. Configure a policy using the Siddhi Query Language and click Continue. The following is an example of a policy you can use for the Fire Alarm device. See Adding a Policy for more information on how to add your own policy. Code Block |
---|
define stream fireAlarmEventStream (temp int);
from fireAlarmEventStream#window.time(30 sec)
select max(temp) as maxValue
insert into analyzeStream for expired-events;
from analyzeStream[maxValue < 50]
select maxValue
insert into bulbOnStream;
from fireAlarmEventStream[temp > 50]
select temp
insert into bulbOffStream; |
- Assign the policy to user roles or users and select an action to be triggered upon non-compliance.
For example, you can assign the policy to the admin user role and select Enforce as the action upon non-compliance. For more information, see Adding a Policy.
- Enter a name and description for the policy and click Publish.
When you start the fire alarm device, this policy will be assigned to the device. Navigate to the location of the unzipped device agent file on your terminal. Example: Navigate to the device agent file, which is in the <IOTS_HOME>/device_agents/virtual_firealarm directory.
Code Block |
---|
cd <IOTS_HOME>/device_agents/virtual_firealarm |
Start the virtual fire alarm. Code Block |
---|
sh start-device.sh |
Once you start your virtual fire alarm, the fire alarm emulator will pop up.
Anchor |
---|
| advanced_agent_tryout |
---|
| advanced_agent_tryout |
---|
| Try out the virtual fire alarmOnce you start your virtual fire alarm, you can try out the following actions: Action | Description |
---|
View device details | Click the menu icon , and click Device Management. Select the virtual fire alarm device you created from your devices, and view the device details, carry out operations, and monitor real-time data.
|
---|
Ring the fire alarm | - On the emulator, enter a temperature lower than 50°. The buzzer will start ringing.
- Enter a temperature higher than 50° to stop the ringing.
Note that the buzzer now works according to the policy you defined above. |
---|
|
|
View real-time and historical data
When you adjust the temperature and humidity values in the virtual fire alarm emulator you can see the data in real-time or view historical data by following the steps given below:
...