## Classes
PoweredUPEventEmitter
WeDo2SmartHubHub
BoostMoveHubLPF2Hub
PUPHubLPF2Hub
PUPRemoteLPF2Hub
DuploTrainBaseLPF2Hub
## Typedefs
HubType
DeviceType
Color
ButtonState
DuploTrainBaseSound
## PoweredUP ⇐ EventEmitter **Kind**: global class **Extends**: EventEmitter * [PoweredUP](#PoweredUP) ⇐ EventEmitter * [.scan()](#PoweredUP+scan) * [.stop()](#PoweredUP+stop) * [.getConnectedHubByUUID(uuid)](#PoweredUP+getConnectedHubByUUID) ⇒ Hub \| null * [.getConnectedHubs()](#PoweredUP+getConnectedHubs) ⇒ Array.<Hub> * ["discover" (hub)](#PoweredUP+event_discover) ### poweredUP.scan() Begin scanning for Powered UP Hub devices. **Kind**: instance method of [PoweredUP](#PoweredUP) ### poweredUP.stop() Stop scanning for Powered UP Hub devices. **Kind**: instance method of [PoweredUP](#PoweredUP) ### poweredUP.getConnectedHubByUUID(uuid) ⇒ Hub \| null Retrieve a Powered UP Hub by UUID. **Kind**: instance method of [PoweredUP](#PoweredUP) | Param | Type | | --- | --- | | uuid | string | ### poweredUP.getConnectedHubs() ⇒ Array.<Hub> Retrieve a list of Powered UP Hubs. **Kind**: instance method of [PoweredUP](#PoweredUP) ### "discover" (hub) Emits when a Powered UP Hub device is found. **Kind**: event emitted by [PoweredUP](#PoweredUP) | Param | Type | | --- | --- | | hub | [WeDo2SmartHub](#WeDo2SmartHub) \| [BoostMoveHub](#BoostMoveHub) \| [PUPHub](#PUPHub) \| [PUPRemote](#PUPRemote) \| [DuploTrainBase](#DuploTrainBase) | ## WeDo2SmartHub ⇐ Hub **Kind**: global class **Extends**: Hub * [WeDo2SmartHub](#WeDo2SmartHub) ⇐ Hub * [new WeDo2SmartHub()](#new_WeDo2SmartHub_new) * [.name](#Hub+name) * [.uuid](#Hub+uuid) * [.rssi](#Hub+rssi) * [.batteryLevel](#Hub+batteryLevel) * [.setName(name)](#WeDo2SmartHub+setName) ⇒ Promise * [.setLEDColor(color)](#WeDo2SmartHub+setLEDColor) ⇒ Promise * [.setLEDRGB(red, green, blue)](#WeDo2SmartHub+setLEDRGB) ⇒ Promise * [.setMotorSpeed(port, speed, [time])](#WeDo2SmartHub+setMotorSpeed) ⇒ Promise * [.rampMotorSpeed(port, fromSpeed, toSpeed, time)](#WeDo2SmartHub+rampMotorSpeed) ⇒ Promise * [.playTone(frequency, time)](#WeDo2SmartHub+playTone) ⇒ Promise * [.setLightBrightness(port, brightness, [time])](#WeDo2SmartHub+setLightBrightness) ⇒ Promise * [.connect()](#Hub+connect) ⇒ Promise * [.disconnect()](#Hub+disconnect) ⇒ Promise * [.subscribe(port, [mode])](#Hub+subscribe) ⇒ Promise * [.unsubscribe(port)](#Hub+unsubscribe) ⇒ Promise * [.sleep(delay)](#Hub+sleep) ⇒ Promise * [.wait(commands)](#Hub+wait) ⇒ Promise * [.getHubType()](#Hub+getHubType) ⇒ [HubType](#HubType) * [.getPortDeviceType(port)](#Hub+getPortDeviceType) ⇒ [DeviceType](#DeviceType) * ["button" (button, state)](#WeDo2SmartHub+event_button) * ["distance" (port, distance)](#WeDo2SmartHub+event_distance) * ["color" (port, color)](#WeDo2SmartHub+event_color) * ["tilt" (port, x, y)](#WeDo2SmartHub+event_tilt) * ["rotate" (port, rotation)](#WeDo2SmartHub+event_rotate) * ["attach" (port, type)](#Hub+event_attach) * ["detach" (port)](#Hub+event_detach) ### new WeDo2SmartHub() The WeDo2SmartHub is emitted if the discovered device is a WeDo 2.0 Smart Hub. ### weDo2SmartHub.name **Kind**: instance property of [WeDo2SmartHub](#WeDo2SmartHub) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | name | string | Name of the hub | ### weDo2SmartHub.uuid **Kind**: instance property of [WeDo2SmartHub](#WeDo2SmartHub) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | uuid | string | UUID of the hub | ### weDo2SmartHub.rssi **Kind**: instance property of [WeDo2SmartHub](#WeDo2SmartHub) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | rssi | number | Signal strength of the hub | ### weDo2SmartHub.batteryLevel **Kind**: instance property of [WeDo2SmartHub](#WeDo2SmartHub) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | batteryLevel | number | Battery level of the hub (Percentage between 0-100) | ### weDo2SmartHub.setName(name) ⇒ Promise Set the name of the Hub. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | Description | | --- | --- | --- | | name | string | New name of the hub (14 characters or less, ASCII only). | ### weDo2SmartHub.setLEDColor(color) ⇒ Promise Set the color of the LED on the Hub via a color value. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | color | [Color](#Color) | ### weDo2SmartHub.setLEDRGB(red, green, blue) ⇒ Promise Set the color of the LED on the Hub via RGB values. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | red | number | | green | number | | blue | number | ### weDo2SmartHub.setMotorSpeed(port, speed, [time]) ⇒ Promise Set the motor speed on a given port. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved upon successful completion of command. If time is specified, this is once the motor is finished. | Param | Type | Description | | --- | --- | --- | | port | string | | | speed | number | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. | | [time] | number | How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. | ### weDo2SmartHub.rampMotorSpeed(port, fromSpeed, toSpeed, time) ⇒ Promise Ramp the motor speed on a given port. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved upon successful completion of command. | Param | Type | Description | | --- | --- | --- | | port | string | | | fromSpeed | number | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. | | toSpeed | number | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. | | time | number | How long the ramp should last (in milliseconds). | ### weDo2SmartHub.playTone(frequency, time) ⇒ Promise Play a tone on the Hub's in-built buzzer **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved upon successful completion of command (ie. once the tone has finished playing). | Param | Type | Description | | --- | --- | --- | | frequency | number | | | time | number | How long the tone should play for (in milliseconds). | ### weDo2SmartHub.setLightBrightness(port, brightness, [time]) ⇒ Promise Set the light brightness on a given port. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved upon successful completion of command. If time is specified, this is once the light is turned off. | Param | Type | Description | | --- | --- | --- | | port | string | | | brightness | number | Brightness value between 0-100 (0 is off) | | [time] | number | How long to turn the light on (in milliseconds). Leave empty to turn the light on indefinitely. | ### weDo2SmartHub.connect() ⇒ Promise Connect to the Hub. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Overrides**: [connect](#Hub+connect) **Returns**: Promise - Resolved upon successful connect. ### weDo2SmartHub.disconnect() ⇒ Promise Disconnect the Hub. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved upon successful disconnect. ### weDo2SmartHub.subscribe(port, [mode]) ⇒ Promise Subscribe to sensor notifications on a given port. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | Description | | --- | --- | --- | | port | string | | | [mode] | number | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. | ### weDo2SmartHub.unsubscribe(port) ⇒ Promise Unsubscribe to sensor notifications on a given port. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | port | string | ### weDo2SmartHub.sleep(delay) ⇒ Promise Sleep a given amount of time. This is a helper method to make it easier to add delays into a chain of commands. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved after the delay is finished. | Param | Type | Description | | --- | --- | --- | | delay | number | How long to sleep (in milliseconds). | ### weDo2SmartHub.wait(commands) ⇒ Promise Wait until a given list of concurrently running commands are complete. This is a helper method to make it easier to wait for concurrent commands to complete. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) **Returns**: Promise - Resolved after the commands are finished. | Param | Type | Description | | --- | --- | --- | | commands | Array.<Promise.<any>> | Array of executing commands. | ### weDo2SmartHub.getHubType() ⇒ [HubType](#HubType) Get the hub type. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) ### weDo2SmartHub.getPortDeviceType(port) ⇒ [DeviceType](#DeviceType) Get the device type for a given port. **Kind**: instance method of [WeDo2SmartHub](#WeDo2SmartHub) | Param | Type | | --- | --- | | port | string | ### "button" (button, state) Emits when a button is pressed. **Kind**: event emitted by [WeDo2SmartHub](#WeDo2SmartHub) | Param | Type | | --- | --- | | button | string | | state | [ButtonState](#ButtonState) | ### "distance" (port, distance) Emits when a distance sensor is activated. **Kind**: event emitted by [WeDo2SmartHub](#WeDo2SmartHub) | Param | Type | Description | | --- | --- | --- | | port | string | | | distance | number | Distance, in millimeters. | ### "color" (port, color) Emits when a color sensor is activated. **Kind**: event emitted by [WeDo2SmartHub](#WeDo2SmartHub) | Param | Type | | --- | --- | | port | string | | color | [Color](#Color) | ### "tilt" (port, x, y) Emits when a tilt sensor is activated. **Kind**: event emitted by [WeDo2SmartHub](#WeDo2SmartHub) | Param | Type | | --- | --- | | port | string | | x | number | | y | number | ### "rotate" (port, rotation) Emits when a rotation sensor is activated. **Kind**: event emitted by [WeDo2SmartHub](#WeDo2SmartHub) | Param | Type | | --- | --- | | port | string | | rotation | number | ### "attach" (port, type) Emits when a motor or sensor is attached to the Hub. **Kind**: event emitted by [WeDo2SmartHub](#WeDo2SmartHub) | Param | Type | | --- | --- | | port | string | | type | [DeviceType](#DeviceType) | ### "detach" (port) Emits when an attached motor or sensor is detached from the Hub. **Kind**: event emitted by [WeDo2SmartHub](#WeDo2SmartHub) | Param | Type | | --- | --- | | port | string | ## BoostMoveHub ⇐ LPF2Hub **Kind**: global class **Extends**: LPF2Hub, Hub * [BoostMoveHub](#BoostMoveHub) ⇐ LPF2Hub * [new BoostMoveHub()](#new_BoostMoveHub_new) * [.current](#LPF2Hub+current) * [.name](#Hub+name) * [.uuid](#Hub+uuid) * [.rssi](#Hub+rssi) * [.batteryLevel](#Hub+batteryLevel) * [.setMotorSpeed(port, speed, [time])](#BoostMoveHub+setMotorSpeed) ⇒ Promise * [.rampMotorSpeed(port, fromSpeed, toSpeed, time)](#BoostMoveHub+rampMotorSpeed) ⇒ Promise * [.setMotorAngle(port, angle, [speed])](#BoostMoveHub+setMotorAngle) ⇒ Promise * [.setLightBrightness(port, brightness, [time])](#BoostMoveHub+setLightBrightness) ⇒ Promise * [.setName(name)](#LPF2Hub+setName) ⇒ Promise * [.setLEDColor(color)](#LPF2Hub+setLEDColor) ⇒ Promise * [.setLEDRGB(red, green, blue)](#LPF2Hub+setLEDRGB) ⇒ Promise * [.connect()](#Hub+connect) ⇒ Promise * [.disconnect()](#Hub+disconnect) ⇒ Promise * [.subscribe(port, [mode])](#Hub+subscribe) ⇒ Promise * [.unsubscribe(port)](#Hub+unsubscribe) ⇒ Promise * [.sleep(delay)](#Hub+sleep) ⇒ Promise * [.wait(commands)](#Hub+wait) ⇒ Promise * [.getHubType()](#Hub+getHubType) ⇒ [HubType](#HubType) * [.getPortDeviceType(port)](#Hub+getPortDeviceType) ⇒ [DeviceType](#DeviceType) * ["button" (button, state)](#LPF2Hub+event_button) * ["distance" (port, distance)](#LPF2Hub+event_distance) * ["color" (port, color)](#LPF2Hub+event_color) * ["colorAndDistance" (port, color, distance)](#LPF2Hub+event_colorAndDistance) * ["tilt" (port, x, y)](#LPF2Hub+event_tilt) * ["rotate" (port, rotation)](#LPF2Hub+event_rotate) * ["attach" (port, type)](#Hub+event_attach) * ["detach" (port)](#Hub+event_detach) ### new BoostMoveHub() The BoostMoveHub is emitted if the discovered device is a Boost Move Hub. ### boostMoveHub.current **Kind**: instance property of [BoostMoveHub](#BoostMoveHub) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | current | number | Current usage of the hub (Amps) | ### boostMoveHub.name **Kind**: instance property of [BoostMoveHub](#BoostMoveHub) **Overrides**: [name](#Hub+name) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | name | string | Name of the hub | ### boostMoveHub.uuid **Kind**: instance property of [BoostMoveHub](#BoostMoveHub) **Overrides**: [uuid](#Hub+uuid) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | uuid | string | UUID of the hub | ### boostMoveHub.rssi **Kind**: instance property of [BoostMoveHub](#BoostMoveHub) **Overrides**: [rssi](#Hub+rssi) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | rssi | number | Signal strength of the hub | ### boostMoveHub.batteryLevel **Kind**: instance property of [BoostMoveHub](#BoostMoveHub) **Overrides**: [batteryLevel](#Hub+batteryLevel) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | batteryLevel | number | Battery level of the hub (Percentage between 0-100) | ### boostMoveHub.setMotorSpeed(port, speed, [time]) ⇒ Promise Set the motor speed on a given port. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Returns**: Promise - Resolved upon successful completion of command. If time is specified, this is once the motor is finished. | Param | Type | Description | | --- | --- | --- | | port | string | | | speed | number \| Array.<number> | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds. | | [time] | number | How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. | ### boostMoveHub.rampMotorSpeed(port, fromSpeed, toSpeed, time) ⇒ Promise Ramp the motor speed on a given port. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Returns**: Promise - Resolved upon successful completion of command. | Param | Type | Description | | --- | --- | --- | | port | string | | | fromSpeed | number | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. | | toSpeed | number | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. | | time | number | How long the ramp should last (in milliseconds). | ### boostMoveHub.setMotorAngle(port, angle, [speed]) ⇒ Promise Rotate a motor by a given angle. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Returns**: Promise - Resolved upon successful completion of command (ie. once the motor is finished). | Param | Type | Default | Description | | --- | --- | --- | --- | | port | string | | | | angle | number | | How much the motor should be rotated (in degrees). | | [speed] | number \| Array.<number> | 100 | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds. | ### boostMoveHub.setLightBrightness(port, brightness, [time]) ⇒ Promise Set the light brightness on a given port. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Returns**: Promise - Resolved upon successful completion of command. If time is specified, this is once the light is turned off. | Param | Type | Description | | --- | --- | --- | | port | string | | | brightness | number | Brightness value between 0-100 (0 is off) | | [time] | number | How long to turn the light on (in milliseconds). Leave empty to turn the light on indefinitely. | ### boostMoveHub.setName(name) ⇒ Promise Set the name of the Hub. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | Description | | --- | --- | --- | | name | string | New name of the hub (14 characters or less, ASCII only). | ### boostMoveHub.setLEDColor(color) ⇒ Promise Set the color of the LED on the Hub via a color value. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | color | [Color](#Color) | ### boostMoveHub.setLEDRGB(red, green, blue) ⇒ Promise Set the color of the LED on the Hub via RGB values. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | red | number | | green | number | | blue | number | ### boostMoveHub.connect() ⇒ Promise Connect to the Hub. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Overrides**: [connect](#Hub+connect) **Returns**: Promise - Resolved upon successful connect. ### boostMoveHub.disconnect() ⇒ Promise Disconnect the Hub. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Overrides**: [disconnect](#Hub+disconnect) **Returns**: Promise - Resolved upon successful disconnect. ### boostMoveHub.subscribe(port, [mode]) ⇒ Promise Subscribe to sensor notifications on a given port. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Overrides**: [subscribe](#Hub+subscribe) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | Description | | --- | --- | --- | | port | string | | | [mode] | number | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. | ### boostMoveHub.unsubscribe(port) ⇒ Promise Unsubscribe to sensor notifications on a given port. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Overrides**: [unsubscribe](#Hub+unsubscribe) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | port | string | ### boostMoveHub.sleep(delay) ⇒ Promise Sleep a given amount of time. This is a helper method to make it easier to add delays into a chain of commands. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Overrides**: [sleep](#Hub+sleep) **Returns**: Promise - Resolved after the delay is finished. | Param | Type | Description | | --- | --- | --- | | delay | number | How long to sleep (in milliseconds). | ### boostMoveHub.wait(commands) ⇒ Promise Wait until a given list of concurrently running commands are complete. This is a helper method to make it easier to wait for concurrent commands to complete. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Overrides**: [wait](#Hub+wait) **Returns**: Promise - Resolved after the commands are finished. | Param | Type | Description | | --- | --- | --- | | commands | Array.<Promise.<any>> | Array of executing commands. | ### boostMoveHub.getHubType() ⇒ [HubType](#HubType) Get the hub type. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Overrides**: [getHubType](#Hub+getHubType) ### boostMoveHub.getPortDeviceType(port) ⇒ [DeviceType](#DeviceType) Get the device type for a given port. **Kind**: instance method of [BoostMoveHub](#BoostMoveHub) **Overrides**: [getPortDeviceType](#Hub+getPortDeviceType) | Param | Type | | --- | --- | | port | string | ### "button" (button, state) Emits when a button is pressed. **Kind**: event emitted by [BoostMoveHub](#BoostMoveHub) | Param | Type | | --- | --- | | button | string | | state | [ButtonState](#ButtonState) | ### "distance" (port, distance) Emits when a distance sensor is activated. **Kind**: event emitted by [BoostMoveHub](#BoostMoveHub) | Param | Type | Description | | --- | --- | --- | | port | string | | | distance | number | Distance, in millimeters. | ### "color" (port, color) Emits when a color sensor is activated. **Kind**: event emitted by [BoostMoveHub](#BoostMoveHub) | Param | Type | | --- | --- | | port | string | | color | [Color](#Color) | ### "colorAndDistance" (port, color, distance) A combined color and distance event, emits when the sensor is activated. **Kind**: event emitted by [BoostMoveHub](#BoostMoveHub) | Param | Type | Description | | --- | --- | --- | | port | string | | | color | [Color](#Color) | | | distance | number | Distance, in millimeters. | ### "tilt" (port, x, y) Emits when a tilt sensor is activated. **Kind**: event emitted by [BoostMoveHub](#BoostMoveHub) | Param | Type | Description | | --- | --- | --- | | port | string | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. | | x | number | | | y | number | | ### "rotate" (port, rotation) Emits when a rotation sensor is activated. **Kind**: event emitted by [BoostMoveHub](#BoostMoveHub) | Param | Type | | --- | --- | | port | string | | rotation | number | ### "attach" (port, type) Emits when a motor or sensor is attached to the Hub. **Kind**: event emitted by [BoostMoveHub](#BoostMoveHub) **Overrides**: [attach](#Hub+event_attach) | Param | Type | | --- | --- | | port | string | | type | [DeviceType](#DeviceType) | ### "detach" (port) Emits when an attached motor or sensor is detached from the Hub. **Kind**: event emitted by [BoostMoveHub](#BoostMoveHub) **Overrides**: [detach](#Hub+event_detach) | Param | Type | | --- | --- | | port | string | ## PUPHub ⇐ LPF2Hub **Kind**: global class **Extends**: LPF2Hub, Hub * [PUPHub](#PUPHub) ⇐ LPF2Hub * [new PUPHub()](#new_PUPHub_new) * [.current](#LPF2Hub+current) * [.name](#Hub+name) * [.uuid](#Hub+uuid) * [.rssi](#Hub+rssi) * [.batteryLevel](#Hub+batteryLevel) * [.setMotorSpeed(port, speed, [time])](#PUPHub+setMotorSpeed) ⇒ Promise * [.rampMotorSpeed(port, fromSpeed, toSpeed, time)](#PUPHub+rampMotorSpeed) ⇒ Promise * [.setLightBrightness(port, brightness, [time])](#PUPHub+setLightBrightness) ⇒ Promise * [.setName(name)](#LPF2Hub+setName) ⇒ Promise * [.setLEDColor(color)](#LPF2Hub+setLEDColor) ⇒ Promise * [.setLEDRGB(red, green, blue)](#LPF2Hub+setLEDRGB) ⇒ Promise * [.connect()](#Hub+connect) ⇒ Promise * [.disconnect()](#Hub+disconnect) ⇒ Promise * [.subscribe(port, [mode])](#Hub+subscribe) ⇒ Promise * [.unsubscribe(port)](#Hub+unsubscribe) ⇒ Promise * [.sleep(delay)](#Hub+sleep) ⇒ Promise * [.wait(commands)](#Hub+wait) ⇒ Promise * [.getHubType()](#Hub+getHubType) ⇒ [HubType](#HubType) * [.getPortDeviceType(port)](#Hub+getPortDeviceType) ⇒ [DeviceType](#DeviceType) * ["button" (button, state)](#LPF2Hub+event_button) * ["distance" (port, distance)](#LPF2Hub+event_distance) * ["color" (port, color)](#LPF2Hub+event_color) * ["colorAndDistance" (port, color, distance)](#LPF2Hub+event_colorAndDistance) * ["tilt" (port, x, y)](#LPF2Hub+event_tilt) * ["attach" (port, type)](#Hub+event_attach) * ["detach" (port)](#Hub+event_detach) ### new PUPHub() The PUPHub is emitted if the discovered device is a Powered UP Hub. ### pupHub.current **Kind**: instance property of [PUPHub](#PUPHub) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | current | number | Current usage of the hub (Amps) | ### pupHub.name **Kind**: instance property of [PUPHub](#PUPHub) **Overrides**: [name](#Hub+name) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | name | string | Name of the hub | ### pupHub.uuid **Kind**: instance property of [PUPHub](#PUPHub) **Overrides**: [uuid](#Hub+uuid) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | uuid | string | UUID of the hub | ### pupHub.rssi **Kind**: instance property of [PUPHub](#PUPHub) **Overrides**: [rssi](#Hub+rssi) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | rssi | number | Signal strength of the hub | ### pupHub.batteryLevel **Kind**: instance property of [PUPHub](#PUPHub) **Overrides**: [batteryLevel](#Hub+batteryLevel) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | batteryLevel | number | Battery level of the hub (Percentage between 0-100) | ### pupHub.setMotorSpeed(port, speed, [time]) ⇒ Promise Set the motor speed on a given port. **Kind**: instance method of [PUPHub](#PUPHub) **Returns**: Promise - Resolved upon successful completion of command. If time is specified, this is once the motor is finished. | Param | Type | Description | | --- | --- | --- | | port | string | | | speed | number \| Array.<number> | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds. | | [time] | number | How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. | ### pupHub.rampMotorSpeed(port, fromSpeed, toSpeed, time) ⇒ Promise Ramp the motor speed on a given port. **Kind**: instance method of [PUPHub](#PUPHub) **Returns**: Promise - Resolved upon successful completion of command. | Param | Type | Description | | --- | --- | --- | | port | string | | | fromSpeed | number | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. | | toSpeed | number | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. | | time | number | How long the ramp should last (in milliseconds). | ### pupHub.setLightBrightness(port, brightness, [time]) ⇒ Promise Set the light brightness on a given port. **Kind**: instance method of [PUPHub](#PUPHub) **Returns**: Promise - Resolved upon successful completion of command. If time is specified, this is once the light is turned off. | Param | Type | Description | | --- | --- | --- | | port | string | | | brightness | number | Brightness value between 0-100 (0 is off) | | [time] | number | How long to turn the light on (in milliseconds). Leave empty to turn the light on indefinitely. | ### pupHub.setName(name) ⇒ Promise Set the name of the Hub. **Kind**: instance method of [PUPHub](#PUPHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | Description | | --- | --- | --- | | name | string | New name of the hub (14 characters or less, ASCII only). | ### pupHub.setLEDColor(color) ⇒ Promise Set the color of the LED on the Hub via a color value. **Kind**: instance method of [PUPHub](#PUPHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | color | [Color](#Color) | ### pupHub.setLEDRGB(red, green, blue) ⇒ Promise Set the color of the LED on the Hub via RGB values. **Kind**: instance method of [PUPHub](#PUPHub) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | red | number | | green | number | | blue | number | ### pupHub.connect() ⇒ Promise Connect to the Hub. **Kind**: instance method of [PUPHub](#PUPHub) **Overrides**: [connect](#Hub+connect) **Returns**: Promise - Resolved upon successful connect. ### pupHub.disconnect() ⇒ Promise Disconnect the Hub. **Kind**: instance method of [PUPHub](#PUPHub) **Overrides**: [disconnect](#Hub+disconnect) **Returns**: Promise - Resolved upon successful disconnect. ### pupHub.subscribe(port, [mode]) ⇒ Promise Subscribe to sensor notifications on a given port. **Kind**: instance method of [PUPHub](#PUPHub) **Overrides**: [subscribe](#Hub+subscribe) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | Description | | --- | --- | --- | | port | string | | | [mode] | number | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. | ### pupHub.unsubscribe(port) ⇒ Promise Unsubscribe to sensor notifications on a given port. **Kind**: instance method of [PUPHub](#PUPHub) **Overrides**: [unsubscribe](#Hub+unsubscribe) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | port | string | ### pupHub.sleep(delay) ⇒ Promise Sleep a given amount of time. This is a helper method to make it easier to add delays into a chain of commands. **Kind**: instance method of [PUPHub](#PUPHub) **Overrides**: [sleep](#Hub+sleep) **Returns**: Promise - Resolved after the delay is finished. | Param | Type | Description | | --- | --- | --- | | delay | number | How long to sleep (in milliseconds). | ### pupHub.wait(commands) ⇒ Promise Wait until a given list of concurrently running commands are complete. This is a helper method to make it easier to wait for concurrent commands to complete. **Kind**: instance method of [PUPHub](#PUPHub) **Overrides**: [wait](#Hub+wait) **Returns**: Promise - Resolved after the commands are finished. | Param | Type | Description | | --- | --- | --- | | commands | Array.<Promise.<any>> | Array of executing commands. | ### pupHub.getHubType() ⇒ [HubType](#HubType) Get the hub type. **Kind**: instance method of [PUPHub](#PUPHub) **Overrides**: [getHubType](#Hub+getHubType) ### pupHub.getPortDeviceType(port) ⇒ [DeviceType](#DeviceType) Get the device type for a given port. **Kind**: instance method of [PUPHub](#PUPHub) **Overrides**: [getPortDeviceType](#Hub+getPortDeviceType) | Param | Type | | --- | --- | | port | string | ### "button" (button, state) Emits when a button is pressed. **Kind**: event emitted by [PUPHub](#PUPHub) | Param | Type | | --- | --- | | button | string | | state | [ButtonState](#ButtonState) | ### "distance" (port, distance) Emits when a distance sensor is activated. **Kind**: event emitted by [PUPHub](#PUPHub) | Param | Type | Description | | --- | --- | --- | | port | string | | | distance | number | Distance, in millimeters. | ### "color" (port, color) Emits when a color sensor is activated. **Kind**: event emitted by [PUPHub](#PUPHub) | Param | Type | | --- | --- | | port | string | | color | [Color](#Color) | ### "colorAndDistance" (port, color, distance) A combined color and distance event, emits when the sensor is activated. **Kind**: event emitted by [PUPHub](#PUPHub) | Param | Type | Description | | --- | --- | --- | | port | string | | | color | [Color](#Color) | | | distance | number | Distance, in millimeters. | ### "tilt" (port, x, y) Emits when a tilt sensor is activated. **Kind**: event emitted by [PUPHub](#PUPHub) | Param | Type | Description | | --- | --- | --- | | port | string | If the event is fired from the Move Hub's in-built tilt sensor, the special port "TILT" is used. | | x | number | | | y | number | | ### "attach" (port, type) Emits when a motor or sensor is attached to the Hub. **Kind**: event emitted by [PUPHub](#PUPHub) **Overrides**: [attach](#Hub+event_attach) | Param | Type | | --- | --- | | port | string | | type | [DeviceType](#DeviceType) | ### "detach" (port) Emits when an attached motor or sensor is detached from the Hub. **Kind**: event emitted by [PUPHub](#PUPHub) **Overrides**: [detach](#Hub+event_detach) | Param | Type | | --- | --- | | port | string | ## PUPRemote ⇐ LPF2Hub **Kind**: global class **Extends**: LPF2Hub, Hub * [PUPRemote](#PUPRemote) ⇐ LPF2Hub * [new PUPRemote()](#new_PUPRemote_new) * [.current](#LPF2Hub+current) * [.name](#Hub+name) * [.uuid](#Hub+uuid) * [.rssi](#Hub+rssi) * [.batteryLevel](#Hub+batteryLevel) * [.setLEDColor(color)](#PUPRemote+setLEDColor) ⇒ Promise * [.setLEDRGB(red, green, blue)](#PUPRemote+setLEDRGB) ⇒ Promise * [.setName(name)](#LPF2Hub+setName) ⇒ Promise * [.connect()](#Hub+connect) ⇒ Promise * [.disconnect()](#Hub+disconnect) ⇒ Promise * [.subscribe(port, [mode])](#Hub+subscribe) ⇒ Promise * [.unsubscribe(port)](#Hub+unsubscribe) ⇒ Promise * [.sleep(delay)](#Hub+sleep) ⇒ Promise * [.wait(commands)](#Hub+wait) ⇒ Promise * [.getHubType()](#Hub+getHubType) ⇒ [HubType](#HubType) * [.getPortDeviceType(port)](#Hub+getPortDeviceType) ⇒ [DeviceType](#DeviceType) * ["button" (button, state)](#LPF2Hub+event_button) * ["colorAndDistance" (port, color, distance)](#LPF2Hub+event_colorAndDistance) ### new PUPRemote() The PUPRemote is emitted if the discovered device is a Powered UP Remote. ### pupRemote.current **Kind**: instance property of [PUPRemote](#PUPRemote) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | current | number | Current usage of the hub (Amps) | ### pupRemote.name **Kind**: instance property of [PUPRemote](#PUPRemote) **Overrides**: [name](#Hub+name) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | name | string | Name of the hub | ### pupRemote.uuid **Kind**: instance property of [PUPRemote](#PUPRemote) **Overrides**: [uuid](#Hub+uuid) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | uuid | string | UUID of the hub | ### pupRemote.rssi **Kind**: instance property of [PUPRemote](#PUPRemote) **Overrides**: [rssi](#Hub+rssi) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | rssi | number | Signal strength of the hub | ### pupRemote.batteryLevel **Kind**: instance property of [PUPRemote](#PUPRemote) **Overrides**: [batteryLevel](#Hub+batteryLevel) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | batteryLevel | number | Battery level of the hub (Percentage between 0-100) | ### pupRemote.setLEDColor(color) ⇒ Promise Set the color of the LED on the Remote via a color value. **Kind**: instance method of [PUPRemote](#PUPRemote) **Overrides**: [setLEDColor](#LPF2Hub+setLEDColor) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | color | [Color](#Color) | ### pupRemote.setLEDRGB(red, green, blue) ⇒ Promise Set the color of the LED on the Hub via RGB values. **Kind**: instance method of [PUPRemote](#PUPRemote) **Overrides**: [setLEDRGB](#LPF2Hub+setLEDRGB) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | red | number | | green | number | | blue | number | ### pupRemote.setName(name) ⇒ Promise Set the name of the Hub. **Kind**: instance method of [PUPRemote](#PUPRemote) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | Description | | --- | --- | --- | | name | string | New name of the hub (14 characters or less, ASCII only). | ### pupRemote.connect() ⇒ Promise Connect to the Hub. **Kind**: instance method of [PUPRemote](#PUPRemote) **Overrides**: [connect](#Hub+connect) **Returns**: Promise - Resolved upon successful connect. ### pupRemote.disconnect() ⇒ Promise Disconnect the Hub. **Kind**: instance method of [PUPRemote](#PUPRemote) **Overrides**: [disconnect](#Hub+disconnect) **Returns**: Promise - Resolved upon successful disconnect. ### pupRemote.subscribe(port, [mode]) ⇒ Promise Subscribe to sensor notifications on a given port. **Kind**: instance method of [PUPRemote](#PUPRemote) **Overrides**: [subscribe](#Hub+subscribe) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | Description | | --- | --- | --- | | port | string | | | [mode] | number | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. | ### pupRemote.unsubscribe(port) ⇒ Promise Unsubscribe to sensor notifications on a given port. **Kind**: instance method of [PUPRemote](#PUPRemote) **Overrides**: [unsubscribe](#Hub+unsubscribe) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | port | string | ### pupRemote.sleep(delay) ⇒ Promise Sleep a given amount of time. This is a helper method to make it easier to add delays into a chain of commands. **Kind**: instance method of [PUPRemote](#PUPRemote) **Overrides**: [sleep](#Hub+sleep) **Returns**: Promise - Resolved after the delay is finished. | Param | Type | Description | | --- | --- | --- | | delay | number | How long to sleep (in milliseconds). | ### pupRemote.wait(commands) ⇒ Promise Wait until a given list of concurrently running commands are complete. This is a helper method to make it easier to wait for concurrent commands to complete. **Kind**: instance method of [PUPRemote](#PUPRemote) **Overrides**: [wait](#Hub+wait) **Returns**: Promise - Resolved after the commands are finished. | Param | Type | Description | | --- | --- | --- | | commands | Array.<Promise.<any>> | Array of executing commands. | ### pupRemote.getHubType() ⇒ [HubType](#HubType) Get the hub type. **Kind**: instance method of [PUPRemote](#PUPRemote) **Overrides**: [getHubType](#Hub+getHubType) ### pupRemote.getPortDeviceType(port) ⇒ [DeviceType](#DeviceType) Get the device type for a given port. **Kind**: instance method of [PUPRemote](#PUPRemote) **Overrides**: [getPortDeviceType](#Hub+getPortDeviceType) | Param | Type | | --- | --- | | port | string | ### "button" (button, state) Emits when a button is pressed. **Kind**: event emitted by [PUPRemote](#PUPRemote) | Param | Type | | --- | --- | | button | string | | state | [ButtonState](#ButtonState) | ### "colorAndDistance" (port, color, distance) A combined color and distance event, emits when the sensor is activated. **Kind**: event emitted by [PUPRemote](#PUPRemote) | Param | Type | Description | | --- | --- | --- | | port | string | | | color | [Color](#Color) | | | distance | number | Distance, in millimeters. | ## DuploTrainBase ⇐ LPF2Hub **Kind**: global class **Extends**: LPF2Hub, Hub * [DuploTrainBase](#DuploTrainBase) ⇐ LPF2Hub * [new DuploTrainBase()](#new_DuploTrainBase_new) * [.current](#LPF2Hub+current) * [.name](#Hub+name) * [.uuid](#Hub+uuid) * [.rssi](#Hub+rssi) * [.batteryLevel](#Hub+batteryLevel) * [.setLEDColor(color)](#DuploTrainBase+setLEDColor) ⇒ Promise * [.setMotorSpeed(port, speed, [time])](#DuploTrainBase+setMotorSpeed) ⇒ Promise * [.playSound(sound)](#DuploTrainBase+playSound) ⇒ Promise * [.rampMotorSpeed(port, fromSpeed, toSpeed, time)](#DuploTrainBase+rampMotorSpeed) ⇒ Promise * [.setName(name)](#LPF2Hub+setName) ⇒ Promise * [.setLEDRGB(red, green, blue)](#LPF2Hub+setLEDRGB) ⇒ Promise * [.connect()](#Hub+connect) ⇒ Promise * [.disconnect()](#Hub+disconnect) ⇒ Promise * [.subscribe(port, [mode])](#Hub+subscribe) ⇒ Promise * [.unsubscribe(port)](#Hub+unsubscribe) ⇒ Promise * [.sleep(delay)](#Hub+sleep) ⇒ Promise * [.wait(commands)](#Hub+wait) ⇒ Promise * [.getHubType()](#Hub+getHubType) ⇒ [HubType](#HubType) * [.getPortDeviceType(port)](#Hub+getPortDeviceType) ⇒ [DeviceType](#DeviceType) * ["color" (port, color)](#LPF2Hub+event_color) * ["colorAndDistance" (port, color, distance)](#LPF2Hub+event_colorAndDistance) * ["speed" (port, speed)](#LPF2Hub+event_speed) ### new DuploTrainBase() The DuploTrainBase is emitted if the discovered device is a Duplo Train Base. ### duploTrainBase.current **Kind**: instance property of [DuploTrainBase](#DuploTrainBase) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | current | number | Current usage of the hub (Amps) | ### duploTrainBase.name **Kind**: instance property of [DuploTrainBase](#DuploTrainBase) **Overrides**: [name](#Hub+name) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | name | string | Name of the hub | ### duploTrainBase.uuid **Kind**: instance property of [DuploTrainBase](#DuploTrainBase) **Overrides**: [uuid](#Hub+uuid) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | uuid | string | UUID of the hub | ### duploTrainBase.rssi **Kind**: instance property of [DuploTrainBase](#DuploTrainBase) **Overrides**: [rssi](#Hub+rssi) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | rssi | number | Signal strength of the hub | ### duploTrainBase.batteryLevel **Kind**: instance property of [DuploTrainBase](#DuploTrainBase) **Overrides**: [batteryLevel](#Hub+batteryLevel) **Read only**: true **Properties** | Name | Type | Description | | --- | --- | --- | | batteryLevel | number | Battery level of the hub (Percentage between 0-100) | ### duploTrainBase.setLEDColor(color) ⇒ Promise Set the color of the LED on the train via a color value. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Overrides**: [setLEDColor](#LPF2Hub+setLEDColor) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | color | [Color](#Color) | ### duploTrainBase.setMotorSpeed(port, speed, [time]) ⇒ Promise Set the motor speed on a given port. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Returns**: Promise - Resolved upon successful completion of command. If time is specified, this is once the motor is finished. | Param | Type | Description | | --- | --- | --- | | port | string | | | speed | number \| Array.<number> | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. If you are specifying port AB to control both motors, you can optionally supply a tuple of speeds. | | [time] | number | How long to activate the motor for (in milliseconds). Leave empty to turn the motor on indefinitely. | ### duploTrainBase.playSound(sound) ⇒ Promise Play a built-in train sound. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | sound | [DuploTrainBaseSound](#DuploTrainBaseSound) | ### duploTrainBase.rampMotorSpeed(port, fromSpeed, toSpeed, time) ⇒ Promise Ramp the motor speed on a given port. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Returns**: Promise - Resolved upon successful completion of command. | Param | Type | Description | | --- | --- | --- | | port | string | | | fromSpeed | number | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. | | toSpeed | number | For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. | | time | number | How long the ramp should last (in milliseconds). | ### duploTrainBase.setName(name) ⇒ Promise Set the name of the Hub. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | Description | | --- | --- | --- | | name | string | New name of the hub (14 characters or less, ASCII only). | ### duploTrainBase.setLEDRGB(red, green, blue) ⇒ Promise Set the color of the LED on the Hub via RGB values. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | red | number | | green | number | | blue | number | ### duploTrainBase.connect() ⇒ Promise Connect to the Hub. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Overrides**: [connect](#Hub+connect) **Returns**: Promise - Resolved upon successful connect. ### duploTrainBase.disconnect() ⇒ Promise Disconnect the Hub. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Overrides**: [disconnect](#Hub+disconnect) **Returns**: Promise - Resolved upon successful disconnect. ### duploTrainBase.subscribe(port, [mode]) ⇒ Promise Subscribe to sensor notifications on a given port. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Overrides**: [subscribe](#Hub+subscribe) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | Description | | --- | --- | --- | | port | string | | | [mode] | number | The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen. | ### duploTrainBase.unsubscribe(port) ⇒ Promise Unsubscribe to sensor notifications on a given port. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Overrides**: [unsubscribe](#Hub+unsubscribe) **Returns**: Promise - Resolved upon successful issuance of command. | Param | Type | | --- | --- | | port | string | ### duploTrainBase.sleep(delay) ⇒ Promise Sleep a given amount of time. This is a helper method to make it easier to add delays into a chain of commands. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Overrides**: [sleep](#Hub+sleep) **Returns**: Promise - Resolved after the delay is finished. | Param | Type | Description | | --- | --- | --- | | delay | number | How long to sleep (in milliseconds). | ### duploTrainBase.wait(commands) ⇒ Promise Wait until a given list of concurrently running commands are complete. This is a helper method to make it easier to wait for concurrent commands to complete. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Overrides**: [wait](#Hub+wait) **Returns**: Promise - Resolved after the commands are finished. | Param | Type | Description | | --- | --- | --- | | commands | Array.<Promise.<any>> | Array of executing commands. | ### duploTrainBase.getHubType() ⇒ [HubType](#HubType) Get the hub type. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Overrides**: [getHubType](#Hub+getHubType) ### duploTrainBase.getPortDeviceType(port) ⇒ [DeviceType](#DeviceType) Get the device type for a given port. **Kind**: instance method of [DuploTrainBase](#DuploTrainBase) **Overrides**: [getPortDeviceType](#Hub+getPortDeviceType) | Param | Type | | --- | --- | | port | string | ### "color" (port, color) Emits when a color sensor is activated. **Kind**: event emitted by [DuploTrainBase](#DuploTrainBase) | Param | Type | | --- | --- | | port | string | | color | [Color](#Color) | ### "colorAndDistance" (port, color, distance) A combined color and distance event, emits when the sensor is activated. **Kind**: event emitted by [DuploTrainBase](#DuploTrainBase) | Param | Type | Description | | --- | --- | --- | | port | string | | | color | [Color](#Color) | | | distance | number | Distance, in millimeters. | ### "speed" (port, speed) Emits on a speed change. **Kind**: event emitted by [DuploTrainBase](#DuploTrainBase) | Param | Type | | --- | --- | | port | string | | speed | number | ## HubType **Kind**: global typedef **Properties** | Name | Type | Description | | --- | --- | --- | | UNKNOWN | number | 0 | | WEDO2_SMART_HUB | number | 1 | | BOOST_MOVE_HUB | number | 2 | | POWERED_UP_HUB | number | 3 | | POWERED_UP_REMOTE | number | 4 | | DUPLO_TRAIN_HUB | number | 5 | ## DeviceType **Kind**: global typedef **Properties** | Name | Type | Description | | --- | --- | --- | | UNKNOWN | number | 0 | | BASIC_MOTOR | number | 1 | | TRAIN_MOTOR | number | 2 | | LED_LIGHTS | number | 8 | | BOOST_LED | number | 22 | | WEDO2_TILT | number | 34 | | WEDO2_DISTANCE | number | 35 | | BOOST_DISTANCE | number | 37 | | BOOST_TACHO_MOTOR | number | 38 | | BOOST_MOVE_HUB_MOTOR | number | 39 | | BOOST_TILT | number | 40 | | DUPLO_TRAIN_BASE_MOTOR | number | 41 | | DUPLO_TRAIN_BASE_SPEAKER | number | 42 | | DUPLO_TRAIN_BASE_COLOR | number | 43 | | DUPLO_TRAIN_BASE_SPEEDOMETER | number | 44 | | POWERED_UP_REMOTE_BUTTON | number | 55 | ## Color **Kind**: global typedef **Properties** | Name | Type | Description | | --- | --- | --- | | BLACK | number | 0 | | PINK | number | 1 | | PURPLE | number | 2 | | BLUE | number | 3 | | LIGHT_BLUE | number | 4 | | CYAN | number | 5 | | GREEN | number | 6 | | YELLOW | number | 7 | | ORANGE | number | 8 | | RED | number | 9 | | WHITE | number | 10 | | NONE | number | 255 | ## ButtonState **Kind**: global typedef **Properties** | Name | Type | Description | | --- | --- | --- | | PRESSED | number | 0 | | RELEASED | number | 1 | | UP | number | 2 | | DOWN | number | 3 | | STOP | number | 4 | ## DuploTrainBaseSound **Kind**: global typedef **Properties** | Name | Type | Description | | --- | --- | --- | | BRAKE | number | 3 | | STATION_DEPARTURE | number | 5 | | WATER_REFILL | number | 7 | | HORN | number | 9 | | STEAM | number | 10 |