我正在尝试使用 2 个组件 Orion 和 LoRaWAN IoT Agent 来配置设备并发送回驱动命令。
我在 docker-compose 文件上运行 Orion 和其他组件,物联网代理使用node bin/iotagent-lora
我已使用以下方法成功配置了设备:
curl -iX POST \
'http://localhost:4061/iot/devices' \
-H 'Content-Type: application/json' \
-H 'fiware-service: agriculture' \
-H 'fiware-servicepath: /irrigation' \
-d '{
"devices": [
{
"device_id": "pycom1",
"entity_name": "urn:ngsi-ld:tempHumid:001",
"entity_type": "tempHumid",
"transport": "MQTT",
"attributes": [
{
"object_id": "temperature",
"name": "deviceState",
"type": "Text"
}],
"commands": [
{
"name": "on",
"type": "command"
},
{
"name": "off"
,"type": "command"
}
],
"internal_attributes": {
"lorawan": {
"application_server": {
"host": "10.8.244.180",
"username": "admin",
"password": "admin",
"provider": "loraserver.io"
},
"dev_eui": "0097da62c6b67443",
"app_eui": "70B3D57ED000985F",
"application_id": "1",
"application_key": "2b043fb00af7c6ac4075a35b8a18fc9c",
"data_model":"application_server"
}}}]}'
配置设备后,会在 Orion 中创建自动注册:
{
"id": "5d2d9f4f795d881c2355ab7c",
"expires": "2020-07-16T09:56:31.00Z",
"dataProvided": {
"entities": [{
"id": "urn:ngsi-ld:tempHumid:001",
"type": "tempHumid"
}],
"attrs": ["on", "off"]
},
"provider": {
"http": {
"url": "http://localhost:4061"
},
"supportedForwardingMode": "all",
"legacyForwarding": true
},
"status": "active"
}
在本教程之后,我为执行命令创建了另一个注册,如下所示:
curl -iX POST \
'http://localhost:1026/v2/registrations' \
-H 'Content-Type: application/json' \
-H 'fiware-service: agriculture' \
-H 'fiware-servicepath: /irrigation' \
-d '{
"description": "Pump Commands",
"dataProvided": {
"entities": [
{
"id": "urn:ngsi-ld:tempHumid:001",
"type": "tempHumid"
}
],
"attrs": [ "on", "off" ]
},
"provider": {
"http": {"url": "http://localhost:1026/v1"},
"legacyForwarding": true
}
}'
我尝试使用建议的解决方案来解决与我面临的问题类似的问题,在尝试之后,我得到了这个错误:
{"error":"NotFound","description":"The requested entity has not been found. Check type and id"}
而猎户座报告
fiware-orion 开始交易到http://localhost:4061//updateContext
我不知道它是否与这个问题有关,但这里已经报告了一个类似的错误(url 中的双斜杠)
fiware-orion | INFO@10:16:34 logMsg.h[1844]: Starting transaction to http://localhost:4061//updateContext
fiware-orion | INFO@10:16:34 httpRequestSend.cpp[592]: Sending message 4 to HTTP server: sending message of 447 bytes to HTTP server
fiware-orion | ERROR@10:16:34 postUpdateContext.cpp[190]: Runtime Error (error 'Couldn't connect to server' forwarding 'Update' to providing application)
fiware-orion | INFO@10:16:34 logMsg.h[1874]: Transaction ended
先感谢您