2017-12-21 16 views
1

私のサーバーには、オリオン・コンテキスト・ブローカーとIoTエージェントがドッキング・コンテナーで動作しています。 MQTTプロトコルを使用してエンティティを登録および更新できます。問題はありません。しかし、IoTエージェントのコマンドシステムを使用してデバイスにコマンドを送信したいと考えています。 Documentationでは、コマンドが登録されると、IoTエージェントは/ apiKey/EntityID/cmdに何かを公開すると言います。しかし、私がそうするとき、私は何も公開していません。エンティティが正しく更新されています(コマンドのステータスがPENDINGになっていることがわかり、すべてがOKであることを示す正のLOGですが、MQTTのトピックには何も公開されていません)。MQTTを使用するiotagent-jsonは、コマンドが送信されたときに何も公開しません。

ここに私のdocker-compose.ymlファイル:

version: '3.3' 
services: 
    iot-mongo: 
     image: mongo:3.2 
     ports: 
     - "27017:27017" 
     volumes: 
     - ./data/mongo:/data/db 


    iot-agent: 
     image: fiware/iotagent-json 
     ports: 
     - "4041:4041" 
     links: 
     - iot-mongo 
     - orion 
     - mosquitto 
     volumes: 
      - ./config.js:/opt/iotajson/config.js 
    mosquitto: 
     image: toke/mosquitto 
     ports: 
      - "1883:1883" 
      - "9001:9001" 
    orion: 
     image: fiware/orion:1.9.0 
     links: 
     - iot-mongo 
     ports: 
     - "1026:1026" 
     command: -dbhost iot-mongo 

私はこのように私のエンティティを作成します。

curl -X POST http://127.23.64.163:4041/iot/devices \ 
-i \ 
-H "Content-Type: application/json" \ 
-H "Fiware-Service: proj" \ 
-H "Fiware-ServicePath: /proj" \ 
-d ' { "devices": [ 
     { "device_id": "iotsensor10", "entity_name": "iotsensor10", "entity_type": "sensorping", "timezone": "America/Santiago", 
     "commands": [ 
      { "name": "ping", "type": "command", "value": ""} 
     ], 
     "attributes": [ 
      { "object_id": "title", "name": "title", "type": "Text" }, 
      { "object_id": "percentage", "name": "percentage", "type": "Text" }     
     ], 
     "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } 
     ] 
    }' 

は、私は、次のコマンドを使用して、私のエンティティを更新することができます。

mosquitto_pub -h 127.23.64.163 -t /1234/iotsensor10/attrs -m '{"title": "mqtttitle", "percentage": "31.5"}' 

と、このようなコマンドを作成:

curl --request POST http://127.23.64.163:1026/v1/updateContext \ 
    -i \ 
-H "Content-Type: application/json" \ 
-H "Accept: application/json" \ 
-H "Fiware-Service: proj" \ 
-H "Fiware-ServicePath: /proj" \ 
-d ' {"updateAction": "UPDATE", "contextElements": [ 
    {"id": "iotsensor10", "type": "sensorping", "isPattern": "false", 
    "attributes": [ 
     {"name": "ping", "type": "command", "value": "ALIVE" } 
    ] 
    } 
]}' 

をし、私が購読:

mosquitto_sub -h 127.23.64.163 -t /# -v 

しかし、私は、コマンドを作成するときに、私は何も来ていない参照してください。

しかし、私は実行する場合:

mosquitto_pub -h 127.23.64.163 -t /1234/iotsensor10/cmdexe -m '{"ping": "kebab"}' 

私は、コマンドを検証し、私のエンティティの結果を見ることができます。私が持っている唯一の問題は、/ apikey/sensor10/cmdに何かが公開されると、コマンドが作成されたときに何も公開されないということです。どのようなアイデアをなぜ、どのように修正するか?

更新1

Iは画像fiware/iotagent-ULと同じ操作を行うことを試みたが、私は正確に同じ結果を有します。何も公開されていません。

答えて

1

問題は、IoTエージェントでデバイスを作成する方法から発生します。トランスポート・フィールド(MQTT)を指定する必要があります。だから、それを動作させるために、私はこのようなデバイスを作成する必要があります。

curl -X POST -H "Fiware-Service: MyService" -H "Fiware-ServicePath: /MyService" -H "Content-Type: application/json" -d '{ 
"devices": [ 
    { 
     "device_id": "iotsensor6", 
     "entity_name": "iotsensor6", 
     "entity_type": "sensorping", 
     "transport": "MQTT", 

"commands": [ { "name": "ping", "type": "command", "value": ""} ], 
     "attributes": [ 
       { "object_id": "title", "name": "title", "type": "text" }, 
       { "object_id": "percentage", "name": "percentage", "type": "text" }     
     ] 
    } 
] 
}' 'http://127.23.64.163:4041/iot/devices' 

を、私は私のコマンドを作成するときに、今、私は、トピック/ 1234/iotsensor6/CMD

で作成したエントリを持っています
関連する問題