iot - IoT-Agent 检查不在 iot 有效负载中的默认属性
问题描述
我有一个测试环境,其中我为 JSON IoT 代理配置了一个服务组,其中包含一个旧表达式:
{
"_id": "60acc2d549e4721ae5087356",
"__v": 0,
"iotagent": "http://10.0.0.2:4062",
"apikey": "apikeyTest2",
"entity_type": "WasteContainer",
"service_path": "/subservice",
"service": "service",
"resource": "/iot/json",
"description": "IoTAgent JSON - Node.js",
"protocol": "IoTA-JSON",
"internal_attributes": [],
"attributes": [
{
"name": "temperature",
"object_id": "t",
"type": "Number"
},
{
"name": "fillingLevel",
"expression": "${@level/100}",
"type": "Number"
}
],
"lazy": [],
"static_attributes": [],
"commands": []
}
除此之外,我手动注册了一个带有“jexl”作为表达式语言的设备:
curl --location --request POST 'https://host/iot/devices' \
--header 'Fiware-Service: service' \
--header 'Fiware-ServicePath: /subservice' \
--header 'X-Auth-Token: gAAAAABgrQm..._R8r98aeNWQ' \
--header 'Content-Type: application/json' \
--data-raw '{
"devices": [
{
"device_id": "deviceJSON1",
"entity_name": "device:entity01",
"entity_type": "device",
"expressionLanguage": "jexl",
"attributes": [
{
"object_id": "b",
"name": "position",
"type": "Number",
"expression": "(a+b)"
}
],
"protocol": "IoTA-JSON",
"transport": "HTTP"
}
]
}
'
然后我使用前一个服务组的 apikey 从设备发送数据,但不使用那里配置的任何属性:
curl --location --request POST 'http://host/iot/json?k=apikeyTest2&i=deviceJSON1&getCmd=0' \
--header 'Content-Type: application/json' \
--data-raw '{
"a": 4,
"b": 5
}'
响应是 400 错误请求:
{
"name": "INVALID_EXPRESSION",
"message": "Invalid expression in evaluation [${@level/100}]"
}
这是预期的结果还是代理应该尝试使用“jexl”来转换有效负载,因为物level
联网数据中没有属性?
为了解决这个问题,我可以创建另一个具有不同 apikey 且没有默认属性的服务组,但只是想知道结果是否符合预期。
解决方案
推荐阅读
- ios - pod install 正在安装在不同的文件夹中
- python - Python导入串行,没有模块名为串行错误
- python - 在浏览器中呈现抓取数据而不存储在数据库中
- android - Android使用循环通知声音播放铃声
- mlr - 如何为嵌套超参数调优的内循环设置一个固定的随机种子?
- .net - 什么是依赖项重建行为?
- javascript - 如何在通常不允许的 mac 应用程序中为粘贴创建服务命令?
- android - UploadTask(Google Play 服务)在进程重启时继续上传
- python - 在 dict 列表中查找重复索引
- docker - 如何从同一个 docker 容器同时运行 neo4j 和 flask webapplication