Pipe-converter reads sensor datas through shell command. The shell command readdata.sh
in the repository is dummy, you should replace it with a real one.
- change
master_app
section with your kii app inconfig.yml
. - run gateway-agent under debug mode.
# go to root folder of gateway-agent
$ make run-debug
$ npm install
$ cp examples/config.json ./
- change
kii_app
. Make surekii_app
is same asmaster_app
for gateway agent in step 1. - change
sensor_id
.
$ node pipe-converter.js
Now, the sensor should be pended in gateway agent, which means the sensor device is not registered to kii cloud yet. You can see the output of gateway-agent, like:
IoTGW 19:00:40 pended: endnodeID=jp-oa8ucuzcu7qg-B02EA1FD-324B-4BB0-AB0E-ACD67BBD26F2 data={"humidity":55,"illumination":2570,"temperature":26}
We need to onboard the pended sensor to registered the sensor to kii cloud. Move on to nex step.
Onboard sensor use gwm-cli
cd $GOPATH/src/github.com/KiiPlatform/gwm-cli
Note: do not expose security credentials in your real service.
./gwm-cli auth --username admin_user --password admin_pass --app-name master
By this operation, Gateway information is sent to Kii Cloud and can be managed through the cloud.
./gwm-cli onboard-gateway --app-name master
Kii Gateway will be managed by the User in Kii Cloud called owner. Only the owner can manage the Gateway, so that it will be protected from malicious act. Execute user sign-up/ login before owner registration.
Replace {username}/ {password} section.
If you haven't created User in Kii Cloud, it will create new user.
./gwm-cli user-login --username {username} --password {password} --app-name master
Replace {gateway password} with the same string configured in thingPassword in gateway-agent/config.yml
./gwm-cli add-owner --gateway-password {gateway password} --app-name master
./gwm-cli list-pending-nodes --app-name master
You'll see output like this:
2017/04/20 18:21:40 pending nodes:
[B02EA1FD-324B-4BB0-AB0E-ACD67BBD26F1]
This means device with id 'B02EA1FD-324B-4BB0-AB0E-ACD67BBD26F1' is waiting to be onboarded to the Kii Cloud. The id
must be same as sensor_id
, configured in step 2.
Let's get thing done.
You can put passowrd of the sensor device in --node-password option.
(Arbitrary value can be set, but don't forget it.)
This is also a protection for malicious act.
./gwm-cli onboard-node --node-vid B02EA1FD-324B-4BB0-AB0E-ACD67BBD26F1 --node-password {node password} --app-name master
Now, both Gateway and sensor Device are managed in cloud. Data from sensor should be automatically uploaded to kii cloud.