Twin Class

The state information for a device or module. This is implicitly created and deleted when the corresponding device/ module identity is created or deleted in the IoT Hub.

Inheritance
Twin

Constructor

Twin(**kwargs)

Parameters

device_id
str
Required

The unique identifier of the device in the identity registry of the IoT Hub. It is a case-sensitive string (up to 128 char long) of ASCII 7-bit alphanumeric chars, and the following special characters {'-', ':', '.', '+', '%', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}.

module_id
str
Required

The unique identifier of the module in the identity registry of the IoT Hub. It is a case-sensitive string (up to 128 char long) of ASCII 7-bit alphanumeric chars, and the following special characters {'-', ':', '.', '+', '%', '_', '#', '*', '?', '!', '(', ')', ',', '=', '@', ';', '$', '''}.

tags
dict[str, object]
Required

The collection of key-value pairs read and written by the solution back end. They are not visible to device apps. They keys are UTF-8 encoded, case-sensitive and up-to 1KB in length. Allowed characters exclude UNICODE control characters (segments C0 and C1), '.', '$' and space. The values are JSON objects, up-to 4KB in length.

properties
TwinProperties
Required

The desired and reported properties of the twin.

etag
str
Required

The string representing a ETag for the device twin, as per RFC7232.

version
<xref:long>
Required

The version for the device twin including tags and desired properties

device_etag
str
Required

The string representing a ETag for the device, as per RFC7232.

status
str or <xref:protocol.models.enum>
Required

The enabled status of the device. If disabled, the device cannot connect to the service. Possible values include: 'enabled', 'disabled'

status_reason
str
Required

The reason for the current status of the device, if any.

status_update_time
datetime
Required

The date and time when the status of the device was last updated.

connection_state
str or <xref:protocol.models.enum>
Required

The connection state of the device. Possible values include: 'Disconnected', 'Connected'

last_activity_time
datetime
Required

The date and time when the device last connected or received or sent a message. The date and time is sepecified in ISO8601 datetime format in UTC, for example, 2015-01-28T16:24:48.789Z. This value is not updated if the device uses the HTTP/1 protocol to perform messaging operations.

cloud_to_device_message_count
int
Required

The number of cloud-to-device messages sent.

authentication_type
str or <xref:protocol.models.enum>
Required

The authentication type used by the device. Possible values include: 'sas', 'selfSigned', 'certificateAuthority', 'none'

x509_thumbprint
X509Thumbprint
Required

The X509 thumbprint of the device.

capabilities
DeviceCapabilities
Required
device_scope
str
Required

The scope of the device.

parent_scopes
list[str]
Required

The scopes of the upper level edge devices if applicable. Only available for edge devices.