Fiware iotagent:如何从设备发送测量值?

Fiware iotagent: How to send measure from a device?

我正在开发一个 Fiware 系统,但我不知道如何通过 IDAS iot-agent.

从设备发送测量值

我有 Orion 和 Cygnus 运行,但我将带有 servlet 的度量直接发送到 Orion,我想将进程切换到 IDAS iot-agent

我已经正确创建了服务和设备,但我仍然坚持使用从设备到物联网代理的 POST。

我的设备创建如下:

{ "device_id" : "0010", "entity_name" : "0010", "entity_type" : "xxxxx", "timezone" : "Europe/Madrid", "attributes" : [ { "object_id" : "0010", "name" : "fecha", "type" : "timestamp", "name" : "coord_x", "type" : "double", "name" : "coord_y", "type" : "double", "name" : "coderr", "type" : "string", "name" : "s_temp", "type" : "double", "name" : "s_hum", "type" : "double", "name" : "num_sat", "type" : "int", "name" : "voltaje", "type" : "double", "name" : "inicio", "type" : "int" } ], "service" : "xxxxx", "service_path" : "/xxxxx" }

从设备发送措施POST如何?

谢谢。

编辑:

我尝试从命令行 POST 进行如下测试:

curl -X POST xxxxxxxxxxxx:8080/iot/d?i=0010 \ -i \ -H "Content-Type: application/text" \ -H "Fiware-Service: xxxxxx" \ -H "Fiware-ServicePath: /xxxxxx" \ -d "s_temp|25"

这是回复:

HTTP/1.1 415 Connection: close Content-Length: 88 {"reason": "Unsupported Media Type (only support application/xml and application/json)"}

现在的问题是...如果我安装了 iot-agent-base 和 iot-agent-ul,为什么我无法 POST 发短信?我错过了一些配置吗?

编辑:

我可以向此发送值 url:

http://xxxxxxxx:8080/iot/xx?k=xxxxxxx&i=xxxxxxxx#fecha|1#coord_x|1#coord_y|1#coderr|1#s_temp|1#s_hum|1#s_temp|1#num_sat|1#voltaje|1#inicio|1

这是回复

DEBUG - Accept: */*
DEBUG - End filters status 200
DEBUG - Proccessing in handle /iot
DEBUG - iota::AdminService::error_response 0
DEBUG - finish connection 2
DEBUG - Get statistics /iot/ngsi Counters 0
INFO - Agent Activity {"statistics":[{"resource":"/iot/ngsi","data":[]}]}

但是 Orion 没有得到任何东西

编辑:

这是一个版本问题,现在我安装了带有 UltraLight 模块的最新版本的 iot-agent 和带有 "protocol":"PDI-IoTA-UltraLight" 的设备并且协议本身正在运行。

但我不知道设备的正确 url 到 post 测量值是什么。有帮助吗?

您是否尝试过与之前相同的 URL 但使用 -H "Content-Type: application/json"?

即使正文是 UL2.0,内容类型也应设置为 JSON。

如果这能解决您的问题,请告诉我。 感谢您使用 IDAS!