0

I created a smart home action and I have to implement the requestSync feature for certification. But I don't understand from where to call it : from my backend fulfillment ? or from elsewhere ?. In the documentation, I saw :

You must trigger a SYNC request:

- If the user adds a new device.
- If the user removes an existing device.
- If the user renames an existing device.
- If you implement a new device type, trait, or add a new device feature.

But all these user interactions are from the Google side (in the Google Home app), so I don't understand why Google doesn't trigger the sync itself, and how could my backend know that the user changed something ?

Can someone help me with this feature ? Thank you !

Ju-liette
  • 3
  • 2

1 Answers1

0

But I don't understand from where to call it : from my backend fulfillment ? or from elsewhere ?

It definitely should come from backend.

But all these user interactions are from the Google side (in the Google Home app), so I don't understand why Google doesn't trigger the sync itself, and how could my backend know that the user changed something ?

This isn't a case to use the "requestSync". And your backend doesn't need to know about it if your users operate their devices from Google Home app

Here I will explain some example use case for you. Imagine that you have your own application for controlling your devices. Then you develop the smarthome action project to make your device be able to controlled over voice. When your devices are linked with HomeGraph and you change your device's name, add or remove it from your own application. This is the time that your backend system should make "requestSync".

Even if your system doesn't allow user to make such of those changes on the device unless using Google Home app, google requires your system to be able to send them the "requestSync" for the case that when you "Implement a new device type, trait, or add a new device feature". This is the way that allows you(as developer) to update your users' devices without them(your users) unlinking and relinking their account.

And if you are not clear about "Implement a new device type, trait, or add a new device feature". Just thinking of case that you want to add more traits for your devices and you want to make update on all devices that has been linked before to be able to use a functionality from your new trait. You will need "rquestSync"

Hope this help. Goodluck :)

  • Thank you very much for your answer. Indeed, for now user can't make such changes unless using Google Home app. But how can I show google I am able to send the requestSync ? Just need to make a method and not to use it ? For now, I fail the requestSync test in google home test suite. I don't know how to see the changes in the Google side from my backend. – Ju-liette Aug 02 '22 at 13:55
  • I am try my best to answer your question but please keep in mind that my answer may not the best and correct way since I have never done something a bit tricky like this before. So I assumed that normally your code should retrieve device information from some source such as database and then create the "Sync" respond payload base on that information. When your test suite runs to the "requestSync" test, you can just simply change your device name in the database and manually send the "requestSync" with agentUserId of your target account. This should make you get passed the test result. – Anukoon Suchinda Aug 02 '22 at 14:31