[英]Unable to send Southbound data in Fiware IoTAgent LWM2M
When provisioning the Robot example device, the entities are getting created with position_info and position_status attributes but the update Position attribute in Orion is giving an error配置机器人示例设备时,实体正在使用 position_info 和 position_status 属性创建,但 Orion 中的更新 Position 属性给出错误
{"code": "404", "reasonPhrase": "No context element found", "details": "error forwarding update" }
Device provision req:设备配置要求:
curl --location --request POST 'localhost:4041/iot/devices' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'fiware-service: factory' \
--header 'fiware-servicepath: /robots' \
--data-raw '{
"devices": [
{
"device_id": "robot1",
"entity_type": "Robot",
"entity_name": "robot01",
"endpoint": "http://iot-sensors:3001/iot/robot",
"attributes": [
{
"name": "Battery",
"type": "number"
}
],
"lazy": [
{
"name": "Message",
"type": "string"
}
],
"commands": [
{
"name": "Position",
"type": "location"
}
],
"internal_attributes": {
"lwm2mResourceMapping": {
"Battery" : {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 1
},
"Message" : {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 2
},
"Position" : {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 3
}
}
}
}
]
}'
And Update context request:并更新上下文请求:
curl --location --request POST 'http://localhost:1026/v1/updateContext' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'fiware-service: factory' \
--header 'fiware-servicepath: /robots' \
--data-raw '{
"contextElements": [
{
"type": "Robot",
"isPattern": "false",
"id": "Robot:robot1",
"attributes": [
{
"name": "Position",
"type": "location",
"value": "[18,3]"
}
]
}
],
"updateAction": "UPDATE"
}'
As per the documentation, This action should trigger an Execute action in the client.根据文档,此操作应触发客户端中的执行操作。 It should also update the "_status" field of the entity with the "PENDING" value, stating the execution is pending of the client result.
它还应该使用“PENDING”值更新实体的“_status”字段,说明客户端结果的执行处于未决状态。
I also tried to update the Position attribute using v2 but not working:我还尝试使用 v2 更新 Position 属性但不起作用:
curl --location --request PATCH
'http://localhost:1026/v2/entities/robot01/attrs/' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'fiware-service: factory' \
--header 'fiware-servicepath: /robots' \
-d '{
"Position": {
"type" : "location",
"value" : "[18,3]"
}
}'
From Orion documentation :从猎户座文档:
On forwarding, any type of entity in the NGSIv2 update/query matches registrations without entity type.
在转发时,NGSIv2 更新/查询中的任何类型的实体都匹配没有实体类型的注册。 However, the opposite doesn't work, so if you have registrations with types, then you must use
?type
in NGSIv2 update/query in order to obtain a match.但是,相反的情况不起作用,因此如果您注册了类型,那么您必须在 NGSIv2 更新/查询中使用
?type
以获得匹配。 Otherwise you may encounter problems, like the one described in this post at StackOverflow .否则,您可能会遇到问题,例如StackOverflow 上的这篇文章中描述的问题。
I'd suggest to add ?type
to your request.我建议将
?type
添加到您的请求中。 I mean:我是说:
curl --location --request PATCH
'http://localhost:1026/v2/entities/robot01/attrs/?type=Robot' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'fiware-service: factory' \
--header 'fiware-servicepath: /robots' \
-d '{
"Position": {
"type" : "location",
"value" : "[18,3]"
}
}'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.