Difference between revisions of "EdgeSense"

From ESS-WIKI
Jump to: navigation, search
Line 835: Line 835:
  
 
=== How To Install and Run - Protocol Connector Docker Container Services ===
 
=== How To Install and Run - Protocol Connector Docker Container Services ===
<pre>$git clone --branch installer-v1.0.1 https://github.com/ADVANTECH-Corp/docker-edgesense-image-x86.git .
+
<pre>$git clone --branch installer-v1.0.1 https://github.com/ADVANTECH-Corp/docker-edgesense-image-x86.git
 
$cd docker
 
$cd docker
 
// To deploy Services
 
// To deploy Services

Revision as of 04:51, 13 March 2018

Introduction

    WISE-PaaS/EdgeSense is an edge intelligence and sensing integration software solution that incorporates sensor data aggregation, cloud applications, edge analytics, and secure end-to-end data protection for fast and easy device-to-cloud operation. “Protocol Connector” is one of the major part of EdgeSense, it is an all-in-one message broker service which collects sensor data via various industrial protocols and then upload to cloud.

Cloud

EnSaaS

Register account on EdgesSense Portal

  • Purpose:

Instructions in this document are intended to walk you through on how to register and create a user account on WISE-PaaS/EdgeSense portal

 

  • Steps:

Step 1:

RTENOTITLE

Step 2

  • Step 2-1: Fill in information including “Email”, “First Name”, “Last Name” and “Phone Number”

RTENOTITLE

  • Step 2-2: A message box will pop up after clicking “Sign up”, indicating it’s successfully done

RTENOTITLE

Step 3:

  • Step 3-1: In no time, you will receive a welcome email from Advantech in your registred mailbox which contains the information of your username and default password

RTENOTITLE

  • Step 3-2: Go back to login portal (as specified in Step1-1 or click “Return to login”) and login with your username and default password provided in welcome email

RTENOTITLE

  • Step 3-3: Upon first login, EdgeSense portal will ask user to change default password

RTENOTITLE

  • Step 3-4: After changing password, re-login with new password

RTENOTITLE

  • Step 3-5: Now you should be able to see default page after logging in WISE-PaaS/EdgeSense portal

RTENOTITLE

How to Connect Edge Devices to RMM Cloud

  • Purpose:

Instructions in this document are intended to walk you through the process of connecting your edge devices to RMM cloud

 

  • Steps:

Step 1: Sign in EdgeSense Portal

(If you don’t have an EdgeSense account, please register one by clicking “Sign up” at the bottom)

RTENOTITLE

Step 2: Obtain Agent Credentials and Download EI Agent

  • Step 2-1: Select “System” tab under “Setting” on the left of management console

RTENOTITLE

  • Step 2-2: Click “Generate Agent Credential” botton to obtain IoTKey and Credential URL which will be needed when installing RMM EI Agent in Step 3 in order to connect agent to RMM cloud

RTENOTITLE

  • Step 2-3: Click “Download” button to download RMM EI Agent instllation package

RTENOTITLE

  • Step 2-4: [Important Reminder] Please note that this step MUST BE taken on your edge devices

           Execute RMM EI AgentSetep_1.0.9.exe file to start instllation process on agent devices

RTENOTITLE

Step 3: Install RMM EI Agent

RTENOTITLERTENOTITLE

Enter Credential URL and IoTKey obtained earlier in EdgeSense management console (Step 2-2)

RTENOTITLERTENOTITLE

RTENOTITLE

If your devices support iAMT, you can also enter your iAMT account and password here

RTENOTITLE

(Note: iAMT may need to be enabled in BIOS first and MEBx configurations might as well needed)

RTENOTITLERTENOTITLE

RTENOTITLE

Launch “ServerSetting” under C:\Program Files (x86)\Advantech\RMM EI Agent (default folder)

RTENOTITLE

You can set your password for accessing “ServerSetting”

RTENOTITLE

After setting password, please make sure it shows “Connected”, otherwise devices couldn’t get connected to RMM cloud

RTENOTITLE

Step 4: Get Edge Devices Connected to RMM Cloud

  • Step 4-1: In management console, go to “Device Group” under “Setting” tab, then click “+” icon to add new group(s) before adding devices (Note: Please be noted that you HAVE TO create a new group before adding or assigning edge devices if there’s no existing group(s))

RTENOTITLE

  • Step 4-2: Enter the name and description (optional) of the group you’re creating

RTENOTITLE

  • Step 4-3: A notification window will pop up indicating your group has been created successfully

RTENOTITLE

  • Step 4-4: Now we can see a new group has been generated (EdgeSenseGroup here for example)

RTENOTITLE

  • Step 4-5: Go to “Device” tab on the left console, click drop-down list and select the group you want your edge devices to be assigned

RTENOTITLE

  • Step 4-6: Click “+” icon to add device

RTENOTITLE

  • Step 4-7: Then Click “+” icon to add device manually

RTENOTITLE

  • Step 4-8: Upon seeing this message box, go back and open ServerSetting (Step 3) on edge device then click the copy icon (as pointed in below screenshot) to copy full string of Agent ID

RTENOTITLE

RTENOTITLE

  • Step 4-9: Paste the full string of Agent ID just copied in the blank

RTENOTITLE

  • Step 4-10: Edge device to be added/connected will then appear with its “Name” and “Agent ID

RTENOTITLE

  • Step 4-11: Notification window will pop out indicating device(s) has been added to your group

RTENOTITLE

  •  [Note] Generally if your account is signed up/created through WISE-PaaS/EdgeSense portal, default account role assigned is “device admin”. If you wish to have elavated priviledge/permission as “admin” which allows you to search all unassigned devices and decide which to add, please contact Advantech for more information

RTENOTITLE

With “admin” permission, a list of unassigned devices will appear for users to search/select from

RTENOTITLE

  • Step 4-12: Now you should be able to see your connected devices in management console

RTENOTITLE

  • Step 4-13: Click the name of the edge device you will see all detailed information of this device

RTENOTITLE

Azure

Create Azure IoT Hub

To utilize Azure services, we need a Microsoft account to log in to azure portal. Following steps will create an azure iot hub to communicate with Advantech protocol connector modules.

Step 1. Log in to Microsoft Azure Portal

Step 2. Create a resource group

  • Search “resource group” and create new one
create-rg.png
  • Input resource group name: protocol-conn-rg (for example)
  • Select a location (service region): East Asia (for example)
create-rg-detail.png

Step 3. Create an azure iot hub

  • Search “iot hub” and create new one
create-hub.png
  • Input IoT hub name: protocol-conn-hub (for example)
  • Select pricing and scale tier: here we chose “S1 - Standard
  • Select Resource group created at step 2: click “Use existing” and select “protocol-conn-rg
create-hub-detail.png

Protocol Connector Using Node-RED

Cloud Environment Setups

Following steps will create an azure iot device to connect to iot hub created at previous section.

Step 1. Go to iot hub created at previous section: Resource groups → protocol-conn-rg → protocol-conn-hub

select conn hub

Step 2. IoT Devices → Add

select conn hub
  • Device ID: protocol-conn-device (for example)
  • Authentication Type: select “Symmetric Key” for this tutorial
  • Check “Auto Generate Keys”
  • Connect device to IoT Hub: select “Enable”
iot device details
  • Select the created iot device to get device connection string
select iot device
  • Click save-icon.png to copy “Connection string-primary key” and make sure the "Connect device to IoT Hub" is "Enable"
copy device conn string.png
  • Save the connection string in a text file for later use
save-conn-string

Device Environment Setups

Following steps will configure device Node-RED nodes to enable communications between Advantech protocol connector modules and azure iot hub.

Step 1. Open Node-RED page in the web browser (default URI is http://127.0.0.1:1880)

nr main

Step 2. Copy following content and import it into Node-RED

        [
            {"id": "ce169f53.786dd" , "type": "tab", "label": "Protocol Connector ", "disabled": false, "info": ""},
            {"id": "104120.85f37ee" , "type": "mqtt in", "z": "ce169f53.786dd", "name": "Data Recieved", "topic": "/cagent/admin/+/deviceinfo", "qos": "2", "broker": "23acb8c5.a15ad8", "x": 150, "y": 132, "wires": [["12642914.e549c7", "95d1843d.e8a5c8"]]},
            {"id": "97d0f87d.614ea8", "type": "mqtt out", "z": "ce169f53.786dd", "name": "Auto-Report Request", "topic": "", "qos": "0", "retain": "false", "broker": "23acb8c5.a15ad8", "x": 692.0001220703125, "y": 401, "wires": []},
            {"id": "12642914.e549c7", "type": "debug", "z": "ce169f53.786dd", "name": "", "active": true, "console": "false", "complete": "payload", "x": 340, "y": 112, "wires": []},
            {"id": "6bacc623.4bc318", "type": "comment", "z": "ce169f53.786dd", "name": "Send Protocol Connector  Sensor Data to Azure IoT Hub", "info": "", "x": 270, "y": 69.36331176757812, "wires": []},
            {"id": "4a9698eb.3deed8", "type": "comment", "z": "ce169f53.786dd", "name": "Send Auto-Report Request to Internal MQTT", "info": "", "x": 240, "y": 296, "wires": []},
            {"id": "3a7f0c9.34066f4", "type": "mqtt in", "z": "ce169f53.786dd", "name": "Handler Registered", "topic": "/cagent/admin/+/agentinfoack", "qos": "2", "broker": "23acb8c5.a15ad8", "x": 160, "y": 364.8398742675781, "wires": [["3cd5a503.a6b2ca"]]},
            {"id": "3cd5a503.a6b2ca", "type": "function", "z": "ce169f53.786dd", "name": "pack auto report command", "func": "var auto_rpt_msg = function(device) {\n    return {\n        topic: \"/cagent/admin/\" + device + \"/agentcallbackreq\",\n        payload: {\n            \"susiCommData\": {\n                \"commCmd\": 2053,\n                \"requestItems\": {\"All\":{}},\n                \"autoUploadIntervalSec\": 10,\n                \"handlerName\": \"general\"\n            }\n        }\n    };\n};\n\nvar registered = context.get(\"registered\") || [];\nvar dev_id = msg.topic.replace(/^\\/cagent\\/admin\\/|\\/agentinfoack$|\\/notify$/g, \"\");\nvar is_reg_msg = (\n    msg.topic.endsWith(\"agentinfoack\") && JSON.parse(msg.payload).susiCommData.status\n);\nvar msg_out = (is_reg_msg || (!~registered.indexOf(dev_id)))? auto_rpt_msg(dev_id) : null;\n\nif(!~registered.indexOf(dev_id)) {\n    registered.push(dev_id);\n}\n\ncontext.set(\"registered\", registered);\nreturn msg_out;\n", "outputs": 1, "noerr": 0, "x": 418.0195617675781, "y": 401.00390625, "wires": [["97d0f87d.614ea8"]]},
            {"id": "95d1843d.e8a5c8", "type": "azureiothub", "z": "ce169f53.786dd", "name": "Send to Azure IoT Hub", "protocol": "http", "x": 370, "y": 152, "wires": [["ecc11415.86a138"]]},
            {"id": "ecc11415.86a138", "type": "debug", "z": "ce169f53.786dd", "name": "", "active": true, "console": "false", "complete": "payload", "x": 601.5, "y": 151.29998779296875, "wires": []},
            {"id": "bf50c923.03a288", "type": "comment", "z": "ce169f53.786dd", "name": "Display Cloud to Device Messages", "info": "", "x": 671, "y": 192, "wires": []},
            {"id": "71829e36.9c78c" , "type": "mqtt in", "z": "ce169f53.786dd", "name": "Handler Heartbeat", "topic": "/cagent/admin/+/notify", "qos": "2", "broker": "23acb8c5.a15ad8", "x": 157, "y": 438, "wires": [["3cd5a503.a6b2ca"]]},
            {"id": "23acb8c5.a15ad8", "type": "mqtt-broker", "z": "", "broker": "127.0.0.1", "port": "1883", "clientid": "", "usetls": false, "compatmode": true, "keepalive": "60", "cleansession": true, "willTopic": "", "willQos": "0", "willPayload": "", "birthTopic": "", "birthQos": "0", "birthPayload": ""}
        ]
import nr flow

Step 3. Select "Protocol Connector" tab and double click "Send to Azure IoT Hub" node to configure node settings.

select nr node

Step 4. Copy the saved device connection string and paste to "Connection String" field

select nr conn string

Step 5. Click deploy icon to complete edge device environment setups and make sure the states of MQTT nodes are "connected"

nr deployed

Protocol Connector Using IoT Edge

Prerequisites

Before to perform Azure IoT Edge environment setup steps, please make sure all following packages and tools are available and are correctly setup.

Windows Host
  • Docker:
1. Install Docker and check "docker" command is available. (the version number may be different)
prerequisites-win-docker.png
2. Make sure it's running in Linux container mode.
prerequisites-win-docker-mode.png
  • Python:
1. Install Python 2.7 and remember to check “Add python.exe to path” feature.
prerequisites-win-python-path.png

2. Make sure the “pip” command is available.
prerequisites-win-python.png
  • IoT Edge Runtime Control Tool:

1. Install IoT Edge control script (may need to run as administrator)

        pip install -U azure-iot-edge-runtime-ctl
2. Make sure the “iotedgectl” command is available. (the version number may be different)
prerequisites-win-iotedgectl.png
Linux Host
  • Docker:

1. Install Docker and check "docker" command is available. (the version number may be different).

prerequisites-docker-linux.png
  • Python pip:

1. Install Python pip command.

        sudo apt-get install python-pip

2. Make sure the “pip” command is available.

prerequisites-win-python.png
  • IoT Edge Runtime Control Tool:

1. Install IoT Edge control script (may need to run as root)

        pip install -U azure-iot-edge-runtime-ctl

2. Make sure the “iotedgectl” command is available. (the version number may be different)

prerequisites-win-iotedgectl.png

Cloud Environment Setups

Following steps will create an azure iot edge device at previously created iot hub.

Step 1. Create an iot edge device

  • Go to iot hub created at previous section: Resource groups → protocol-conn-rg → protocol-conn-hub
select conn hub
  • IoT Edge → Add IoT Edge Device
create-iotedge-device.png
  • Device ID: protocol-conn-device (for example)
  • Authentication Type: select “Symmetric Key” for this tutorial
  • Check “Auto Generate Keys
  • Connect device to IoT Hub: select “Enable
create-iotedge-device-details
  • Select the created iot edge device to get device connection string
select-iotedge-device
  • Click save-icon.png to copy “Connection string-primary key” and make sure the "Connect device to IoT Hub" is "Enable"
select-edge-device-conn-string
  • Save the connection string in a text file for later use
conn-string.png

Device Environment Setups

Following steps will configure edge device to bind to azure iot edge device previously created.

Step 1. Configure the iot edge runtime (need administrator privileges on windows 10 host or root privileges on linux host)

  • Open a command prompt and type following command. Replace "{your iot edge device connection string}" with the saved device connection string
        iotedgectl setup --connection-string "{your iot edge device connection string}" --auto-cert-gen-force-no-passwords
iotedge-setup-win

iotedge-setup-linux
  • Start the IoT Edge runtime
        iotedgectl start
iotedge-start-win

iotedge-start-linux
  • Check Docker to see that the IoT Edge agent is running as a module
        docker ps
docker-ps-win

docker-ps-linux

Deploy an iot edge device module to edge device

Step 1. Select iot edge device created at previous section

select-iotedge-device

Step 2. Set Modules → Add IoT Edge Module

add-iotedge-device-module.png
  • Name: protocol-connector-module
  • Image URI: advigw4x86/protocol-connector-azure-iot-edge:latest
  • Container Create Options:
  • In Windows host, paste following content
        {
            "Env": ["MQTT_HOST=10.0.75.1", "MQTT_PORT=1883"]
        }
  • In Linux host, paste following content
        {
            "Env": ["MQTT_HOST=172.17.0.1", "MQTT_PORT=1883"]
        }
  • Restart Policy: select “always
  • Desired Status: select “running
add-device-module-detail.png
  • Click “Next” to specify routes step
add-device-module-cont.png
  • Paste following content to specify route and click “Next” to review template
        {
            "routes": {
                "moduleToIoTHub": "FROM /messages/modules/protocol-connector-module/outputs/output1 INTO $upstream"
            }
        }
add-device-module-route.png
  • In the Review Template step, click “Submit”
add-device-module-template.png
  • Return to the IoT Edge device details page and click Refresh. The "protocol-connector-module" should be running along with the IoT Edge runtime
add-device-module-done.png

Monitor Messages

Device to Cloud (D2C)

        npm install -g iothub-explorer

        iothub-explorer monitor-events iotedge-protocol-connector --login "{your iot hub connection string}"
iothub-explorer-win
iothub-explorer-linux

Cloud to Device (C2D)

  • C2D message is not yet ready on IoT Edge public preview.
  • For Node-RED protocol connector modules, we can take following steps to send C2D messages.

Step 1. Open Node-RED in web browser, select Protocol Connector and click the debug tab

select c2d message

Step 2. Go to iot device created at previous section: Resource groups → protocol-conn-rg → protocol-conn-hub → protocol-conn-device, then select "Message To Device"

select c2d message

Step 3. Type our cloud to device messages in "Message Body" field then click "Send Message".

send select c2d message

Step 4. Back to Node-RED page, we can see the received message

receive c2d message

AWS

Node-Red

Prerequisites:

  • AWS account
  • this example use service which is region in US East (N. Virginia).

Cloud Environment Setups

Step 1.Return the AWS console and go to IAM menu.

IAM1.png

Step 2.Click “user” menu

IAM2.png


 

Step 3.Click “Add user” button

IAM3.png

Step 4.Enter your user name. In this example user name is “Adv_test”.→ chose Programmatic access → Click “Next Permissions” button.

IAM4png

Step 5.Click IAM_GP.png

IAM.png

Step 6.Choose AdministratorAccess → Click “Next: Review” button

IAM6.png

Step 7.Click “Create user”

IAM7.png

Step 8.Download the credentials. This is the last time these credentials will be available to download.

Step 9.Click “Download .csv” button

IAM8.png

Device Environment Setups

In this section, you will install Advantech Node-Red tool for and Configurate the setting to connect AWS IoT


  •  click on desktop to open NodeRED in web browser
8.png

Set up edge device environment

  • Copy following NodeRED flow and import it into NodeRED:
   
[{"id":"d652f017.65e74","type":"tab","label":"Protocol Connector ","disabled":false,"info":""},
{"id":"bec4e2f6.b7b83","type":"mqtt in","z":"d652f017.65e74","name":"Data Recieved","topic":"/cagent/admin/+/deviceinfo","qos":"2","broker":"22aa981b.46a50c","x":150,"y":132,"wires":[["5651a33f.5722bc","cd4723c3.e1624"]]},{"id":"cd4723c3.e1624","type":"debug","z":"d652f017.65e74","name":"","active":true,"console":"false","complete":"payload","x":340,"y":112,"wires":[]},
{"id":"f7640bf7.c78ab8","type":"comment","z":"d652f017.65e74","name":"Send Protocol Connector  Sensor Data to AWS IoT","info":"","x":260,"y":69.36331176757812,"wires":[]},
{"id":"f6c0c463.1d1928","type":"comment","z":"d652f017.65e74","name":"Send Auto-Report Request to Internal MQTT","info":"","x":220,"y":296,"wires":[]},
{"id":"5651a33f.5722bc","type":"function","z":"d652f017.65e74","name":"messgae topic","func":"var device_id = 'DK10';\nvar plugin_id = msg.topic.replace(/^\\/cagent\\/admin\\/|\\/deviceinfo$/g, \"\");\nmsg.topic = 'protocol-conn/' + device_id + '/' + plugin_id;\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":157.10000610351562,"wires":[["bb0580c5.75a24"]]},{"id":"b74f9d97.3e912","type":"mqtt out","z":"d652f017.65e74","name":"Auto-Report Request","topic":"","qos":"0","retain":"false","broker":"22aa981b.46a50c","x":692.0001220703125,"y":401,"wires":[]},
{"id":"828deeb3.bd324","type":"mqtt in","z":"d652f017.65e74","name":"Handler Registered","topic":"/cagent/admin/+/agentinfoack","qos":"2","broker":"22aa981b.46a50c","x":160,"y":364.8398742675781,"wires":[["8e87ec7b.6487b"]]},
{"id":"8e87ec7b.6487b","type":"function","z":"d652f017.65e74","name":"pakcage auto report command","func":"var auto_rpt_msg = function(device) {\n    return {\n        topic: \"/cagent/admin/\" + device + \"/agentcallbackreq\",\n        payload: {\n            \"susiCommData\": {\n                \"commCmd\": 2053,\n                \"requestItems\": {\"All\":{}},\n                \"autoUploadIntervalSec\": 10,\n                \"handlerName\": \"general\"\n            }\n        }\n    };\n};\n\nvar registered = context.get(\"registered\") || [];\nvar dev_id = msg.topic.replace(/^\\/cagent\\/admin\\/|\\/agentinfoack$|\\/notify$/g, \"\");\nvar is_reg_msg = (\n    msg.topic.endsWith(\"agentinfoack\") && JSON.parse(msg.payload).susiCommData.status\n);\nvar msg_out = (is_reg_msg || (!~registered.indexOf(dev_id)))? auto_rpt_msg(dev_id) : null;\n\nif(!~registered.indexOf(dev_id)) {\n    registered.push(dev_id);\n}\n\ncontext.set(\"registered\", registered);\nreturn msg_out;\n","outputs":1,"noerr":0,"x":418.0195617675781,"y":401.00390625,"wires":[["b74f9d97.3e912"]]},{"id":"b06132d0.4baf6","type":"mqtt in","z":"d652f017.65e74","name":"Handler Heartbeat","topic":"/cagent/admin/+/notify","qos":"2","broker":"22aa981b.46a50c","x":157,"y":438,"wires":[["8e87ec7b.6487b"]]},
{"id":"bb0580c5.75a24","type":"AWS IotData","z":"d652f017.65e74","aws":"20e9a430.34135","operation":"Publish","thingName":"","topic":"","payload":"","endPoint":"","name":"","x":535,"y":156.75,"wires":[[]]},{"id":"22aa981b.46a50c","type":"mqtt-broker","z":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},
{"id":"20e9a430.34135","type":"amazon config","z":"","name":"AWS","region":"us-east-1"}]
  • Switch to Protocol Connector tab and double click “IotData Publish” node to set device configuration.
  • Click button_NR.png button
    2018-02-13_145112.png


 

  • Enter the Access Id and Secret Key which is on credentials .csv file.
11.png
  • Enter the Name “IoT Pubilsh” and Endpoint
2018-02-13_144939.png


 

 

  • You can find endpoint in AWS IoT console.
13.png
  • Check your message topic on the "message topic' function node
    15-2.png
  • Enter {your devie id} in device_id, you can choose {your device id} which you want.
[[File:2018-02-13 152702.png|center|2018-02-13_152702.png]]
  • Click deploy.png to finish edge device environment setups.
17-2.png
  • Click NodeRED “Debug” tab, the sent messages will be displayed. 
18-2.png
2018-02-13_152730.png


  • if your settings is correct, then you can see the message in this area.
2018-02-13_152741.png


 

 

Greengrass

Prerequisites

AWS Account

Linux Host

OS version : Ubuntu 16.04 x64

Create Greengrass Group

Using the AWS IoT console, create an AWS IoT thing, certificate, and policy for your AWS Greengrass core device:

 

Step 1. Go to the AWS IoT console and click Greengrass.

2018-02-07_105948.png
2018-02-07_110140.png
Step 2. Create an AWS Greengrass group and name it GGC
2018-02-07_110247.png
Step 3. Create an AWS IoT for Greengrass core
2018-02-07_110257.png
Step 3. Create an AWS IoT for Greengrass core
2018-02-07_110247.png
Step 4. One-click to create Greengrass certificate and attach policy.
2018-02-07_110405.png
Step 5. Download Certificate and Greengrass config.
2018-02-07_110435.png

Setup Greengrass Group

To define your Greengrass group, follow these steps:

  1. Add devices to your group
  2. Add Lambda functions to your group
  3. Add subscriptions to your group
Add devices to your group

Step 1.Go to the AWS IoT console.

Step 2.In the navigation pane, select Greengrass and then Groups.

Step 3.Click on your group, GGC

Step 4.In the navigation pane, click Devices and then Add Device.
2018-02-07_114426.png
Step 5. Enter AWS IoT Name Device and click Next
2018-02-07_114443.png
Step 6. Using default setting to quick create access permissions and certificate.
2018-02-07_114456.png
Step 7. Download certificate and finish this process
2018-02-07_114508.png


Add Lambda functions to your group

Step 1.Go to the AWS IoT console.

Step 2.In the navigation pane, select Greengrass and then Groups.

Step 3.Click on your group, GGC

Step 4.In the navigation pane, click Lambda and then Add Lambda.

Step 5.In the Lambda console, click Create function then the browser will go to the lambda page.
2018-02-07_114540.png

Step 6.In the Name field, type the name of the Lambda function you are creating. In this case, lambda was named DK10_Lambda.

Step 7.In the Runtime drop down menu, select Python 2.7.

Step 8.In the Role drop down, select Choose an existing role. In the Existing role drop down, select any role. The role is not important because AWS Greengrass does not use it. If you do not have a role, choose Create a custom role and follow the steps.

Step 9.Click Create function.

2018-02-07_142251.png

Step 10.In the Function code section, select Upload a .ZIP file in the Code entry type drop down.

Step 11.Click Upload and select the corresponding zip file.

2018-02-07_143931.png

Step 12.Review the Lambda settings and click Save button at the top right.

Step 13.Publish a new version of the Lambda function from Actions > Publish new version.

2018-02-07_144920.png

Step 14.Click Publish in the Publish new version dialog. AWS Lambda creates a new version and assigns an increasing sequence number to it, 1 for the first version.

2018-02-07_144927.png

Step 15.Go back to Greengrass Lambda page

Step 16.Click Use existing Lambda.

Step 17.Select the DK10_Lambda you created.

Step 18.Click Next

2018-02-07_143953.png
Step 19.Select Version 1 and click Finish
2018-02-07_145015.png
.
Add subscriptions to your group
2018-02-07_145344.png
Step 1.In the navigation pane, click Subscriptions and then Add Subscription.

Step 2.Under Select a source, select the source of the subscription.

Step 3.Under Select a target, select the target of the subscription.

Step 4.Click Next.

Step 5.In the Optional topic filter, type the topic of the subscription.

Step 6.Click Next.

Step 7.Review the subscription information and click Finish to create it.


Run Greengrass core in your device

To configure your core to recognize the AWS IoT thing, update the /greengrass/config/config.json file. and /greengrass/certs.

Copy certs and config with root permission

Step 1.sudo cp -R certs/ ~/<unzipped the path>/greengrass/

Step 2.sudo cp -R conf/ ~/<unzipped the path>/greengrass/

Step 3.sudo cp root.ca.pem ~/<unzipped the path>/greengrass/certs/

 

The Greengrass core software is installed inside the /greengrass directory of your device.

Step 1.Make sure your device is connected to the Internet.

Step 2.sudo ~/<your path>/greengrass/ggc/core/greengrassd start

greengrassrun.png

Deploy your Greengrass group

After running Greengrass core, you can deploy your Greengrass group to your device.

Step 1.Go to the AWS IoT console.

Step 2.In the navigation pane, select Greengrass and then Groups.

Step 3.Click on your group, GGC.

Step 4.In the navigation pane, click Deployments.

Step 5.Click Actions > Deploy.

 

2018-02-01_135700.png
Step 6.In the Configure how Devices discover your Core select Automatic detection.
2018-02-01_135720.png
Step 7.In the Grant permissions to access other services, click Grant permission.
2018-02-01_135731.png
When the operation is complete, the Deployment successfully completed is displayed at the top of the page.
2018-02-08_151442.png

Set up your AWS IoT Things

When Greengrass group is deployed successful. You can setup AWS IoT Device which is defined in Greengrass group with Protocol Connector.

 

AWS IoT devices need certificates to authenticate with AWS IoT and retrieve the connectivity information of your Greengrass core. You downloaded these certificates in Add devices to your group Create device things.

Install your thing certificates

cp root-ca.pem <parent_absolute_path>/ProtocolConnectorSample/certs

cp <id>.pem.crt <parent_absolute_path>/ProtocolConnectorSample/certs

cp <id>-private.pem.key <parent_absolute_path>/ProtocolConnectorSample/certs

Configure the samples

Inside the ProtocolConnectorSample/config/ directory you can find the configuration files for your things:

2018-02-09 16-17-16.png

Run the protocol connector sample

After setting AWS IoT you can execute protocol connector sample,

In the ProtocolConnectorSample folder

./MQTTAgent-sample

2018-02-09 16-18-09.png

Edge Sense

Windows

Linux 

Basic Requirment:

  • Host OS must be Linux Distribution ( e.g. Ubuntu 14.04 / 16.04, ... )
  • Docker Engine - Installation Guide ( Ubuntu, Debian, CentOS, Fedora, )
  • Docker compose - Installation Guid
  • Hardward: Advantech x86_64 Platforms ( e.g. ARK-2121L...)

How To Install and Run - Protocol Connector Docker Container Services

$git clone --branch installer-v1.0.1 https://github.com/ADVANTECH-Corp/docker-edgesense-image-x86.git
$cd docker
// To deploy Services
$./deploy
// To install EI-Agent for EnSaaS
$./deploy.sh connector EnSaaS

How to modify your server ID/Password and resart

# To modify your ConnAuth then save and exit 
# <ConnAuth>2b7555b4-4313-4320-8b3b-1140350ec279:928e36c5-b22a-4a03-8fcd-470eb61552c0;7tnorqqc20nf0dbldnamu3co4g</ConnAuth>
$cd ../EdgeSense/AgentService/config/
$sudo vim agent_config.xml
$docker restart ensaas-ei-agent

How to config Modbus Service and Restart Service

$cd ../EdgeSense/EService-Modbus/config
$sudo vim Modbus_Handler.ini
$docker stop service-modbus
$docker start service-modbus

Release

Pages with broken file links