Reputation: 1
I am trying to implement Google Smart Home Request Sync. Is it normal, that I have to say sync devices once I change the name of the device? Is there a way to force it without saying so? Here is my code:
exports.adduser = functions.https.onRequest(async (request, response) => {
app.requestSync(request.body.token).then((res) => {
firebaseRef.child('devices/' + request.body.token).set([request.body.id,]);
response.status(200).json({ 'status': 'OK' });
}).catch((res) => {
response.status(500).json({ 'status': 'FAILED' });
});
});
Upvotes: 0
Views: 304
Reputation: 538
From the documentation:
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.
Without the SYNC request, a mismatch in device state can occur between Home Graph and the device, which can lead to functionality and reliability issues for users.
Upvotes: 0