boltup_im_coding
boltup_im_coding

Reputation: 6665

Do we know why a Nest update occurs?

I am using the Android SDK for Nest, but I believe this is a general Nest question so I did not tag this question with Android.

When registering a GlobalUpdate listener, I cannot find any API to tell me why it was called, or what changed. The documentation says,

GlobalUpdate contains the state of all devices, structures and metadata in the Nest account when a change is detected in anything

It would be nice if there was a field to know what that change was. Is there a better way than tracking all of the data myself and comparing it?

Upvotes: 0

Views: 63

Answers (1)

Ryan Seys
Ryan Seys

Reputation: 264

Hi I'm the author of the Nest Android SDK. This SDK (and the Nest API itself) provides the entire state (and omits saying what changes were made) every time for a number of reasons:

  1. Clients may have older (or newer!) data than what the server has, so stating the changes would result in the client incorrectly determining the "true" state.

  2. This design ensures that everyone (all clients and the server) become eventually consistent, and haven't combined changes in an order that results in up to date clients with different states.

You can always calculate the changes yourself and update your UI state accordingly, but every event that your client receives should be independent of each other and shouldn't depend on assumed knowledge of the prior state.

Upvotes: 1

Related Questions