You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法通过Orion-LD上下文代理下发南向命令问题排查

无法通过Orion-LD上下文代理发送南向命令

问题概述

直接通过IoT Agent发送设备命令可正常执行,但通过Orion-LD上下文代理发送南向命令时失败,提示实体或属性未找到。

相关配置

1. 服务组配置

curl -iX POST 'http://localhost:4041/iot/services' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-H 'Content-Type: application/json' \
--data-raw '{
    "services": [
        {
            "apikey": "4jggokgpepnvsb2uv4s40d59ov",
            "entity_type": "LightFixture",
            "resource": ""
        }
    ]
}'

2. 执行器配置

curl -L -X POST 'http://localhost:4041/iot/devices' \
    -H 'fiware-service: openiot' \
    -H 'fiware-servicepath: /' \
    -H 'Content-Type: application/json' \
--data-raw '{
    "devices": [
        {
            "device_id": "LightFixture00",
            "entity_name": "urn:ngsi-ld:LightFixture:00",
            "entity_type": "LightFixture",
            "protocol": "PDI-IoTA-JSON",
            "transport": "MQTT",
            "commands": [
                {
                    "name": "on",
                    "type": "command"
                },
                {
                    "name": "off",
                    "type": "command"
                }
            ],
            "static_attributes": [
                {
                    "name": "refPole",
                    "type": "Relationship",
                    "value": "urn:ngsi-ld:Pole:0"
                }
            ]
        }
    ]
}'

3. 直接通过IoT Agent发送命令(正常执行)

curl -L -X PATCH 'http://localhost:4041/ngsi-ld/v1/entities/urn:ngsi-ld:LightFixture:00/attrs/on' \
    -H 'fiware-service: openiot' \
    -H 'fiware-servicepath: /' \
    -H 'Content-Type: application/json' \
--data-raw '{
        "type": "Property",
        "value": ""
}'

4. 通过Orion-LD发送命令(执行失败)

curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:LightFixture:00/attrs/on' \
-H 'NGSILD-Tenant: openiot' \
-H 'Content-Type: application/json' \
--data-raw '{
        "type": "Property",
        "value": ""
}'

报错信息

msg=***** ERROR Entity/Attribute not found: Entity 'urn:ngsi-ld:LightFixture:00', Attribute 'on'

实体查询结果(初始状态)

查询实体时发现,实体中未包含on和off命令属性,仅存在命令状态与结果属性:

{
    "id": "urn:ngsi-ld:LightFixture:00",
    "type": "LightFixture",
    "refPole": {
        "object": "urn:ngsi-ld:Pole:0",
        "type": "Relationship",
        "observedAt": "2022-08-15T01:44:00.605Z"
    },
    "on_status": {
        "value": {
            "@type": "commandStatus",
            "@value": "OK"
        },
        "type": "Property",
        "observedAt": "2022-08-15T01:24:07.900Z"
    },
    "on_info": {
        "value": {
            "@type": "commandResult",
            "@value": ""
        },
        "type": "Property",
        "observedAt": "2022-08-15T01:24:07.900Z"
    },
    "off_status": {
        "value": {
            "@type": "commandStatus",
            "@value": "OK"
        },
        "type": "Property",
        "observedAt": "2022-08-15T01:44:00.605Z"
    },
    "off_info": {
        "value": {
            "@type": "commandResult",
            "@value": ""
        },
        "type": "Property",
        "observedAt": "2022-08-15T01:44:00.605Z"
    }
}

上下文源注册信息

上下文源注册记录中正常包含on、off属性:

[
    {
        "id": "urn:ngsi-ld:ContextSourceRegistration:...",
        "type": "ContextSourceRegistration",
        "endpoint": "http://iot-agent:4041",
        "information": [
            {
                "entities": [
                    {
                        "id": "urn:ngsi-ld:LightFixture:00",
                        "type": "LightFixture"
                    }
                ],
                "properties": [
                    "on",
                    "off"
                ]
            }
        ]
    }
]

更新IoT Agent至1.24.0版本后的情况

更新后实体查询结果中出现on和off属性,但格式与教程预期不符:

教程预期格式

"on": {
        "type": "command",
        "value": ""
    },
    "off": {
        "type": "command",
        "value": ""
    }

实际返回格式

"on": {
        "type": "Property",
        "value": {
            "@type": "command",
            "@value": ""
        }
    },
    "off": {
        "type": "Property",
        "value": {
            "@type": "command",
            "@value": ""
        }
    }

此时通过Orion-LD发送命令仍报相同错误:

msg=***** ERROR Entity/Attribute not found: Entity 'urn:ngsi-ld:LightFixture:00', Attribute 'on' (https://uri=etsi=org/ngsi-ld/default-context/on) (status code: 404)

内容的提问来源于stack exchange,提问作者T.R

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 14:29:09