azure iot-hub device twin 删除所需的属性
azure iot-hub device twin remove desired properties
以下是我的设备孪生负载,我错误地向其中添加了 "someKey" 属性。
{
desired: {
"state": {
"processor": "running",
"light": "on"
},
"someKey": "someValue"
}
}
我想永久删除 "someKey" 属性 表格 JSON 双胞胎。
从孪生 JSON
中删除 "someKey"
将空值分配给 "someKey",然后仅将其从设备孪生中删除 JSON。
{
desired: {
"state": {
"processor": "running",
"light": "on"
},
"someKey": null
}
}
所以下次您将收到如下 JSON
{
desired: {
"state": {
"processor": "running",
"light": "on"
}
}
}
发件人:https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-device-twins#back-end-operations
设备操作
设备操作
The device app operates on the device twin using the following atomic operations:
Partially update reported properties. This operation enables the partial update of the reported properties of the currently connected device. This operation uses the same JSON update format that the solution back end uses for a partial update of desired properties.
然后在后端操作
Partially update device twin. This operation enables the solution back end to partially update the tags or desired properties in a device twin. The partial update is expressed as a JSON document that adds or updates any property. Properties set to null are removed. The following example creates a new desired property with value {"newProperty": "newValue"}
, overwrites the existing value of existingProperty
with "otherNewValue"
, and removes otherOldProperty
. No other changes are made to existing desired properties or tags:
{
"properties": {
"desired": {
"newProperty": {
"nestedProperty": "newValue"
},
"existingProperty": "otherNewValue",
"otherOldProperty": null
}
}
}
(...)
以下是我的设备孪生负载,我错误地向其中添加了 "someKey" 属性。
{
desired: {
"state": {
"processor": "running",
"light": "on"
},
"someKey": "someValue"
}
}
我想永久删除 "someKey" 属性 表格 JSON 双胞胎。
从孪生 JSON
中删除 "someKey"将空值分配给 "someKey",然后仅将其从设备孪生中删除 JSON。
{
desired: {
"state": {
"processor": "running",
"light": "on"
},
"someKey": null
}
}
所以下次您将收到如下 JSON
{
desired: {
"state": {
"processor": "running",
"light": "on"
}
}
}
发件人:https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-device-twins#back-end-operations
设备操作
设备操作
The device app operates on the device twin using the following atomic operations:
Partially update reported properties. This operation enables the partial update of the reported properties of the currently connected device. This operation uses the same JSON update format that the solution back end uses for a partial update of desired properties.
然后在后端操作
Partially update device twin. This operation enables the solution back end to partially update the tags or desired properties in a device twin. The partial update is expressed as a JSON document that adds or updates any property. Properties set to null are removed. The following example creates a new desired property with value
{"newProperty": "newValue"}
, overwrites the existing value ofexistingProperty
with"otherNewValue"
, and removesotherOldProperty
. No other changes are made to existing desired properties or tags:
{
"properties": {
"desired": {
"newProperty": {
"nestedProperty": "newValue"
},
"existingProperty": "otherNewValue",
"otherOldProperty": null
}
}
}
(...)