Index
Methods
getProxyInfo
-
getProxyInfo
is called by app to get information about the hub / bridge controlling this end-device.Parameters
-
id: string
Device ID of end device that is being controlled by the hub.
Returns ProxyInfo
-
getRegisteredDevices
-
Returns the list of registered devices.
Returns RegisteredDevice[]
markPending
-
markPending
is called by the app when app is done handling an intent, but the actual operation (usually EXECUTE command) is still not done. This enables Google Home to respond back to the user in a timely fashion. This may be useful for somewhat long running operations. Returns a promise.Parameters
-
request: IntentRequest
Original intent request that should be marked pending.
-
Optional response: IntentResponse
Pending response to the intent request.
Returns Promise<void>
-
reportState
-
reportState
is called by app to report the changed state for the device. In the case of BLE Seamless Setup, it should be called whenever the app receives a BLE notification in ParseNotificationHandler.Parameters
-
state: Payload
the latest state of the device
Returns undefined
-
send
-
send
is called by app when it needs to communicate with a device. Depending upon the protocol used by the device, the app constructs a DataFlow.CommandRequest object and passes it as an argument. Returns a promise that resolves to DataFlow.CommandSuccess. Response may return data, if it was a read request.See also BleRequestData, HttpRequestData, TcpRequestData, UdpRequestData
Parameters
-
command: CommandRequest
Command to communicate with the device.
-
Optional sendOptions: SendOptions
Options for
send
API. See SendOptions.
Returns Promise<CommandSuccess>
Promise that resolves to DataFlow.CommandSuccess
-
sendAndWait
-
sendAndWait
allows the app to wait for notification in the same promise chain. But if the app uses a transformFunc, the resolved result could be anything. If transformFunc is not specified, the promise will be resolved with DataFlow.CommandSuccess type.Parameters
-
command: CommandRequest
Command to communicate with the device.
-
options: NotificationOptions
Options for
sendAndWait
API. See NotificationOptions.
Returns Promise<unknown | CommandSuccess>
Promise that resolves to anything. It resolves to DataFlow.CommandSuccess if transformFunc is not specified in options.
-
This class provides access to the devices managed by the local home platform. Applications can use this interface to send and receive commands with a locally identified device using the send method.
localHomeApp.getDeviceManager() .send(deviceCommand) .then((result) => { // Handle command success }) .catch((err: IntentFlow.HandlerError) => { // Handle command error });