Cumulocityのドキュメントに従ってこの手順通りでやってみる。
参考Webはここ。
https://cumulocity.com/guides/rest/introduction/
参考Webはここ。
https://cumulocity.com/guides/rest/introduction/
私の設定情報は下記。そのまま掲載。
—————-
設定情報
—————-
https://iot05.cumulocity.com
Username : yoshihara20161226
Password : A******
System ID:***** (←★これはcumulocity見て確認需重要!!★)
Name :RaspPi BCM2709 0000000075b****f
Model:RaspPi BCM2709
Serial number:0000000075b****f
Revision :a02082
Type:c8y_Serial
Id:linux-0000000075b****f
Firmware version :mhf
—————-
—————-
設定情報
—————-
https://iot05.cumulocity.com
Username : yoshihara20161226
Password : A******
System ID:***** (←★これはcumulocity見て確認需重要!!★)
Name :RaspPi BCM2709 0000000075b****f
Model:RaspPi BCM2709
Serial number:0000000075b****f
Revision :a02082
Type:c8y_Serial
Id:linux-0000000075b****f
Firmware version :mhf
—————-
さて、まずVNCで接続して、、、、RaspberryPi君!ようこそ!
(図1)
(図1)
Cumulocityにも接続します。自分のOD、Passで!
(図2)
(図2)
DevicemanagementでAll devicesを選択。一覧表示。
(図3)
(図3)
DeveieResistrationは特にやらなくとも、RaspberryPiを一度接続したら勝手に認識したなあ。。。ここは別途要確認。。
これは、あえてシリアル番号入れて登録した画面。
(図4)
これは、あえてシリアル番号入れて登録した画面。
(図4)
少し時間たつと、勝手にRaspberryPiの情報を送受した??別途要確認。。。
(図5)
(図5)
ここから、、、
(#1 send)DeviceCreateをする。コマンドは、下記。Linuxでcurlコマンドで。cumulocityへ投げつける。
(#1 send)DeviceCreateをする。コマンドは、下記。Linuxでcurlコマンドで。cumulocityへ投げつける。
$ curl -v -u yoshihara20161226:A****** \
> -H ‘Accept: application/vnd.com.nsn.cumulocity.managedObject+json; charset=UTF-8; ver=0.9’ \
> -H ‘Content-type: application/vnd.com.nsn.cumulocity.managedObject+json; charset=UTF-8; ver=0.9’ \
> -X POST \
> -d ‘{“c8y_IsDevice”:{},”name”:”HelloWorldDevice”}’ \
> https://iot05.cumulocity.com/inventory/managedObjects
> -H ‘Accept: application/vnd.com.nsn.cumulocity.managedObject+json; charset=UTF-8; ver=0.9’ \
> -H ‘Content-type: application/vnd.com.nsn.cumulocity.managedObject+json; charset=UTF-8; ver=0.9’ \
> -X POST \
> -d ‘{“c8y_IsDevice”:{},”name”:”HelloWorldDevice”}’ \
> https://iot05.cumulocity.com/inventory/managedObjects
(#1 results)
すると、下記のresponceが返ってくる。中ほどの”HTTP/1.1 201 Created”があれば多分コマンドはうまく行ったはず。。。。
すると、下記のresponceが返ってくる。中ほどの”HTTP/1.1 201 Created”があれば多分コマンドはうまく行ったはず。。。。
(図6)
* Hostname was NOT found in DNS cache
* Trying 52.28.26.32…
* Connected to iot05.cumulocity.com (52.28.26.32) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
* subject: C=DE; ST=Nordrhein-Westfalen; L=Duesseldorf; O=Cumulocity GmbH; CN=*.cumulocity.com
* start date: 2016-08-01 09:55:38 GMT
* expire date: 2017-08-05 10:35:38 GMT
* subjectAltName: iot05.cumulocity.com matched
* issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority – G2
* SSL certificate verify ok.
* Server auth using Basic with user ‘yoshihara20161226’
> POST /inventory/managedObjects HTTP/1.1
> Authorization: Basic eW9zaGloYXJhMjAxNjEyMjY6QWExMjM0NTY=
> User-Agent: curl/7.38.0
> Host: iot05.cumulocity.com
> Accept: application/vnd.com.nsn.cumulocity.managedObject+json; charset=UTF-8; ver=0.9
> Content-type: application/vnd.com.nsn.cumulocity.managedObject+json; charset=UTF-8; ver=0.9
> Content-Length: 45
>
* upload completely sent off: 45 out of 45 bytes
< HTTP/1.1 201 Created
* Server nginx is not blacklisted
< Server: nginx
< Date: Tue, 17 Jan 2017 13:23:11 GMT
< Content-Type: application/vnd.com.nsn.cumulocity.managedObject+json; charset=UTF-8; ver=0.9
< Transfer-Encoding: chunked
< Connection: keep-alive
< Location: https://iot05.cumulocity.com/inventory/managedObjects/30506
< Strict-Transport-Security: max-age=31536000; includeSubDomains
<
* Connection #0 to host iot05.cumulocity.com left intact
{“assetParents”:{“references”:[],”self”:”https://iot05.cumulocity.com/inventory/managedObjects/30506/assetParents”},”childAssets”:{“references”:[],”self”:”https://iot05.cumulocity.com/inventory/managedObjects/30506/childAssets”},”childDevices”:{“references”:[],”self”:”https://iot05.cumulocity.com/inventory/managedObjects/30506/childDevices”},”creationTime”:”2017-01-17T14:23:11.768+01:00″,”deviceParents”:{“references”:[],”self”:”https://iot05.cumulocity.com/inventory/managedObjects/30506/deviceParents”},”id”:”30506″,”lastUpdated”:”2017-01-17T14:23:11.768+01:00″,”name”:”HelloWorldDevice”,”owner”:”yoshihara20161226″,”self”:”https://iot05.cumulocity.com/inventory/managedObjects/30506″,”c8y_IsDevice”:{}}
* Trying 52.28.26.32…
* Connected to iot05.cumulocity.com (52.28.26.32) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
* subject: C=DE; ST=Nordrhein-Westfalen; L=Duesseldorf; O=Cumulocity GmbH; CN=*.cumulocity.com
* start date: 2016-08-01 09:55:38 GMT
* expire date: 2017-08-05 10:35:38 GMT
* subjectAltName: iot05.cumulocity.com matched
* issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority – G2
* SSL certificate verify ok.
* Server auth using Basic with user ‘yoshihara20161226’
> POST /inventory/managedObjects HTTP/1.1
> Authorization: Basic eW9zaGloYXJhMjAxNjEyMjY6QWExMjM0NTY=
> User-Agent: curl/7.38.0
> Host: iot05.cumulocity.com
> Accept: application/vnd.com.nsn.cumulocity.managedObject+json; charset=UTF-8; ver=0.9
> Content-type: application/vnd.com.nsn.cumulocity.managedObject+json; charset=UTF-8; ver=0.9
> Content-Length: 45
>
* upload completely sent off: 45 out of 45 bytes
< HTTP/1.1 201 Created
* Server nginx is not blacklisted
< Server: nginx
< Date: Tue, 17 Jan 2017 13:23:11 GMT
< Content-Type: application/vnd.com.nsn.cumulocity.managedObject+json; charset=UTF-8; ver=0.9
< Transfer-Encoding: chunked
< Connection: keep-alive
< Location: https://iot05.cumulocity.com/inventory/managedObjects/30506
< Strict-Transport-Security: max-age=31536000; includeSubDomains
<
* Connection #0 to host iot05.cumulocity.com left intact
{“assetParents”:{“references”:[],”self”:”https://iot05.cumulocity.com/inventory/managedObjects/30506/assetParents”},”childAssets”:{“references”:[],”self”:”https://iot05.cumulocity.com/inventory/managedObjects/30506/childAssets”},”childDevices”:{“references”:[],”self”:”https://iot05.cumulocity.com/inventory/managedObjects/30506/childDevices”},”creationTime”:”2017-01-17T14:23:11.768+01:00″,”deviceParents”:{“references”:[],”self”:”https://iot05.cumulocity.com/inventory/managedObjects/30506/deviceParents”},”id”:”30506″,”lastUpdated”:”2017-01-17T14:23:11.768+01:00″,”name”:”HelloWorldDevice”,”owner”:”yoshihara20161226″,”self”:”https://iot05.cumulocity.com/inventory/managedObjects/30506″,”c8y_IsDevice”:{}}
(#2 data send)次に、データ送信。curlコマンドで自分の”ID””Pass””(#1)でのResponceでのid”を変えてあげて下記コマンドを送信。
curl -v -u yoshihara20161226:A****** \
-H ‘Accept: application/vnd.com.nsn.cumulocity.measurement+json; charset=UTF-8; ver=0.9’ \
-H ‘Content-type: application/vnd.com.nsn.cumulocity.measurement+json; charset=UTF-8; ver=0.9’ \
-X POST \
-d ‘{“c8y_TemperatureMeasurement”:{“T”:{“value”:30.00,”unit”:”C”}},”time”:”2017-01-22T13:00:00.123+02:00″,”source”:{“id”:”*****”},”type”:”c8y_PTCMeasurement”}’ \
https://iot05.cumulocity.com/measurement/measurements/
-H ‘Accept: application/vnd.com.nsn.cumulocity.measurement+json; charset=UTF-8; ver=0.9’ \
-H ‘Content-type: application/vnd.com.nsn.cumulocity.measurement+json; charset=UTF-8; ver=0.9’ \
-X POST \
-d ‘{“c8y_TemperatureMeasurement”:{“T”:{“value”:30.00,”unit”:”C”}},”time”:”2017-01-22T13:00:00.123+02:00″,”source”:{“id”:”*****”},”type”:”c8y_PTCMeasurement”}’ \
https://iot05.cumulocity.com/measurement/measurements/
(#2 data send Results)おなじように、中ほどの”HTTP/1.1 201 Created”があれば多分コマンドはうまく行ったはず。。。。
(図7)
(図8)
(図9)
Cockpitmニューからも見れます。
数日したほうがデータ推移が見れるかも。。
まあまだ、あいまい部分多いけど。。。。とりあえず。
以上。