列出物件 - AWS IoT Core

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

列出物件

您可以使用 ListThings 命令列出您帳戶中的所有物件:

$ aws iot list-things
{ "things": [ { "attributes": { "model": "123", "wattage": "75" }, "version": 1, "thingName": "MyLightBulb" }, { "attributes": { "numOfStates":"3" }, "version": 11, "thingName": "MyWallSwitch" } ] }

您可以使用 ListThings 命令搜尋特定物件類型的所有物件:

$ aws iot list-things --thing-type-name "LightBulb"
{ "things": [ { "thingTypeName": "LightBulb", "attributes": { "model": "123", "wattage": "75" }, "version": 1, "thingName": "MyRGBLight" }, { "thingTypeName": "LightBulb", "attributes": { "model": "123", "wattage": "75" }, "version": 1, "thingName": "MySecondLightBulb" } ] }

您可以使用 ListThings 命令搜尋具特定值之屬性的所有物件。此命令最多可搜尋三個屬性。

$ aws iot list-things --attribute-name "wattage" --attribute-value "75"
{ "things": [ { "thingTypeName": "StopLight", "attributes": { "model": "123", "wattage": "75" }, "version": 3, "thingName": "MyLightBulb" }, { "thingTypeName": "LightBulb", "attributes": { "model": "123", "wattage": "75" }, "version": 1, "thingName": "MyRGBLight" }, { "thingTypeName": "LightBulb", "attributes": { "model": "123", "wattage": "75" }, "version": 1, "thingName": "MySecondLightBulb" } ] }

如需詳細資訊,請參閱《 AWS CLI 命令參考》中的 list-things