0
votes

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.

1

1 Answers

1
votes

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.