Websocket timestamp vs. API timestamp

I’ve recently been looking at the timestamp in the websocket JSON and the API JSON in detail, and I have noticed that there is a small offset. For example, when I receive the latest websocket JSON:

[1532461846, 1010.4, 25.3, 54, 0, 0, 2.99, 1]

the latest API JSON looks like:

[1532461800, 1010.4, 25.3, 54, 0, 0, 2.99, 1]

In other words the websocket JSON is 46 seconds ahead of the API JSON. I think the issue is that the timestamp in the API JSON is rounded to the last whole minute, whilst the websocket timestamp is not. Can anyone confirm is this is expected behavior? Does the websocket timestamp reflect exactly the time the observation was taken? (@corrineb)

The REST API does pull from the database and I have found the timestamp does not return the seconds.

2 Likes

Hey @peter,

You are correct! The API snaps the observation to the last whole minute. The time that is transmitted via websocket is the observation time recorded by the hub. This is the expected behavior of both services.

2 Likes

Great! That’s good to know. Thanks for clarifying.

1 Like