RAK7289V2/RAK7289CV2 WisGate Edge Pro V2 LoRaWAN Network Server Guide
This manual provides you with operation guidance for connecting the gateway to different LoRaWAN network servers.
Built-In Network Server
This section is an example demonstration on how to interconnect your RAK commercial gateway with its built-in LoRa network server and make an application for the node.
Requirements
- Your node module (In this section, RAK3172 will be used as an example module)
- Your RAK gateway is connected to the Internet
Set the Gateway Work Mode
- Configure Work mode to Built-in network server. Navigate to LoRa > Configuration. For Work mode, select Built-in network server.
Figure 1: Set the gateway work mode- Select the log level and frequency band.
Figure 1: Configure log level and frequency bandYou can expand the View detailed regional parameters of the frequency plan option to configure detailed regional parameters.
Create an Application
- Navigate to LoRa > Applications tab.
- Click the Add application button or the add one now link to add a new application.
Figure 1: Add an application- After the page jumps, configure the following information.
Figure 1: Set parameters-
Application name: Name of the application
-
Application description: Description of the application, optional
-
Application Type
- Unified Application key: All devices will use the same application key. Selecting this option, then the application key field will pop up, where you can type in an application key or click the Autogenerate button to generate a key. This value needs to be consistent with the value from the end device, so either obtain it by querying the end device, or auto-generate it and synchronously change the corresponding value of the device.
Figure 1: Configure unified application keyAfter enabling the Auto Add Device option, you need to configure the Application EUI option. This value needs to be consistent with the value from the end device, so either obtain it by querying the end device, or auto-generate it and synchronously change the corresponding value of the device. After the application EUI and key verification, the device will be automatically added to the application.
Figure 1: Enable auto add device- Separate Application keys: Each device has its own application key. Add the key when registering the device.
- Click Save Application to add the new application.
Add End Devices
- Navigate to LoRa > Applications tab.
Figure 1: Application list- In the application list, click the newly created application and choose the End devices tab.
If you have enabled Auto Add Device, the device will be automatically registered with the adding request. Otherwise, you need to refer to the next step.
Figure 1: Device list- Click the Add end device button.
- In the End device information interface, enter the following information.
Figure 1: Add new device- Activation Mode: OTAA or ABP. This value needs to be consistent with the value from the end device. The ABP mode will pop up two additional fields, Application Session Key and Network Session Key.
- End device (group) name: Name of the end device (group).
- End device description (optional): A description of the end device, optional.
- Class: This value needs to be consistent with the value from the end device.
- Frame Counter Width: Keep the default value.
- Click Add end devices to enter the device adding page.
- In the Adding end devices interface, enter the device EUI in the End Device EUI (main) field and click the Add to End Devices list button.
Figure 1: Add new device to End Devices list- The device EUI needs to be consistent with the end device EUI.
- If the EUI is correct, the device will appear in the “End devices list”.
- If the EUI is duplicate, the device will be displayed in the “End devices with an error”.
- Click Add end devices to add the device to the application. Execute join request on the node side.
Figure 1: Device onlineBy following the steps in the previous sections, you should now have your device registered. If you click on the Device EUI, you will go to the corresponding Configuration tab. Click the Packet capture button. Here you can monitor the data that the application is exchanging in real time.
Figure 1: End Device Packet CaptureAWS IoT Core for LoRaWAN
Execute the following steps to set up your AWS account and permissions:
Set up Roles and Policies in IAM
Add an IAM Role for CUPS Server
Adding an IAM role will allow the Configuration and Update Server (CUPS) to handle the wireless gateway credentials.
This procedure needs to be done only once, but must be performed before a LoRaWAN gateway tries to connect with AWS IoT Core for LoRaWAN.
-
Go to the IAM Roles page on the IAM console.
-
Choose Create role.
-
On the Create Role page, choose AWS account > Another AWS account.
-
Enter your Account ID, then select Next.
-
In the search box next to the filter policies, type AWSIoTWirelessGatewayCertManager.
-
If the search results show the policy named AWSIoTWirelessGatewayCertManager, select it by clicking the checkbox.
-
If the policy does not exist, create one.
- Go to the IAM Policies page. Choose Create Policy, then select the JSON tab to open the policy editor.
- Replace the existing template with a trust policy document.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "IoTWirelessGatewayCertManager",
"Effect": "Allow",
"Action": [
"iot:CreateKeysAndCertificate",
"iot:DescribeCertificate",
"iot:ListCertificates",
"iot:RegisterCertificate"
],
"Resource": "*"
}
]
}- Click Next.
- On the Review and create page. For the Name, type AWSIoTWirelessGatewayCertManager.
NOTEYou must enter the name as AWSIoTWirelessGatewayCertManager and must not use a different name. This is for consistency with future releases.
- For the Description, enter a description of your choice.
- Then choose Create policy. You will see a confirmation message showing the policy has been created.
-
-
Click Next.
-
In Role name, enter IoTWirelessGatewayCertManagerRole, and then choose to Create role.
You must not use a different name. This is for consistency with future releases.
- In the confirmation message, choose IoTWirelessGatewayCertManagerRole to edit the new role.
- In the Summary, choose the Trust relationships tab, and then choose Edit trust relationship.
- In the Policy Document, change the Principal property to represent the IoT Wireless service:
"Principal": {
"Service": "iotwireless.amazonaws.com"
},
- After changing the Principal property, the complete policy document should look like the following:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "iotwireless.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {}
}
]
}
- Choose Update Trust Policy to save your changes and exit. At this point, you have created the IoTWirelessGatewayCertManagerRole and you won't need to do this again.
The examples in this document are intended only for dev environments. All devices in your fleet must have credentials with privileges that authorize only intended actions on specific resources. The specific permission policies can vary for your use case. Identify the permission policies that best meet your business and security requirements. For more information, refer to Example Policies and Security Best Practices
Add IAM Role for Destination to AWS IoT Core for LoRaWAN
Creating a PolicyCreating a policy gives the role permissions to describe the IoT endpoint and publish messages to AWS IoT.
- Go to the IAM console.
- Choose Policies from the navigation pane.
- Choose Create Policy, then choose the JSON tab to open the policy editor. Replace the existing template with this trust policy document:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action":
[
"iot:DescribeEndpoint",
"iot:Publish"
],
"Resource": "*"
}
]
}
- Click Next.
- On the Review and create page. For the Name, enter a name of your choice.
- For Description, enter a description of your choice.
- Choose Create policy. You will see a confirmation message indicating that the policy has been created.
- In the IAM console, choose Roles from the navigation pane to open the Roles page.
- Choose Create Role.
- On the Create Role page, choose AWS account > Another AWS account.
- Enter your Account ID, then select Next.
- Search for the IAM policy you just created by entering the policy name in the search bar.
- In the search results, select the checkbox corresponding to the policy.
- Click Next.
- For Role name, enter an appropriate name of your choice.
- For Description, enter a description of your choice.
- Choose Create role. You will see a confirmation message indicating that your role has been created.
Update your role's trust relationship to grant AWS IoT Core for LoRaWAN permission to assume this IAM role when delivering messages from devices to your account.
- In the IAM console, choose Roles from the navigation pane to open the Roles page.
- Enter the name of the role you created earlier in the search window, and click on the role name in the search results. This opens up the Summary page.
- Choose the Trust relationships tab to navigate to the Trust relationships page.
- Click Edit trust policy. The principal AWS role in your trust policy document defaults to root and must be changed. Replace the existing policy with this:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "iotwireless.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {}
}
]
}
- Choose Update Policy.
Add the Gateway to AWS IoT
Requirements
To complete setting up your gateway, you need the following:
- LoRaWAN region. For example, if the gateway is deployed in a US region, the gateway must support LoRaWAN region US915.
- Gateway LNS-protocols. Currently, the LoRa Basics Station protocol is supported.
- Gateway ID (GatewayEUI) or serial number. This is used to establish the connection between the LNS and the gateway. Consult the documentation for your gateway to locate this value.
- Add minimum software versions required, including Basics Station 2.0.5.
Add the LoRaWAN Gateway
To register the gateway with AWS IoT Core for LoRaWAN, execute these steps:
- Go to the AWS IoT console.
- Select LPWAN devices in the navigation panel on the left.
- Choose Gateways, and then click Add gateway.
- In the Add gateway section, fill in the Gateway's EUI and Frequency band (RF Region) fields.
- Enter a descriptive name in the Name: optional field. It is recommended that you use the GatewayEUI as the name.
- Click Add gateway.
- On the Configure your gateway page, find the section titled Gateway certificate.
- Select Create certificate.
- Once the Certificate created and associated with your gateway message is shown, select Download certificate files to download the certificate (xxxxx.cert.pem) and private key (xxxxxx.private.key).
- In the section Provisioning credentials, choose Download server trust certificates to download the CUPS (cups.trust) and LNS (lns.trust) server trust certificates.
- Copy the CUPS and LNS endpoints and save them in a
.txtfile for use while configuring the gateway. - Choose Submit to add the gateway.
Set Up the Gateway
- Using your preferred Web browser, access the gateway. To access the gateway, see the Quick Start Guide.
Figure 1: Web User Interface Log-in- Configure Network Mode to Basics Station. Navigate to LoRa.
- For Work mode, select Basics station and click Configure Basics Station server setup to expand the Basics Station settings.
Figure 1: Basics Station Work Mode- Select LNS Server from Server, then choose TLS Server and Client Authentication from Authentication Mode.
Figure 1: Configuring Network Mode to Basics Station- Configure URI, Port, and Authentication Mode.
Figure 1: Configuring URI, Port, and Authentication Mode- Click Save. Check if the gateway is online in AWS IoT console.
Figure 1: Verifying OperationAdd a LoRaWAN Device to AWS IoT
In this section we use RAK3172 as an example device.
Requirements
- Locate and note the following specifications about your endpoint device.
- LoRaWAN Region: This must match the gateway LoRaWAN region.
- MAC Version: This must be one of the following:
- V1.0.2
- v1.0.3
- v1.0.4
- v1.1
- OTAA v1.0.x and OTAA v1.1 are supported.
- ABP v1.0.x and ABP v1.1 are supported.
- Locate and note the following information from your device manufacturer:
- For OTAA v1.0x devices: DevEUI, AppKey, AppEUI
- For OTAA v1.1 devices: DevEUI, AppKey, NwkKey, JoinEUI
- For ABP v1.0x devices: DevEUI, DevAddr, NwkSkey, AppSkey
- For ABP v1.1 devices: DevEUI, DevAddr, NwkSEnckey, FNwkSIntKey, SNwkSIntKey, AppSKey
Verify Profiles
AWS IoT Core for LoRaWAN supports device profiles and service profiles. Device profiles contain the communication and protocol parameter values the device needs to communicate with the network server. Service profiles describe the communication parameters the device needs to communicate with the application server.
Some pre-defined profiles are available for device and service profiles. Before proceeding, verify that these profile settings match the devices you will be setting up to work with AWS IoT Core for LoRaWAN.
- Navigate to the AWS IoT console. In the navigation pane, choose LPWAN devices, then click Profiles.
- In the Device Profiles section, there are some pre-defined profiles listed.
- Check each of the profiles to determine if one of them will work for you. If not, select Add device profile and set up the parameters as needed. For US915 as an example:
Figure 1: Adding the Device Profile-
Click Add device profile once you have set a device profile that will work for you.
-
In the Service Profiles section, click Add service profile and set up the parameters as needed. As an example, the default service profile parameters are shown below. However, only the AddGwMetadata setting can be changed at this time.
Figure 1: Adding the Service Profile- Proceed only if you have a device and service profile that will work for you.
Set Up a Destination for Device Traffic
Because most LoRaWAN devices don't send data to AWS IoT Core for LoRaWAN in a format that can be consumed by AWS services, traffic must first be sent to a Destination. A Destination represents the AWS IoT rule that processes a device's data for use by AWS services. This AWS IoT rule contains the SQL statement that selects the device's data and the topic rule actions that send the result of the SQL statement to the services that will use it.
For more information on Destinations, refer to the AWS LoRaWAN Developer Guide.
A destination consists of a Rule and a Role. To set up the destination, execute the following steps:
- Navigate to the AWS IoT console. In the navigation pane, choose LPWAN devices, and then Destinations.
- Choose Add Destination.
- For the Destination name, enter ProcessLoRa, and then add an appropriate description under Destination description – optional.
The Destination name can be anything. For getting started and consistency, choose ProcessLoRa for the first integration with AWS IoT Core for LoRaWAN.
- For Rule name, enter LoRaWANRouting. Ignore the section Rules configuration – Optional for now. The Rule will be set up later in the "Hello World" sample application. See Create the IoT Rule for the destination.
- In the Permissions section, choose Select an existing service role and select the IAM role you had created earlier, from the drop-down.
Figure 1: Adding Destination- Choose Add Destination. You will see a message Destination added, indicating the destination has been successfully added.
Register the Device
Now, register an endpoint device with AWS IoT Core for LoRaWAN as follows. Before adding a device to AWS IoT, retrieve the DevEUI, AppEUI, and AppKey from the end Device's console. The RAK3172 device used in this example needs to query device information through AT commands.
- Go to the AWS IoT console.
- Select LPWAN devices in the navigation panel on the left.
- Select Devices, then choose Add wireless device.
- On the Add device page, select the LoRaWAN specification version in the drop-down under Wireless device specification.
- Enter the DevEUI.
- Enter the remaining fields as per the OTAA/ABP choice you made above.
- Enter a name for your device in the Wireless device name – optional field.
- In the Profiles section, under Wireless device profile, from the drop-down option find the device profile you have created or the one that corresponds to your device and region.
Compare your device details to ensure the device profile is correct. If there are no valid default options, you will have to create a new profile. See the Verify Profiles section.
- Choose the destination you created earlier (ProcessLoRa) from the drop-down under Choose destination.
Figure 1: LoRaWAN specifications and wireless device configuration- Click Next.
- Choose Add device. You will see a message saying "Wireless device added", indicating that your device has been set up successfully.
- Restart the end device, and it should join the AWS IoT LoRaWAN server.
Figure 1: Joined DeviceVerifying Operation
Once setup is completed, provisioned OTAA devices can join the network and start to send messages. Messages from devices can then be received by AWS IoT Core for LoRaWAN and forwarded to the IoT Rules Engine.
Instructions for a sample Hello World application are given below, assuming that the device has joined and is capable of sending uplink traffic.
Figure 1: Sending Uplink ArchitectureCreate a Lambda Function for Destination Rule
Create the lambda function to process device messages processed by the destination rule.
- Go to the AWS Lambda console.
- Select Functions in the navigation pane.
- Choose Create function.
- Select Author from scratch.
- Under Basic Information, enter the function name and choose Runtime Python 3.8. from the drop-down under Runtime.
- Click Create function.
- Under Function code, paste the copied code into the editor under the lambda_function.py tab.
Click to view the code
import base64
import json
import logging
import ctypes
import boto3
# define function name
FUNCTION_NAME = 'RAK-HelloWorld'
# Second Byte in Payload represents Data Types
# Low Power Payload Reference: https://developers.mydevices.com/cayenne/docs/lora/
DATA_TYPES = 1
# Type Temperature
TYPE_TEMP = 0x67
# setup iot-data client for boto3
client = boto3.client('iot-data')
# setup logger
logger = logging.getLogger(FUNCTION_NAME)
logger.setLevel(logging.INFO)
def decode(event):
data_base64 = event.get('PayloadData')
data_decoded = base64.b64decode(data_base64)
result = {
'devEui': event.get('WirelessMetadata').get('LoRaWAN')
.get('DevEui'),
'fPort': event.get('WirelessMetadata').get('LoRaWAN')
.get('FPort'),
'freq': event.get('WirelessMetadata').get('LoRaWAN')
.get('Frequency'),
'timestamp': event.get('WirelessMetadata').get('LoRaWAN')
.get('Timestamp'),
}
if data_decoded[DATA_TYPES] == TYPE_TEMP:
temp = data_decoded[DATA_TYPES + 1] << 8 \
| data_decoded[DATA_TYPES + 2]
temp = ctypes.c_int16(temp).value
result['temperature'] = temp / 10
return result
def lambda_handler(event, context):
data = decode(event)
logger.info('Data: %s' % json.dumps(data))
response = client.publish(topic=event.get('WirelessMetadata')
.get('LoRaWAN').get('DevEui')
+ '/project/sensor/decoded', qos=0,
payload=json.dumps(data))
return response
- Once the code has been pasted, choose Deploy to deploy the lambda code.
- Click the Configuration tab of the lambda function and select Permissions.
- Change the Lambda Role Policy permission.
- Under Execution role, click the hyperlink under Role name.
- On the Permissions tab, find the policy name and select it.
- Choose Edit policy, and choose the JSON tab.
- Append the following to the Statement section of the policy to allow publishing to AWS IoT.
{
"Effect":"Allow",
"Action":[
"iot:Publish"
],
"Resource":[
"*"
]
}
- After the change, the code should look like this:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect":"Allow",
"Action":[
"iot:Publish"
],
"Resource":[
"*"
]
}
]
}
- Choose Review Policy, then Save changes.
- Go back to the Lambda function Code source and create a test event that will allow you to test the functionality of the lambda function.
-
Click Test next to Deploy.
-
In the Configure test event, enter a name for the test event in the Event name field.
-
Paste the following sample payload in the area under Event JSON field:
NOTEThe device information in the following code must be consistent with the device information you are using.
{
"WirelessDeviceId": "65d128ab-90dd-4668-9556-fe47c589610b",
"PayloadData": "AWf/1w==",
"WirelessMetadata": {
"LoRaWAN": {
"DataRate": "4",
"DevEui": "0000000000000088",
"FPort": 1,
"Frequency": "868100000",
"Gateways": [
{
"GatewayEui": "80029cffXXXXXXXX",
"Rssi": -109,
"Snr": 5
}
],
"Timestamp": "2021-02-08T04:00:40Z"
}
}
}
- Choose Save to save the event.
- In a new window, navigate to the AWS IoT console, choose Test on the navigation pane, and select MQTT test client.
- In Subscription topic field type # (all topics) and click Subscribe to topic. The MQTT will subscribe to all topics.
- Click on Test in the Lambda function page to generate the test event you just created.
- Verify the published data in the AWS IoT Core MQTT Test client. The output should look similar to this:
000000000000000088/project/sensor/decoded February 09, 2021, 14:45:29 (UTC+0800)
{
"devEui": "000000000000000088",
"fPort": 1,
"freq": "868100000",
"timestamp": "2021-02-08T04:00:40Z",
"temperature": -4.1
}
Create the Destination Rule
In this section, create the IoT rule that forwards the device payload to your application. This rule is associated with the destination created earlier in Set up a Destination for Device Traffic section.
- Navigate to the AWS IoT console
- In the navigation pane, choose Act, then select Rules.
- On the Rules page, choose Create rule.
- On the Create a rule page, enter as follows:
-
Name: LoRaWANRouting
-
Description: Any description of your choice.
NOTEThe Name of your Rule is the information needed when you provision devices to run on AWS IoT Core for LoRaWAN.
-
- Leave the default Rule query statement:
SELECT * FROM 'iot/topic'unchanged. This query has no effect at this time, as traffic is currently forwarded to the rules engine based on the destination. - Under Set one or more actions, click Add action.
- On the Select an action page, select Republish a message to an AWS IoT topic. Scroll down and choose Configure action.
- On the Configure action page, for Topic, enter project/sensor/decoded. The AWS IoT Rules Engine will forward messages to this topic.
- Under Choose or create a role to grant AWS IoT access to perform this action, click on Create Role.
- For Name, enter a name of your choice.
- Select Create role to complete the role creation. You will see a "Policy Attached" tag next to the role name, indicating that the Rules Engine has been permitted to execute the action.
- Choose Add action.
- Add one more action to invoke the Lambda function. Under Set one or more actions, click Add action.
- Select Send a message to a Lambda function.
- Choose Configure action.
- Click the Lambda function created earlier and choose Add action.
- Then select Create rule.
- A "Success" message will be displayed at the top of the panel, and the destination has a rule bound to it.
You can now check that the decoded data is received and republished by AWS by triggering a condition or event on the device itself.
- Go to the AWS IoT console. In the navigation pane, select Test, and choose MQTT client.
- Subscribe to the wildcard topic '#' to receive messages from all topics.
- Send message from endDevice using AT command
- You should see traffic similar to that shown below.
393331375d387505/project/sensor/decoded February 09, 2021, 14:47:21 (UTC+0800)
{
"devEui": "393331375d387505",
"fPort": 1,
"freq": "867100000",
"timestamp": "2021-02-09T06:47:20Z",
"temperature": 27.2
}
project/sensor/decoded February 09, 2021, 14:47:21 (UTC+0800)
{
"WirelessDeviceID": "3eff83dd-9159-XXXX-XXXX-XXXXXXXXXXXX",
"PayloadData": "AWcBEA==",
"WirelessMetadata": {
"LoRaWAN": {
"DataRate": "4",
"DevEui": "3933XXXXXXXXXXXX ",
"FPort": 1,
"Frequency": "867100000",
"Gateways": [
{
"GatewayEui": "ac1ff09ffXXXXXXXX",
"Rssi": -103,
"Snr": 8.5
}
],
"Timestamp": "2021-02-09T06:47:20Z"
}
}
}
Configuring Amazon SNS
You will be using the Amazon Simple Notification Service to send text messages (SMS) when certain conditions are met.
- Go to the Amazon SNS console.
- Select Text Messaging (SMS) and choose Publish text message.
- Under Message type, select Promotional.
- Enter your phone number (phone number that will receive text alerts).
- Enter "Test message" for the Message and choose Publish message.
- If the phone number you entered is valid, you will receive a text message and your phone number will be confirmed.
- Create an Amazon SNS Topic as follows:
- In the navigation pane, choose Topics.
- Select Create topic.
- Under Type, select Standard.
- Enter a name of your choice. Here, you will use "text_topic".
- Select Create topic.
- Create a subscription for this topic:
- On the newly created text_topic page, choose the Subscriptions tab.
- Choose Create subscription.
- In Topic ARN, choose the topic you have created earlier.
- Select Protocol as SMS from the drop-down.
- Under Endpoint, enter the previously validated phone number to receive the SMS alerts.
- Choose Create subscription. You should see a Subscription to text_topic created successfully message.
Add a Rule for Amazon SNS Notification
Now, add a new rule to send an Amazon SNS notification when certain conditions are met in a decoded message.
- Navigate to the AWS IoT console.
- In the navigation pane, choose Act. Then, choose Rules.
- On the Rules page, choose Create.
- Enter the Name as "text_alert" and provide an appropriate Description.
- Under the Rule query statement, enter the following query:
SELECT devEui as device_id, "Temperature exceeded 25" as message, temperature as temp, timestamp as time FROM '+/project/sensor/decoded' where temperature > 25
- Under Set one or more actions, choose Add action.
- Choose Send a message as an SNS push notification.
- Choose Configure action.
- Under SNS target, select text_topic from the drop-down.
- Select RAW under Message format.
- Under Choose or create a role to grant AWS IoT access to perform this action, choose Create role.
- Enter a name for the role and choose Create role.
- Choose Create rule. You should see a "Success" message, indicating that the rule has been created.
Test the Rule for Amazon SNS Notification
After adding the rule for Amazon SNS notification, you should receive a text message when hitting the event.
Wait for an uplink from the device. Here is the message from the mobile device after sending an uplink message.
{
"device_id": "3933XXXXXXXXXXXX",
"message": "Temperature exceeded 25",
"temp": 27.2,
"time": "2021-02-22T07:58:54Z"
}
Send Downlink Payload
This section shows how to send downlink payload from AWS IoT LoRaWAN Server to the end Device.
- Install the AWS SAM CLI.
- Deploy SAM template to AWS.
- Send Payload to End Device.
- Go to the AWS IoT console.
- In the navigation pane, select Test, and choose MQTT client.
- Subscribe to the wildcard topic '#' to receive messages from all topics.
- Specify the topic to cmd/downlink/{WirelessDeviceId} and a base64-encoded message.
Figure 1: Specifying a Topic-
You should see traffic on AWS similar as shown below:
downlink/status/3eff83dd-9159-XXXX-XXXX-XXXXXXXXXXXX February 09, 2021, 15:09:29 (UTC+0800)
{
"sendresult": {
"status": 200,
"RequestId": "4f1d36e1-8316-4436-8e9d-2207e3711755",
"MessageId": "60223529-0011d9f5-0095-0008",
"ParameterTrace": {
"PayloadDate": "QQ==",
"WirelessDeviceId": "3eff83dd-9159-XXXX-XXXX-XXXXXXXXXXXX",
"Fport": 1,
"TransmitMode": 1
}
}
}
Figure 1: Traffic on AWS- You should see traffic on your console of end device similar as shown below.
SYSLOG:4:LoRa rX : 41 - 14
SYSLOG:4:LoRa Tx :
IoT Analytics
You will use IoT Analytics to visually display data via graphs if there is a need in the future to do further analysis.
Create an IoT Analytics Rule
Create a Rule First- Navigate to the AWS IoT console.
- In the navigation pane, choose Act and then, choose Rules.
- On the Rules page, choose Create.
- Enter the Name as Visualize, and provide an appropriate Description.
- Under the Rule query statement, enter the following query:
SELECT * FROM 'project/sensor/decoded'
- Choose Add action.
- Select Send a message to IoT Analytics.
- Choose Configure Action.
- Choose Quick Create IoT Analytics Resources.
- Under Resource Prefix, enter an appropriate prefix for your resources, such as LoRa.
- Choose Quick Create.
- Once the Quick Create Finished message is displayed, choose Add action.
- Choose Create rule. You should see a Success message, indicating that the rule has been created.
Configure AWS IoT Analytics
Set up AWS IoT Analytics- Go to the AWS IoT Analytics console.
- In the navigation panel, choose Data sets.
- Select the data set generated by the Quick Create in Create an IoT Analytics Rule.
- In the Details section, click Edit in the SQL query.
- Replace the query with as follows:
SELECT devEui as device_id, temperature as temp, timestamp as time FROM LoRa_datastore
- Click Update.
- Navigate to Schedule, and click Edit.
- Under Frequency, choose Every 1 minute, and then click Update.