上下文代理忽略值、fiware orion 和 iotagent
Context broker is ignoring value, fiware orion and iotagent
猎户座版本:2.3.0
iotagent-ul 版本:1.12.0
我在 mqtt 上使用 fiware 和 iotagent。我想向一些具有不同值的设备发送命令。我已经关注 https://github.com/FIWARE/tutorials.IoT-over-MQTT 并阅读了一些文档。
在提供服务组(使用 apikey:123456)和执行器之后,我可以按照 iota URL :
发送带有值的命令
curl -iX POST \
'http://localhost:4041/iot/devices' \
-H 'Content-Type: application/json' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-d '{
"devices": [
{
"device_id": "dev001",
"entity_name": "urn:ngsi-ld:Device:001",
"entity_type": "Device",
"protocol": "PDI-IoTA-UltraLight",
"transport": "MQTT",
"commands": [
{"name": "date","type": "command", "value": {"hour": 9, "minute": 31, "second": 0}}
]
}
]
}
'
iota 将 mqtt 消息发布到:/123456/dev001/cmd 有效载荷 dev001@date|hour=9|minute=31|second=0
但是当使用上下文代理时,该值被忽略:
curl -iX PATCH \
'http://localhost:1026/v2/entities/urn:ngsi-ld:Device:001/attrs' \
-H 'Content-Type: application/json' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-d '{
"date": {
"type" : "command",
"value" : {"hour": 9, "minute": 31, "second": 0}
}
}'
在这里,iota 发布一条 mqtt 消息到:/123456/dev001/cmd 有效载荷 dev001@date|
为什么会被忽略?我做错了什么吗?
抱歉我的英语不好。
我找到了一个解决方案...在 url 中添加类型使上下文考虑值...很奇怪。
最后的url必须是:
curl -iX PATCH \
'http://localhost:1026/v2/entities/urn:ngsi-ld:Device:001/attrs?type=Device' \
-H 'Content-Type: application/json' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-d '{
"date": {
"type" : "command",
"value" : {"hour": 9, "minute": 31, "second": 0}
}
}'
编辑:
知道解决方案后,我试图理解问题并发现了这个问题:https://github.com/telefonicaid/fiware-orion/issues/3647
According to CPrs and request forwarding documentation
On forwarding, any type of entity in the NGSIv2 update/query matches
registrations without entity type. 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. Otherwise you may
encounter problems, like the one described in this post at
Whosebug.
编辑 2:
这是一个副本:
猎户座版本:2.3.0 iotagent-ul 版本:1.12.0
我在 mqtt 上使用 fiware 和 iotagent。我想向一些具有不同值的设备发送命令。我已经关注 https://github.com/FIWARE/tutorials.IoT-over-MQTT 并阅读了一些文档。 在提供服务组(使用 apikey:123456)和执行器之后,我可以按照 iota URL :
发送带有值的命令curl -iX POST \
'http://localhost:4041/iot/devices' \
-H 'Content-Type: application/json' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-d '{
"devices": [
{
"device_id": "dev001",
"entity_name": "urn:ngsi-ld:Device:001",
"entity_type": "Device",
"protocol": "PDI-IoTA-UltraLight",
"transport": "MQTT",
"commands": [
{"name": "date","type": "command", "value": {"hour": 9, "minute": 31, "second": 0}}
]
}
]
}
'
iota 将 mqtt 消息发布到:/123456/dev001/cmd 有效载荷 dev001@date|hour=9|minute=31|second=0
但是当使用上下文代理时,该值被忽略:
curl -iX PATCH \
'http://localhost:1026/v2/entities/urn:ngsi-ld:Device:001/attrs' \
-H 'Content-Type: application/json' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-d '{
"date": {
"type" : "command",
"value" : {"hour": 9, "minute": 31, "second": 0}
}
}'
在这里,iota 发布一条 mqtt 消息到:/123456/dev001/cmd 有效载荷 dev001@date|
为什么会被忽略?我做错了什么吗?
抱歉我的英语不好。
我找到了一个解决方案...在 url 中添加类型使上下文考虑值...很奇怪。
最后的url必须是:
curl -iX PATCH \
'http://localhost:1026/v2/entities/urn:ngsi-ld:Device:001/attrs?type=Device' \
-H 'Content-Type: application/json' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-d '{
"date": {
"type" : "command",
"value" : {"hour": 9, "minute": 31, "second": 0}
}
}'
编辑:
知道解决方案后,我试图理解问题并发现了这个问题:https://github.com/telefonicaid/fiware-orion/issues/3647
According to CPrs and request forwarding documentation
On forwarding, any type of entity in the NGSIv2 update/query matches registrations without entity type. 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. Otherwise you may encounter problems, like the one described in this post at Whosebug.
编辑 2:
这是一个副本: