사물 유형 - AWS IoT Core

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

사물 유형

사물 유형을 사용하면 동일한 사물 유형과 연결된 모든 사물에 공통된 설명 및 구성 정보를 저장할 수 있습니다. 그러면 사물 레지스트리에서 관리가 간소화됩니다. 예를 들어, 사물 유형을 정의할 수 있습니다. LightBulb 사물 유형과 관련된 모든 사물은 일련 번호, 제조업체, 전력량 등 일련의 속성을 공유합니다. LightBulb 유형의 LightBulb 사물을 만들거나 기존 사물의 유형을 유형으로 변경할 때 사물 유형에 정의된 각 속성의 값을 지정할 수 있습니다. LightBulb LightBulb

사물 유형은 선택 사항이지만 사물 유형을 사용하면 사물을 보다 쉽게 검색할 수 있습니다.

  • 사물 유형이 있는 사물은 최대 50개의 속성을 가질 수 있습니다.

  • 사물 유형이 없는 사물은 최대 3개의 속성을 가질 수 있습니다.

  • 사물은 한 사물 유형에만 연결될 수 있습니다.

  • 계정에서 생성할 수 있는 사물 유형의 수에는 제한이 없습니다.

사물 유형은 변경이 불가능합니다. 사물 유형이 생성된 이후에는 그 이름을 바꿀 수 없습니다. 언제라도 사물 유형을 사용 중지하여 새 사물이 연결되는 것을 방지할 수 있습니다. 또한 연결된 사물이 없는 사물 유형을 삭제할 수 있습니다.

사물 유형 생성

다음과 같이 CreateThingType 명령을 사용하여 사물 유형을 생성할 수 있습니다.

$ aws iot create-thing-type --thing-type-name "LightBulb" --thing-type-properties "thingTypeDescription=light bulb type, searchableAttributes=wattage,model"

CreateThingType 명령은 사물 유형 및 ARN을 포함하는 응답을 반환합니다.

{ "thingTypeName": "LightBulb", "thingTypeId": "df9c2d8c-894d-46a9-8192-9068d01b2886", "thingTypeArn": "arn:aws:iot:us-west-2:123456789012:thingtype/LightBulb" }

사물 유형 목록 표시

다음과 같이 ListThingTypes 명령을 사용하여 사물 유형을 나열할 수 있습니다.

$ aws iot list-thing-types

ListThingTypes 명령은 다음에 정의된 사물 유형의 목록을 반환합니다 AWS 계정.

{ "thingTypes": [ { "thingTypeName": "LightBulb", "thingTypeProperties": { "searchableAttributes": [ "wattage", "model" ], "thingTypeDescription": "light bulb type" }, "thingTypeMetadata": { "deprecated": false, "creationDate": 1468423800950 } } ] }

사물 유형 설명

다음과 같이 DescribeThingType 명령을 사용하여 사물 유형에 대한 정보를 가져올 수 있습니다.

$ aws iot describe-thing-type --thing-type-name "LightBulb"

DescribeThingType 명령은 다음과 같이 지정한 유형에 대한 정보를 반환합니다.

{ "thingTypeProperties": { "searchableAttributes": [ "model", "wattage" ], "thingTypeDescription": "light bulb type" }, "thingTypeId": "df9c2d8c-894d-46a9-8192-9068d01b2886", "thingTypeArn": "arn:aws:iot:us-west-2:123456789012:thingtype/LightBulb", "thingTypeName": "LightBulb", "thingTypeMetadata": { "deprecated": false, "creationDate": 1544466338.399 } }

사물에 사물 유형 연결

사물을 생성할 때는 다음과 같이 CreateThing 명령을 사용하여 사물 유형을 지정할 수 있습니다.

$ aws iot create-thing --thing-name "MyLightBulb" --thing-type-name "LightBulb" --attribute-payload "{\"attributes\": {\"wattage\":\"75\", \"model\":\"123\"}}"

언제라도 UpdateThing 명령을 사용하여 사물과 연결된 사물 유형을 변경할 수 있습니다.

$ aws iot update-thing --thing-name "MyLightBulb" --thing-type-name "LightBulb" --attribute-payload "{\"attributes\": {\"wattage\":\"75\", \"model\":\"123\"}}"

또한 UpdateThing 명령을 사용하여 사물을 사물 유형에서 분리할 수도 있습니다.

사물 유형 사용 중지

사물 유형은 변경이 불가능합니다. 사물 유형은 정의 후에 변경할 수 없습니다. 하지만 언제라도 사물 유형을 사용 중지하여 사용자가 새 사물을 연결하는 것을 방지할 수 있습니다. 사물 유형과 연결된 기존 사물은 변경되지 않습니다.

사물 유형을 사용 중지하려면 DeprecateThingType 명령을 사용합니다.

$ aws iot deprecate-thing-type --thing-type-name "myThingType"

DescribeThingType 명령을 사용하여 결과를 확인할 수 있습니다.

$ aws iot describe-thing-type --thing-type-name "StopLight":
{ "thingTypeName": "StopLight", "thingTypeProperties": { "searchableAttributes": [ "wattage", "numOfLights", "model" ], "thingTypeDescription": "traffic light type", }, "thingTypeMetadata": { "deprecated": true, "creationDate": 1468425854308, "deprecationDate": 1468446026349 } }

사물 유형 사용 중지는 취소 가능한 작업입니다. --undo-deprecate CLI 명령에서 DeprecateThingType 플래그를 사용하여 사용 중지를 실행 취소할 수 있습니다.

$ aws iot deprecate-thing-type --thing-type-name "myThingType" --undo-deprecate

DescribeThingType CLI 명령을 사용하여 결과를 확인할 수 있습니다.

$ aws iot describe-thing-type --thing-type-name "StopLight":
{ "thingTypeName": "StopLight", "thingTypeArn": "arn:aws:iot:us-east-1:123456789012:thingtype/StopLight", "thingTypeId": "12345678abcdefgh12345678ijklmnop12345678" "thingTypeProperties": { "searchableAttributes": [ "wattage", "numOfLights", "model" ], "thingTypeDescription": "traffic light type" }, "thingTypeMetadata": { "deprecated": false, "creationDate": 1468425854308, } }

사물 유형 삭제

사물 유형은 사용 중지한 후에만 삭제할 수 있습니다. 사물 유형을 삭제하려면 DeleteThingType 명령을 사용합니다.

$ aws iot delete-thing-type --thing-type-name "StopLight"
참고

사물 유형을 삭제하려면 사용 중단한 후 5분간 기다려야 합니다.