Welcome to the Google Home Developer Center, the new destination for learning how to develop smart home actions.
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-11-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Incorrect information","incorrectInformation","thumb-down"],["Not enough information/samples","notEnoughInformationSamples","thumb-down"],["Too complicated","tooComplicated","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-11-04 UTC."],[],[]]
Callback registered with the App via App.onExecute to process requests to update device state.
To support local fulfillment, the local home platform must first establish a local fulfillment path. For more details, see the developer guide.
const executeHandler = (request: IntentFlow.ExecuteRequest): Promise<IntentFlow.ExecuteResponse> => { // Extract command(s) and device target(s) from request const command = request.inputs[0].payload.commands[0]; const execution = command.execution[0]; const response = new Execute.Response.Builder() .setRequestId(request.requestId); const result = command.devices.map((device) => { // Construct a local device command const deviceCommand = new DataFlow.TcpRequestData(); // ... // Send command to the local device return localHomeApp.getDeviceManager() .send(deviceCommand) .then((result) => { response.setSuccessState(result.deviceId, state); }) .catch((err: IntentFlow.HandlerError) => { // Please specify the right error code in setErrorState() response.setErrorState( device.id, IntentFlow.ExecuteErrorCode.HARD_ERROR); }); }); // Respond once all commands complete return Promise.all(result) .then(() => response.build()); };