2015-10-04 33 views
5

這個問題與Missing attributes on Orion CB Entity when registering device through IDAS非常相似,但是在那裏沒有發現確切的答案。Fiware:通過IDAS註冊/發送時Orion CB沒有觀察屬性UltraLight

我一直在試圖通過FiWare IDAS獲得UL2.0在Fiware-Lab的ENV獵戶座CB工作:使用最新的GitHub
https://github.com/telefonicaid/fiware-figway/tree/master/python-IDAS4 腳本

  • 以下特別教程

    我有一個帶有令牌生成的FI-WARE實驗室帳戶。適於config.ini文件:

    [user] 
    # Please, configure here your username at FIWARE Cloud and a valid Oauth2.0 TOKEN for your user (you can use get_token.py to obtain a valid TOKEN). 
    username=MY_USERNAME 
    token=MY_TOKEN 
    
    [contextbroker] 
    host=130.206.80.40 
    port=1026 
    OAuth=no 
    # Here you need to specify the ContextBroker database you are querying. 
    # Leave it blank if you want the general database or the IDAS service if you are looking for IoT devices connected by you. 
    # fiware_service= 
    fiware_service=bus_auto 
    fiware-service-path=/ 
    
    [idas] 
    host=130.206.80.40 
    adminport=5371 
    ul20port=5371 
    OAuth=no 
    # Here you need to configure the IDAS service your devices will be sending data to. 
    # By default the OpenIoT service is provided. 
    # fiware-service=fiwareiot 
    fiware-service=bus_auto 
    fiware-service-path=/ 
    #apikey=4jggokgpepnvsb2uv4s40d59ov 
    apikey=4jggokgpepnvsb2uv4s40d59ov 
    
    [local] 
    #Choose here your System type. Examples: RaspberryPI, MACOSX, Linux, ... 
    host_type=MACOSX 
    # Here please add a unique identifier for you. Suggestion: the 3 lower hexa bytes of your Ethernet MAC. E.g. 79:ed:af 
    # Also you may use your e-mail address. 
    host_id=a0:11:00 
    

    我用SENSOR_TEMP模板,加入 '協議' 字段(PDI-IOTA-超輕其作爲第一個問題,我偶然發現):

    { 
    "devices": [ 
        { "device_id": "DEV_ID", 
         "entity_name": "ENTITY_ID", 
         "entity_type": "thing", 
         "protocol": "PDI-IoTA-UltraLight", 
         "timezone": "Europe/Amsterdam", 
    "attributes": [ 
         { "object_id": "otemp", 
          "name": "temperature", 
          "type": "int" 
         } ], 
    "static_attributes": [ 
         { "name": "att_name", 
          "type": "string", 
          "value": "value" 
         } 
         ] 
         } 
        ] 
        } 
    

    現在我可以註冊設備好。像

    python RegisterDevice.py SENSOR_TEMP NexusPro Temp-Otterlo 
    

    ,並看到它在設備列表:

    python ListDevices.py 
    

    我可以把諸如此類的觀察

    python SendObservation.py Temp-Otterlo 'otemp|17' 
    

    但在ContextBroker我看到實體,但從來沒有測量,例如

    python GetEntity.py Temp-Otterlo 
    

    給人

    * Asking to http://130.206.80.40:1026/ngsi10/queryContext 
    * Headers: {'Fiware-Service': 'bus_auto', 'content-type': 'application/json', 'accept': 'application/json', 'X-Auth-Token': 'NULL'} 
    * Sending PAYLOAD: 
    { 
        "entities": [ 
         { 
          "type": "", 
          "id": "Temp-Otterlo", 
          "isPattern": "false" 
         } 
        ], 
        "attributes": [] 
    } 
    
    ... 
    
    * Status Code: 200 
    * Response: 
    { 
        "contextResponses" : [ 
        { 
         "contextElement" : { 
         "type" : "thing", 
         "isPattern" : "false", 
         "id" : "Temp-Otterlo", 
         "attributes" : [ 
          { 
          "name" : "TimeInstant", 
          "type" : "ISO8601", 
          "value" : "2015-10-03T14:04:44.663133Z" 
          }, 
          { 
          "name" : "att_name", 
          "type" : "string", 
          "value" : "value", 
          "metadatas" : [ 
           { 
           "name" : "TimeInstant", 
           "type" : "ISO8601", 
           "value" : "2015-10-03T14:04:44.663500Z" 
           } 
          ] 
          } 
         ] 
         }, 
         "statusCode" : { 
         "code" : "200", 
         "reasonPhrase" : "OK" 
         } 
        } 
        ] 
    } 
    

    我得到一個TimeInstant屬性奇怪。我嘗試使用.ini的設置玩弄fiware-service = fiwareiot,但無濟於事。我沒有想法。目錄中的文檔。對於IDAS4 正在討論意見將被髮送到端口8002並設置「OpenIoT」服務,但也失敗了。

    任何幫助表示讚賞。

  • +0

    您是否嘗試過使用不同的獵戶座上下文經紀人? (例如,你自己的)。 – LeandroGuillen

    +0

    還沒有,因爲它可能是一個常見問題(請參閱http://stackoverflow.com/questions/31051501/missing-attributes-on-orion-cb-entity-when-registering-device-through-idas)。例如, OCB版本的問題? –

    +0

    它絕對可以。嘗試使用最新版本的OCB(截至今日0.24)。 – LeandroGuillen

    回答

    0

    您應該運行「python SendObservation.py NexusPro'otemp | 17'」而不是「python SendObservation.py Temp-Otterlo'otemp | 17'」。

    原因是你在南行提供了一個觀測值,然後應該使用DEV_ID。

    實體不包含屬性,直到收到觀察結果,然後這是正常的,你無法看到它。一旦你嘗試上面的一個應該都可以工作。

    乾杯,

    +0

    也嘗試過設備ID,但結果相同:通過CB的實體中沒有值。 –