question

terrifficsvs-5121 avatar image
0 Votes"
terrifficsvs-5121 asked MatthijsvdVeer edited

connectionStateUpdatedTime key-value pair is missing in IOT Hub device twin

Hi

As per the documentation
https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-identity-registry#:~:text=and%20child%20relationships.-,status,For%20this%20reason%2C%20it%20shouldn%27t%20be%20used%20in%20production%20scenarios.,-Note

connectionStateUpdatedTime is missing in our iot hub device twin in azure portal, but the same appears as a microsoft device explorer app dashboard column when clicked on device management option. Can you please let us know why it is not displaying as part of device twin json

Regards
Pavan

azure-iot-hub
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MatthijsvdVeer avatar image
2 Votes"
MatthijsvdVeer answered MatthijsvdVeer edited

Hi there,
The connectionStateUpdatedTime is not part of the device twin, but it is part of the device identity. These two entities have overlapping properties (for instance ConnectionState/LastActivityTime/Status), but connectionStateUpdatedTime is exclusive to the device identity.

You can retrieve the device identity using the CLI:

 az iot hub device-identity show --device-id TestDevice -n iot-hub-name

SDK (C# example):

 var registryManager = RegistryManager.CreateFromConnectionString("connectionString");
 var device = await registryManager.GetDeviceAsync("TestDevice");

Or the REST API (source):

 https://fully-qualified-iothubname.azure-devices.net/devices/TestDevice?api-version=2020-05-31-preview
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.