Enumerations

The following submodules hold protocol-defined integer constants. They are plain modules — dot-access the constant name, e.g. lpf2.color.RED.

lpf2.color

Colour palette used by the hub LED, colour sensor and the Boost color-distance sensor:

BLACK, PINK, PURPLE, BLUE, LIGHT_BLUE, CYAN, GREEN, YELLOW, ORANGE, RED, WHITE, NONE.

lpf2.device_type

Numeric device types published by LPF2 devices during identification. Includes MEDIUM_LINEAR_MOTOR, TRAIN_MOTOR, TECHNIC_LARGE_MOTOR, TECHNIC_XLARGE_MOTOR, COLOR_DISTANCE_SENSOR, TECHNIC_COLOR_SENSOR, TECHNIC_DISTANCE_SENSOR, HUB_LED, plus per-hub sensor IDs.

Compare with lpf2.port.getDeviceType().

lpf2.hub_type

Identifiers reported by remote hubs over BLE — WEDO_2, BOOST_MOVE_HUB, TWO_PORT_HUB, TWO_PORT_HANDSET, TECHNIC_MEDIUM_HUB, DUPLO_TRAIN_BASE, MARIO.

lpf2.alerts

Bit / value identifiers for lpf2.hub_emulation.setAlert(). Includes LOW_VOLTAGE, HIGH_CURRENT, LOW_SIGNAL_STRENGTH, OVERPOWER.

lpf2.battery_type

NORMAL (0) / RECHARGEABLE (1). Used with lpf2.hub_emulation.setBatteryType() and lpf2.hub.getBatteryType().

lpf2.button_state

Button-state transitions announced over LWP: RELEASED, PRESSED, HELD, RELEASED_LONG. Used with lpf2.hub_emulation.setButtonState().

lpf2.hub_property

Hub-property identifiers used with lpf2.hub.getHubPropStr(): NAME, BUTTON, FW_VERSION, HW_VERSION, RSSI, BATTERY_VOLTAGE, BATTERY_TYPE, MANUFACTURER, RADIO_FW_VERSION, WIRELESS_PROTOCOL_VERSION, SYSTEM_TYPE_ID, HW_NETWORK_ID, PRIMARY_MAC, SECONDARY_MAC, HW_NETWORK_FAMILY, VOLUME.

lpf2.port_num

Per-hub port-number namespaces:

  • lpf2.port_num.poweredup — 2-port hub (A, B).

  • lpf2.port_num.controlplus — Technic Medium Hub (A..D + built-ins).

  • lpf2.port_num.movehub — Boost Move Hub (A..D + built-ins).

  • lpf2.port_num.poweredupremote — PoweredUp handset buttons.

  • lpf2.port_num.duplotrain — Duplo Train base.

  • lpf2.port_num.mario — Mario / Luigi.

Use these with lpf2.hub.getPort() / lpf2.hub.setPortMode():

p = remote.getPort(lpf2.port_num.controlplus.A)