0

I am new to Smart Home world and I am trying my hand to implement smart home solution with Google App Engine and Firestore for my cloud service. I have successfully integrated my devices and Smart home solution and able to update the device state using Google assistant and Google Home. After much read through got HomeGraph ReportState also implemented via REST, which is executed during Execute and when the device state changes outside Google home (User changes the fan speed of the Fan).

Now the issue is, when the Execute API is executed, the Firestore database is updated by the API and homegraph report state is invoked and hence data is in sync between them (Both Query responses match). However when the home graph report state is called outside Smarthome system, to update user made changes, the data is out of sync. Home Graph has the latest updates, but Firestore has the last updated state done by Google Assistant.

How to sync HomeGraph and Smart home cloud services, with HomeGraph has the accurate data.

Jeyakumaar
  • 11
  • 3

1 Answers1

1

There are two ways you can ensure the data is synchronized between both Home Graph and your service. One method is to modify the non-Google Home state changes so that they still go through your service. This can be a new intermediate endpoint that you call which will update your database before updating Home Graph, ensuring that you have the state changes.

Alternatively, you can use the Home Graph Query API call, which will return the states of devices from your service according to Home Graph. You will need to call this manually, as there is no way to subscribe to changes.

Nick Felker
  • 11,536
  • 1
  • 21
  • 35
  • Thanks for your response. I am inclined towards the first way you have mentioned. I was hoping there is an automatic sync up process between Home Graph and the Smart home application cloud services as any physical states changes are updated to home graph, but the smart home app is oblivious. Only caveat is that I need to make an create a endpoint to the cloud service level and do an 'Execute' operation from my end, instead of the Google assistant doing it. – Jeyakumaar Aug 26 '20 at 06:08
  • But still not clear what is the point of updating HomeGraph, if it is not going to update my cloud service. Google assistant when asked for the state of the device, it still executes the "QUERY" Intent to my smart home cloud service and returns outdated data. I might as well update my cloud service on state change instead of HomeGraph. – Jeyakumaar Aug 26 '20 at 06:24
  • There's a bit of a forward looking aspect here. We are working to migrate services to trust HomeGraph data in place of sending additional QUERY intents when possible. This is not yet fully implemented, but will reduce the intent traffic to your service if you keep HomeGraph up to date. – devunwired Sep 10 '20 at 22:21
  • Its makes sense since as of now, there is not much impact if we don't update HomeGraph, but for future perspective, when HomeGraph will handle its fair share of QUERY intent, that could alleviate traffic on services. Thanks for clarification – Jeyakumaar Sep 18 '20 at 22:11