Search code examples
azureazure-iot-hub

IoT Hub device twin query returns incorrect result on lastActivityTime property


I've been seeing some strange behaviour in the Device Twin of the Azure IoT Hub and was wondering if anyone else ran into the same problem. I have the following device twin configuration:

enter image description here

Sorry, I didn't want to display the full deviceId for security reasons, but believe me, they are identical as the next query/pictureIf I query: select id, lastActivityTime from c where deviceId = 'bad...(the rest of the deviceId)'

Then I get the following result:

enter image description here

Why is the date so different?

When I literaly perform a 'select * from c where deviceId = bad...' I get an identical JSON as when I look in the device twin itself, except for the lastActivityTime...

Any idea why the lastActivityTime is such a different date?


Solution

  • We have an update from Microsoft on this issue, It is recommended that we do not use 'LastActivityTime', instead, make use of EventGrid notifications for connect or disconnect notifications. Below is the quote...

    LastActivityTime is not reliable. It is currently best effort and sometimes may not even be updated.

    We recommend to customers to not rely on LastActivityTime, and to use EventGrid notifications for connect/disconnect notifications.

    We are very aware of the issue and are investigating a long term solution to this problem.

    Hopefully, We will come up with a long-term solution for this issue, sorry for any inconvenience caused.