Search code examples
azureazure-iot-hubwindows-iot-core-10

DeviceTwin timestamps


I submitted UpdateReportedPropertiesAsync doesn't update the Device Twin timestamps in azure-iot-sdk-csharp's github, but I wonder if maybe I just don't know something and I decided to ask here as well.

Is there documentation explaining when IoT Hub Device Twin's statusUpdateTime, connectionState, and lastActivityTime are updated?


My problem:

I have a device that periodically updates reported properties using DeviceClient's UpdateReportedPropertiesAsync but the timestamps stay empty:

"statusUpdateTime": "0001-01-01T00:00:00",
"connectionState": "Connected",
"lastActivityTime": "0001-01-01T00:00:00",

Solution

  • Is there documentation explaining when IoT Hub Device Twin's statusUpdateTime, connectionState, and lastActivityTime are updated?

    You can reference "Device identity properties" part.

    enter image description here

    I have a device that periodically updates reported properties using DeviceClient's UpdateReportedPropertiesAsync but the timestamps stay empty:

    It seems an issue of old SDK and it has already been fixed. I use Microsoft.Azure.Devices.Client 1.18.0, it works for me. You can have a try.

                TwinCollection reportedProperties = new TwinCollection();
                reportedProperties["DateTimeLastDesiredPropertyChangeReceived"] = DateTime.Now;
    
                await deviceClient.UpdateReportedPropertiesAsync(reportedProperties).ConfigureAwait(false);
    

    enter image description here