首页 文章

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

提问于
浏览
2

我正在开发一个 Fiware 系统,我不知道如何通过 IDAS iot-agent 从设备发送测量 .

我有Orion和Cygnus正在运行,但是我直接向Orion发送带有servlet的措施,我想将进程切换到 IDAS iot-agent .

我已经正确地创建了服务和设备,但是我从设备到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来发送措施?

谢谢 .

EDIT:

我尝试从命令行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连接:关闭Content-Length:88 {“reason”:“不支持的媒体类型(仅支持application / xml和application / json)”}

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

EDIT

我可以将值发送到此网址:

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":[]}]}

但猎户座没有得到任何东西

EDIT:

这是一个版本问题,现在我安装了最新版本的iot-agent和UltraLight模块以及带有“协议”的设备:“PDI-IoTA-UltraLight”,协议本身正在运行 .

但我不知道从设备发布措施的正确网址是什么 . 有帮助吗?

1 回答

  • 3

    您是否尝试过之前尝试过的相同网址,但使用-H“Content-Type:application / json”?

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

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

相关问题