Python CLI and library to control a BLE RGB LED strip based on the TG201A controller (MeRGBw app), using the bleak BLE library.
ble_led.py- main script: BLE protocol, controller class, CLIscenes.py- catalog of 109 light scenes and 6 music (mic) scenesTG201A_protocol.md- The full BLE packet protocol
python3 -m venv .venv
source .venv/bin/activate
pip install bleakTested on Linux (BlueZ via D-Bus). The is_bluetooth_enabled() check
uses bluetoothctl show and falls back to "enabled" if bluetoothctl
is not available, so the actual connection attempt remains the final
source of truth.
| Campo | Valore |
|---|---|
| BLE name | LED Lights |
| MAC | 41:42:81:AB:60:BB |
| Model | TG201A |
| Service BLE | 0000fff0 |
| WRITE characteristic | 0000fff3 (handle 0x0009) |
| NOTIFY characteristic | 0000fff4 (handle 0x000b) |
MAC address: 41:42:81:AB:60:BB (edit MAC_ADDRESS in ble_led.py if needed)
python ble_led.py <command> [args]| Command | Description |
|---|---|
scan |
Search for nearby BLE devices |
demo |
Run a full demo sequence |
on / off |
Power on / off |
color <R> <G> <B> |
Set RGB color, 0-255 per channel |
color_name |
Set quick color * |
brightness <1-100> |
Set brightness in % |
scene id <1-117> |
Set scene by ID |
music id <1-6> |
Set music scene by ID |
sens <0-100> |
Set microphone sensitivity in % (only for music scenes) |
schedule <..> |
Configure scheduling (on/off time and days) |
speed <0-100> |
Set scene speed in % |
time |
Set the device's date/time |
query |
Read and print the current status |
- Quick colors:
red,green,blue,white,yellow,cyan,magenta,warm
source .venv/bin/activate
python ble_led.py on
python ble_led.py off
python ble_led.py color 255 20 55
python ble_led.py green
python ble_led.py red
python ble_led.py brightness 70
python ble_led.py scene "flowing water"
python ble_led.py scene "chase" 80
python ble_led.py scene id 23
python ble_led.py scenes
python ble_led.py scenes "run with dot"
python ble_led.py music id 4
python ble_led.py time
python ble_led.py querypython ble_led.py scene <name> [speed]
python ble_led.py scene id <N> [speed]
python ble_led.py scenes [filter]<name>is case-insensitive and can be multi-word (quote it if it contains spaces), e.g.scene "Green-blue flowing water"[speed]is optional, range 0-100 (if omitted, the scene's default speed is used)sceneswith no argument lists all 109 scenes; with a text/number argument it filters by name substring or exact scene ID
109 scenes are available, grouped by category:
Cycle, gradients,
accumulation, chase, drift, spread, melody close, opening/closing,
light-to-dark transitions, flowing water, flow, run, and run-with-dot
variants.
See scenes.py for the full list with scene IDs.
Main groups:
| Category | ID range |
|---|---|
| Cycle / multi-color | 1-10 |
| Alternating gradient | 11-15 |
| Accumulation | 16-22 |
| Chase | 23-25 |
| Drift | 26-28 |
| Spread | 29-31 |
| Melody close | 32-34 |
| Opening and closing | 35-44 |
| transition | 45-54 |
| Flowing water | 55-63 |
| Flow | 64-75 |
| Run | 84-95 |
| Run with dot | 96-117 |
python ble_led.py music [name]
python ble_led.py music id <N>
python ble_led.py music6 scenes available: Spectrum1, Spectrum2, Spectrum3, Flowing,
Rolling, Rhythm (IDs 1-6). These do not use a speed parameter.
| Value | Percentage |
|---|---|
0x3C |
0% |
0x4C |
40% |
0x5C |
80% |
0x64 |
100% |
python ble_led.py schedule on <HH:MM> <days>
python ble_led.py schedule off <HH:MM> <days>
python ble_led.py schedule on enable|disable
python ble_led.py schedule off enable|disable
python ble_led.py schedule both <ON_HH:MM> <OFF_HH:MM> <days>
python ble_led.py schedule clear
python ble_led.py schedule on <HH:MM> tue,wed,fri,sun
python ble_led.py schedule off <HH:MM> tue,fri,sat
python ble_led.py schedule on <HH:MM> all<days> is a comma-separated list of mon tue wed thu fri sat sun, or all.
Examples: all, mon,wed,fri, sat,sun.
import asyncio
from ble_led import LEDController, MAC_ADDRESS
async def main():
led = LEDController(MAC_ADDRESS)
await led.connect()
await led.power_on()
await led.set_color(255, 0, 0)
await led.set_scene_by_name("Aurora", speed=80)
await led.disconnect()
asyncio.run(main())- bleak — BLE Python cross-platform library
- VerTox/rgw_hex_bt - MeRGBW Hexagon BT is a custom integration for Home Assistant
- App: MeRGBw - by Shenzhen Dingyun Future
- MeRGBW - Linktr
- Smart LED Neon Light - link to the product on Amazon

