列出事物 - 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