We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I need to run a query on my firestore database at executeHandler before I run this.app.getDeviceManager().send(deviceCommand).
This will give me timeout errors sometimes as below.
Is there a way I can set the timeout more than 1500ms?
The following is my code of executeHandler:
executeHandler(request: IntentFlow.ExecuteRequest): Promise<IntentFlow.ExecuteResponse> { // TODO: Implement local execution console.log("EXECUTE intent: " + JSON.stringify(request, null, 2));
const command = request.inputs[0].payload.commands[0]; const execution = command.execution[0]; const response = new Execute.Response.Builder().setRequestId(request.requestId); const promises: Array<Promise<void>> = command.devices.map(async (device) => { console.log("Handling EXECUTE intent for device: " + JSON.stringify(device)); // Convert execution params to a string for the local device const params = execution.params as IFireplaceParams; const tcpMsg = 'MWIB2,02'; const payload = this.stringToHex(tcpMsg); const firebaseDataObj = await this.queryFirebase(device.id); console.log("firebaseDataObj:", JSON.stringify(firebaseDataObj)); // Construct a local device command over TCP const deviceCommand = new DataFlow.TcpRequestData(); deviceCommand.requestId = request.requestId; deviceCommand.deviceId = device.id; deviceCommand.data = payload; deviceCommand.port = SERVER_PORT; deviceCommand.operation = Constants.TcpOperation.WRITE; try { const result = await this.app.getDeviceManager().send(deviceCommand); console.log("Sending deviceCommand result:", JSON.stringify(result)); const state = { online: true }; response.setSuccessState(result.deviceId, Object.assign(state, params)); } catch (err) { err.errorCode = err.errorCode || 'invalid_request'; response.setErrorState(device.id, err.errorCode); console.error('An error occurred sending the command', err.errorCode); } }); return Promise.all(promises) .then(() => { return response.build(); }) .catch((e) => { const err = new IntentFlow.HandlerError(request.requestId, 'invalid_request', e.message); return Promise.reject(err); });
}
The text was updated successfully, but these errors were encountered:
@fanwu8184 can you confirm how you use the data returned by firebase, I don't see firebaseDataObj being used in the command snippet you've pasted.
firebaseDataObj
If you need data associated to a device during EXECUTE handler, the best practice is to return per-device customData in the cloud fulfillment SyncResponse, see https://developers.google.com/assistant/smarthome/develop/local#update_sync_response_in_the_cloud_fulfillment
EXECUTE
customData
SyncResponse
Sorry, something went wrong.
No branches or pull requests
I need to run a query on my firestore database at executeHandler before I run this.app.getDeviceManager().send(deviceCommand).
This will give me timeout errors sometimes as below.
Is there a way I can set the timeout more than 1500ms?
The following is my code of executeHandler:
executeHandler(request: IntentFlow.ExecuteRequest): Promise<IntentFlow.ExecuteResponse> {
// TODO: Implement local execution
console.log("EXECUTE intent: " + JSON.stringify(request, null, 2));
}
The text was updated successfully, but these errors were encountered: