# node-poweredup Class: ControlPlusHub

# Class: ControlPlusHub

## ControlPlusHub

#### new ControlPlusHub()

  The ControlPlusHub is emitted if the discovered device is a Control+ Hub.

  Source:
    - hubs/controlplushub.js, line 14

### Extends

- LPF2Hub
- Hub

### Methods

#### connect()

  Connect to the Hub.

  Inherited From:
    - Hub#connect
  Overrides:
    - Hub#connect
  Source:
    - hubs/basehub.js, line 151

  ##### Returns:

  Resolved upon successful connect.

  Type
    Promise

#### createVirtualPort(firstPortName, secondPortName)

  Combines two ports with into a single virtual port.

  Note: The devices attached to the ports must be of the same device type.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `firstPortName` | string | First port name
  `secondPortName` | string | Second port name

  Inherited From:
    - LPF2Hub#createVirtualPort
  Source:
    - hubs/lpf2hub.js, line 90

  ##### Returns:

  Resolved upon successful issuance of command.

  Type
    Promise

#### disconnect()

  Disconnect the Hub.

  Inherited From:
    - Hub#disconnect
  Source:
    - hubs/basehub.js, line 165

  ##### Returns:

  Resolved upon successful disconnect.

  Type
    Promise

#### getDeviceAtPort(portName)

  Retrieves the device attached to a given port.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `portName` | string | The name of the port to retrieve the device from.

  Inherited From:
    - Hub#getDeviceAtPort
  Source:
    - hubs/basehub.js, line 173

  ##### Returns:

  The device attached to the port.

  Type
    Device | undefined

#### getDevices()

  Retrieves all attached devices.

  Inherited From:
    - Hub#getDevices
  Source:
    - hubs/basehub.js, line 213

  ##### Returns:

  Array of all attached devices.

  Type
    Array.<Device>

#### getDevicesByType(deviceType)

  Retrieves an array of devices of the specified type.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `deviceType` | number | The device type to lookup.

  Inherited From:
    - Hub#getDevicesByType
  Source:
    - hubs/basehub.js, line 221

  ##### Returns:

  Array of all devices of the specified type.

  Type
    Array.<Device>

#### setName(name)

  Set the name of the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | string | New name of the hub (14 characters or less, ASCII only).

  Inherited From:
    - LPF2Hub#setName
  Source:
    - hubs/lpf2hub.js, line 61

  ##### Returns:

  Resolved upon successful issuance of command.

  Type
    Promise

#### shutdown()

  Shutdown the Hub.

  Inherited From:
    - LPF2Hub#shutdown
  Source:
    - hubs/lpf2hub.js, line 53

  ##### Returns:

  Resolved upon successful disconnect.

  Type
    Promise

#### sleep(delay)

  Sleep a given amount of time.

  Note: This is a helper method to make it easier to add delays into a chain of commands.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `delay` | number | How long to sleep (in milliseconds).

  Inherited From:
    - Hub#sleep
  Source:
    - hubs/basehub.js, line 266

  ##### Returns:

  Resolved after the delay is finished.

  Type
    Promise

#### wait(commands)

  Wait until a given list of concurrently running commands are complete.

  Note: This is a helper method to make it easier to wait for concurrent commands to complete.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `commands` | Array.<Promise.<any>> | Array of executing commands.

  Inherited From:
    - Hub#wait
  Source:
    - hubs/basehub.js, line 279

  ##### Returns:

  Resolved after the commands are finished.

  Type
    Promise

#### waitForDeviceAtPort(portName)

  Retrieves the device attached to a given port, waiting until one is attached if there isn't one.

  Note: If a device is never attached, the returned promise may never resolve.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `portName` | string | The name of the port to retrieve the device from.

  Inherited From:
    - Hub#waitForDeviceAtPort
  Source:
    - hubs/basehub.js, line 188

  ##### Returns:

  Resolved once a device is attached, or resolved immediately if a device is already attached.

  Type
    Promise

#### waitForDeviceByType(deviceType)

  Retrieves the first device attached of the specified type, waiting until one is attached if there isn't one.

  Note: If a device is never attached, the returned promise may never resolve.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `deviceType` | number | The device type to lookup.

  Inherited From:
    - Hub#waitForDeviceByType
  Source:
    - hubs/basehub.js, line 230

  ##### Returns:

  Resolved once a device is attached, or resolved immediately if a device is already attached.

  Type
    Promise

### Events

#### attach

  Emits when a device is attached to the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `device` | Device |

  Inherited From:
    - Hub#event:attach
  Source:
    - hubs/basehub.js, line 321

#### button

  Emits when a button is pressed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `button` | string |
  `state` | ButtonState |

  Inherited From:
    - LPF2Hub#event:button
  Source:
    - hubs/lpf2hub.js, line 182

#### detach

  Emits when a device is detached from the Hub.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `device` | Device |

  Inherited From:
    - Hub#event:detach
  Source:
    - hubs/basehub.js, line 338

#### disconnect

  Emits when the hub is disconnected.

  Inherited From:
    - Hub#event:disconnect
  Source:
    - hubs/basehub.js, line 81

#### Search results