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.