我使用 azure.digitaltwins.core.DigitalTwinsClient
和 upsert_digital_twin()
方法成功创建了一个模型的孪生模型,该方法返回如下所示的对象(打印为字典) ):
{
$dtId twin-spc4-4b670a8e-86ec-41b0-84a2-ce092578a0f6
$etag W/"8c491e49-f81f-4c30-b189-1bd45f122d7c"
area {'$metadata': {}}
capacity {'$metadata': {}}
occupancy {'$metadata': {}}
temperature {'$metadata': {}}
humidity {'$metadata': {}}
CO2 {'$metadata': {}}
$metadata {'$model': 'dtmi:digitaltwins:rec_3_3:core:Level;1'}
}
但是,当我尝试使用 get_digital_twin()
方法获取此模型时,出现以下错误:
azure.core.exceptions.ResourceNotFoundError: (DigitalTwinNotFound) There is no digital twin instance that exists with the ID {'$dtId': 'twin-spc4-4b670a8e-86ec-41b0-84a2-ce092578a0f6', '$etag': 'W%2F"8c491e49-f81f-4c30-b189-1bd45f122d7c"', 'area': {'$metadata': {}}, 'capacity': {'$metadata': {}}, 'occupancy': {'$metadata': {}}, 'temperature': {'$metadata': {}}, 'humidity': {'$metadata': {}}, 'CO2': {'$metadata': {}}, '$metadata': {'$model': 'dtmi:digitaltwins:rec_3_3:core:Level;1'}}. Please verify that the twin id is valid and ensure that the twin is not deleted. See section on querying the twins https://aka.ms/adtv2query.
Code: DigitalTwinNotFound
Message: There is no digital twin instance that exists with the ID {'$dtId': 'twin-spc4-4b670a8e-86ec-41b0-84a2-ce092578a0f6', '$etag': 'W%2F"8c491e49-f81f-4c30-b189-1bd45f122d7c"', 'area': {'$metadata': {}}, 'capacity': {'$metadata': {}}, 'occupancy': {'$metadata': {}}, 'temperature': {'$metadata': {}}, 'humidity': {'$metadata': {}}, 'CO2': {'$metadata': {}}, '$metadata': {'$model': 'dtmi:digitaltwins:rec_3_3:core:Level;1'}}. Please verify that the twin id is valid and ensure that the twin is not deleted. See section on querying the twins https://aka.ms/adtv2query.
发生了什么事?我怎样才能找回我创建的双胞胎?
最佳答案
提出支持请求后,我被要求运行查询
SELECT * FROM digitaltwins T where T.$dtId = <model_identifier>
这有效并且专门针对节点。随后运行
SELECT * FROM digitaltwins
显示所有创建的节点。
我的猜测是 ADT 浏览器没有将注意力集中在正确的节点上,这就是我看不到它的原因。
关于python - Azure 数字孪生 Python API - 创建了模型孪生,但无法检索它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70382564/