首页 文章

从sth-comet中检索数据时出错为空值

提问于
浏览
2

首先,我使用此脚本注册服务

curl -H“内容类型:application / json”-H“Fiware-Service:cairoUniversity”-H“Fiware-ServicePath:/ FCI / ICDL”\ http://xxX:4041/ioot/services-d'{ “services”:[{“apikey”:“api1”,“cbroker”:“http://0.0.0.0:1026”,“entity_type”:“Camps”,“resource”:“/ iot / d”}] }”

然后我用这个注册设备

curl http:// XXXX:4041 / iot / devices \ -H“内容类型:application / json”-H“Fiware-Service:cairoUniversity”-H“Fiware-ServicePath:/ FCI / ICDL”\ -d' {“devices”:[{“device_id”:“smartmeter2”,“entity_name”:“ICDL2”,“entity_type”:“Camps”,“protocol”:“PDI-IoTA-UltraLight”,“timezone”:“Europe /马德里“,”属性“:[{”object_id“:”c“,”name“:”Conscemption“,”type“:”int“}]}]}'

然后我订阅orion

curl -X POST -H“Content-Type:application / json”-H“Accept:application / json”-H“Fiware-Service:cairoUniversity”\ -H“Fiware-ServicePath:/ FCI / ICDL”-H“ Cache-Control:no-cache“-d”{“entities”:[{“type”:“Camps”,“isPattern”:“false”,“id”:“ICDL2”}],>“attributes”:[ “Conscemption”],“reference”:“http:// XXXX:8666 / notify”,“duration”:“P1M”,“notifyConditions”:[{“type”:“ONCHANGE”,“condValues”:[“Conscemption “]}]}'”http:// XXXX:1026 / v1 / subscribeContext“}

之后我发送观察

curl“http://X.X.X.X:7896 / iot / d?k = api1&i = smartmeter2”-d'c | 47'-H“Content-type:text / plain”

最后从某人那里检索数据

curl -X GET 'http:// XXXX:8666 / STH / v1 / contextEntities / type / Camps / id / ICDL / attributes / Conscemption?aggrMethod = min&aggrPeriod = day&dateFrom = 2015-01-28T00%3A00%3A00&dateTo = 2018 -01-01T23%3A59%3A59'\ -H'接受:application / json'\ -H'缓存控制:no-cache'\ -H'内容类型:application / json'\ -H'fiware-service :cairoUniversity'\ -H'wareware-servicepath:/ FCI / ICDL'| python -mjson.tool}

我得到了回复

“contextResponses”:[{“contextElement”:{“attributes”:[{“name”:“Conscemption”,“values”:[]}],“id”:“ICDL”,“isPattern”:false,“键入“:”Camps“},”statusCode“:{”code“:”200“,”reasonPhrase“:”OK“}}]

这个日志

sth-comet |时间= 2017-09-04T14:26:44.782Z | lvl = INFO | corr = n / a | trans = n / a | op = OPER_STH_SERVER_LOG | from = n / a | srv =不适用| subsrv = n / a | comp = STH | msg =一切正常,在过去的60s间隔中出现了0个请求sth-comet |时间= 2017-09-04T14:27:44.787Z | lvl = INFO | corr = n / a | trans = n / a | op = OPER_STH_SERVER_LOG | from = n / a | srv =不适用| subsrv = n / a | comp = STH | msg =一切正常,在过去的60s间隔中出现了0个请求sth-comet |时间= 2017-09-04T14:27:52.834Z | lvl = WARN | corr = 99577e81-bbd4-4130-95f6-a9d029f84db0 | trans = 99577e81-bbd4-4130-95f6-a9d029f84db0 | op = OPER_STH_GET | from = n / a | srv =开罗大学| subsrv = / FCI / ICDL | comp = STH | > msg =获取用于检索的聚合数据集合时出错(该集合可能不存在)sth-comet |时间= 2017-09-04T14:28:44.792Z | lvl = INFO | corr = n / a | trans = n / a | op = OPER_STH_SERVER_LOG | from = n / a | srv =不适用| subsrv = n / a | comp = STH | msg =一切正常,在过去的60s间隔中出现了0个请求sth-comet |时间= 2017-09-04T14:29:44.797Z | lvl = INFO | corr = n / a | trans = n / a | op = OPER_STH_SERVER_LOG | from = n / a | srv =不适用| subsrv = n / a | comp = STH | msg =一切正常,在过去的60s间隔中出现了0个请求sth-comet |时间= 2017-09-04T14:30:44.805Z | lvl = INFO | corr = n / a | trans = n / a | op = OPER_STH_SERVER_LOG | from = n / a | srv =不适用| subsrv = n / a | comp = STH | msg =一切正常,在过去的60s间隔中出现了0个请求sth-comet |时间= 2017-09-04T14:31:44.811Z | lvl = INFO | corr = n / a | trans = n / a | op = OPER_STH_SERVER_LOG | from = n / a | srv =不适用| subsrv = n / a | comp = STH | msg =一切正常,在过去的60s间隔内有0个请求

这个问题怎么可能解决呢?

1 回答

  • 1

    根据您发布的日志,通知永远不会到达SHT服务,这就是为什么您在获取聚合数据集合以进行检索时收到msg =错误(集合可能不存在)所以问题看起来与您创建的方式有关猎户座的实体 .

    我注意到你已经创建了一个名为ICDL2的实体,在这个实体中你包含属性“name”:“Conscemption”,“type”:“int”但是从不包含“value”属性,所以当你发送数据时它永远不会在该实体中更新 .

    其次,以这种方式将数据发送到您的设备"curl " http://X.X.X.X:7896/iot/d?k=api1&i=smartmeter2 " -d 'c|47' -H " Content-type:text / plain " but as I told you before the value '47' will never be written in the entity because it is not created, you put the trigger associate to the value " name ": " Conscemption“但它永远不会改变,因为没有属性值 .

    因此,管理您的实体和订阅ORION似乎是一个问题,您可以找到有关如何在ORION中创建和更新实体以及如何进行一些测试的更多信息:https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv1/index.html#introduction . 在您确定Orion向您发送通知后,您可以在STH彗星中查看您的数据 . 此外,如果您有关于软件产品的问题,您可以在https://jira.fiware.org中发布问题,并直接回答每个软件组件的团队 .

相关问题