# - [smarthome](https://developers.home.google.com/reference/local-home/modules/smarthome.html).
- DeviceManager

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](https://developers.home.google.com/reference/local-home/interfaces/smarthome.devicemanager#send) method.

    localHomeApp.getDeviceManager()
      .send(deviceCommand)
      .then((result) => {
        // Handle command success
      })
      .catch((err: IntentFlow.HandlerError) => {
        // Handle command error
      });

## Index

### Methods

- [getProxyInfo](https://developers.home.google.com/reference/local-home/interfaces/smarthome.devicemanager#getproxyinfo)
- [getRegisteredDevices](https://developers.home.google.com/reference/local-home/interfaces/smarthome.devicemanager#getregistereddevices)
- [markPending](https://developers.home.google.com/reference/local-home/interfaces/smarthome.devicemanager#markpending)
- [reportState](https://developers.home.google.com/reference/local-home/interfaces/smarthome.devicemanager#reportstate)
- [send](https://developers.home.google.com/reference/local-home/interfaces/smarthome.devicemanager#send)
- [sendAndWait](https://developers.home.google.com/reference/local-home/interfaces/smarthome.devicemanager#sendandwait)

## Methods

### getProxyInfo

- getProxyInfo ( id : string ) : [ProxyInfo](https://developers.home.google.com/reference/local-home/interfaces/smarthome.proxyinfo)
- `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](https://developers.home.google.com/reference/local-home/interfaces/smarthome.proxyinfo)

### getRegisteredDevices

- getRegisteredDevices ( ) : [RegisteredDevice](https://developers.home.google.com/reference/local-home/interfaces/smarthome.intentflow.registereddevice) \[\]
- Returns the list of registered devices.

  #### Returns [RegisteredDevice](https://developers.home.google.com/reference/local-home/interfaces/smarthome.intentflow.registereddevice)\[\]

### markPending

- markPending ( request : [IntentRequest](https://developers.home.google.com/reference/local-home/modules/smarthome.html#intentrequest) , response ? : [IntentResponse](https://developers.home.google.com/reference/local-home/modules/smarthome.html#intentresponse) ) : Promise \< void \>
- `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](https://developers.home.google.com/reference/local-home/modules/smarthome.html#intentrequest)

    Original intent request that should be marked pending.
  -

    ##### Optional response: [IntentResponse](https://developers.home.google.com/reference/local-home/modules/smarthome.html#intentresponse)

    Pending response to the intent request.

  #### Returns Promise\<void\>

### reportState

- reportState ( state : [Payload](https://developers.home.google.com/reference/local-home/interfaces/smarthome.reportstate.response.payload) ) : undefined
- `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](https://developers.home.google.com/reference/local-home/modules/smarthome.intentflow.html#parsenotificationhandler).

  #### Parameters

  -

    ##### state: [Payload](https://developers.home.google.com/reference/local-home/interfaces/smarthome.reportstate.response.payload)

    the latest state of the device

  #### Returns undefined

### send

- send ( command : [CommandRequest](https://developers.home.google.com/reference/local-home/modules/smarthome.dataflow.html#commandrequest) , sendOptions ? : [SendOptions](https://developers.home.google.com/reference/local-home/interfaces/smarthome.sendoptions) ) : Promise \< [CommandSuccess](https://developers.home.google.com/reference/local-home/interfaces/smarthome.dataflow.commandsuccess) \>
- `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](https://developers.home.google.com/reference/local-home/modules/smarthome.dataflow.html#commandrequest) object and passes it as an argument.
  Returns a promise that resolves to [DataFlow.CommandSuccess](https://developers.home.google.com/reference/local-home/interfaces/smarthome.dataflow.commandsuccess). Response
  may return data, if it was a read request.

  See also [BleRequestData](https://developers.home.google.com/reference/local-home/classes/smarthome.dataflow.blerequestdata.html), [HttpRequestData](https://developers.home.google.com/reference/local-home/classes/smarthome.dataflow.httprequestdata.html), [TcpRequestData](https://developers.home.google.com/reference/local-home/classes/smarthome.dataflow.tcprequestdata.html),
  [UdpRequestData](https://developers.home.google.com/reference/local-home/classes/smarthome.dataflow.udprequestdata.html)

  #### Parameters

  -

    ##### command: [CommandRequest](https://developers.home.google.com/reference/local-home/modules/smarthome.dataflow.html#commandrequest)

    Command to communicate with the device.
  -

    ##### Optional sendOptions: [SendOptions](https://developers.home.google.com/reference/local-home/interfaces/smarthome.sendoptions)

    Options for `send` API. See [SendOptions](https://developers.home.google.com/reference/local-home/interfaces/smarthome.sendoptions).

  #### Returns Promise\<[CommandSuccess](https://developers.home.google.com/reference/local-home/interfaces/smarthome.dataflow.commandsuccess)\>

  Promise that resolves to [DataFlow.CommandSuccess](https://developers.home.google.com/reference/local-home/interfaces/smarthome.dataflow.commandsuccess)

### sendAndWait

- sendAndWait ( command : [CommandRequest](https://developers.home.google.com/reference/local-home/modules/smarthome.dataflow.html#commandrequest) , options : [NotificationOptions](https://developers.home.google.com/reference/local-home/interfaces/smarthome.notificationoptions) ) : Promise \< unknown \| [CommandSuccess](https://developers.home.google.com/reference/local-home/interfaces/smarthome.dataflow.commandsuccess) \>
- `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](https://developers.home.google.com/reference/local-home/modules/smarthome.dataflow.html#commandrequest)

    Command to communicate with the device.
  -

    ##### options: [NotificationOptions](https://developers.home.google.com/reference/local-home/interfaces/smarthome.notificationoptions)

    Options for `sendAndWait` API. See
    [NotificationOptions](https://developers.home.google.com/reference/local-home/interfaces/smarthome.notificationoptions).

  #### Returns Promise\<unknown \| [CommandSuccess](https://developers.home.google.com/reference/local-home/interfaces/smarthome.dataflow.commandsuccess)\>

  Promise that resolves to anything. It resolves to
  [DataFlow.CommandSuccess](https://developers.home.google.com/reference/local-home/interfaces/smarthome.dataflow.commandsuccess) if transformFunc is not specified in
  options.