简体   繁体   English

无法在 IoT Agent Fiware 中注册命令

[英]Cannot register commands in IoT Agent Fiware

I'm using IoT Agent with Ultralight run directly (not as a dockerized component).我正在使用直接运行 Ultralight 的 IoT 代理(而不是作为 dockerized 组件)。 I'm able to register new device, which is mapped in Orion Context Broker.我能够注册在 Orion Context Broker 中映射的新设备。 However I have an issue with registering Actuators which require commands within configuration data.但是,我在注册需要配置数据中的命令的执行器时遇到问题。 I use:我用:

curl -iX POST \
  'http://MYIP:4061/iot/devices' \
  -H 'Content-Type: application/json' \
  -H 'fiware-service: openiot' \
  -H 'fiware-servicepath: /' \
  -d '{
  "devices": [
    {
      "device_id": "lamp003",
      "entity_name": "urn:ngsi-ld:Lamp:003",
      "entity_type": "Lamp",
      "protocol": "PDI-IoTA-UltraLight",
      "transport": "MQTT",
      "commands": [
        {"name": "on","type": "command"},
        {"name": "off","type": "command"}
       ]}
  ]
}

And in response I'm hit with:作为回应,我受到了打击:

op=IoTAgentNGSI.DeviceProvisioning | op=IoTAgentNGSI.DeviceProvisioning | from=n/a |来自=n/a | srv=n/a | srv=n/a | subsrv=n/a |订阅服务器=不适用 | msg=Device provisioning failed due to the following error: | msg=由于以下错误,设备配置失败:| comp=IoTAgent Request error connecting to the Context Broker: {"code":"400","reasonPhrase":"Bad Request","details":"missing isDomain value for registration attribute"} comp=IoTAgent 连接到 Context Broker 的请求错误:{"code":"400","reasonPhrase":"Bad Request","details":"missing isDomain value for registration attribute"}

I tried adding "isDomain": "false" to elements of command table, but no luck.我尝试将“isDomain”:“false”添加到命令表的元素,但没有运气。 It used to work before and furthermore similar solution is presented on official guide .它以前可以工作,并且在官方指南中提供了类似的解决方案。

isDomain part of the deprecated NGSI-v1 syntax. isDomain已弃用的 NGSI-v1 语法的一部分。 It is not used in NGSI-v2 or NGSI-LD它不用于NGSI-v2NGSI-LD

I think you may be running the IoT Agent as NGSI-v1.我认为您可能将 IoT 代理作为 NGSI-v1 运行。 You'll need to set contextBroker.ngsiVersion in your config.js or set the following Env variable in Docker or Docker-compose.您需要在config.js中设置contextBroker.ngsiVersion在 Docker 或 Docker-compose 中设置以下 Env 变量

IOTA_CB_NGSI_VERSION=v2
config.js
{
    host: '192.168.56.101',
    port: '1026',
    ngsiVersion: 'v2'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM