LampSmartOpen is an open-source reimplementation of the LampSmart Pro control logic.
It allows you to drive compatible BLE lamps directly from a Linux machine using standard tools like btmgmt, without the vendor’s Android app or cloud.
⚠️ This project is experimental and targeted at developers / hackers who are comfortable with BLE, Linux, and reverse-engineering. Use at your own risk.
-
Local control only – No cloud, no vendor app, just your own Linux box.
-
Reimplementation of the LampSmart Pro protocol (V3 family).
-
Small C core that generates the BLE advertising payload.
-
Shell wrapper (
lampctrl.sh) that:- Computes the lamp control address from a UUID stored in
.env - Uses
btmgmtto send a single BLE advertising burst
- Computes the lamp control address from a UUID stored in
-
Designed to be readable, hackable, and reproducible.
The repository is intentionally minimal:
-
.envLocal configuration (lamp identifiers etc.), read by the shell wrapper viajq. -
lampctrl.shConvenience script wrappingbtmgmtand thelampctrlbinary. It:- Extracts the lamp’s UUID from
.env - Derives a control address from UUID fields
- Calls
lampctrlto generate the advertising payload - Enables LE advertising via
btmgmt, sends one burst, and stops
- Extracts the lamp’s UUID from
-
main.cCommand-line tool (lampctrl) that generates the LampSmart BLE V3 payload for a given address and operation. -
CMakeLists.txtBuild configuration for thelampctrlbinary (and any linked encoder libraries / submodules). -
.gitmodulesSubmodules used by the encoder / helper code (protocol implementation lives there). -
LICENSEGPL-3.0 license.
The original LampSmart Pro Android app talks to the lamp by broadcasting specially-crafted BLE advertising packets, instead of maintaining a classic GATT connection.
LampSmartOpen reconstructs that behaviour:
-
You provide a lamp UUID in
.env. -
lampctrl.sh:- Parses the UUID, extracts the middle fields (e.g.
"27c7-500e"), - Treats them as a 32-bit value, adds 1, and formats it as
0xXXXXXXXX, - Passes that address to
lampctrlwith an operation code.
- Parses the UUID, extracts the middle fields (e.g.
-
lampctrl:- Implements the LampSmart V3 command format and encoder.
- Outputs one or more advertising payloads for
btmgmt.
-
btmgmt:- Enables LE, sets the advertising data, advertises briefly, then stops.
This mirrors what the vendor app does, but with transparent, auditable code.
To build and run LampSmartOpen, you’ll need:
-
A Linux system with:
- A BLE-capable adapter supported by BlueZ
btmgmt(usually provided by thebluezpackage)
-
Build toolchain:
cmakegccor another C compilermakeor Ninja, depending on how you invoke CMake
-
Runtime tools:
jq(to parse.env)
You’ll also need:
- A compatible LampSmart Pro lamp
- Basic familiarity with BLE advertising on Linux
Clone the repository (with submodules) and build the C binary:
git clone --recurse-submodules https://github.com/AuroraRAS/LampSmartOpen.git
cd LampSmartOpen
# Configure build directory
cmake -S . -B build
# Build the lampctrl binary
cmake --build buildDepending on your IDE or generator, the resulting binary may be located in something like:
build/lampctrl, orbuild/Desktop-Debug/lampctrl(IDE-generated build tree)
Make sure lampctrl.sh points to the correct path for your build.
The project uses a local .env file (JSON format) to store your lamp’s identifiers.
Example:
{
"lu": "89815eb1-27c7-500e-9d7f-d147a47ce477"
}In lampctrl.sh:
luis read viajq- The script extracts the 2nd and 3rd UUID groups (
27c7-500ein the example) - These hex chunks are concatenated (
27c7500e), interpreted as a 32-bit integer, and incremented by 1 - The result becomes the control address passed as
-atolampctrl, formatted like0x27c7500f
You can adjust .env if you have multiple lamps or different identifiers. At the moment, the script assumes one primary lamp UUID.
You typically need sudo to talk to btmgmt:
sudo btmgmt --index 0 power on
sudo btmgmt --index 0 le onThe script will also perform those steps automatically for its short burst, but it’s useful to verify that your adapter is working first.
After building lampctrl and configuring .env, you can run:
./lampctrl.shThe default script behaviour:
- Uses
IDX=0(first Bluetooth controller) - Reads
.envforlu - Computes the address
- Calls something like:
./build/Desktop-Debug/lampctrl -a 0x27c7500f -o 1- Sets an LE advertisement with the returned data via
btmgmt add-adv - Advertises briefly (
-D 2etc.), clears advertising, and powers LE off again
You can edit lampctrl.sh to:
- Change the adapter index (
IDX) - Use different operation codes (
-o) for other actions (e.g. off, dimming, etc.) - Change advertising duration
If you want to bypass the shell wrapper and call the encoder directly:
./build/lampctrl -a 0x27c7500f -o 1The exact options and supported operations are defined in main.c.
Typical parameters include at least:
-a <address>– 32-bit control address derived from the lamp UUID-o <opcode>– numeric operation code (e.g. 1 might represent “turn on”)
You can inspect / extend main.c to add more user-friendly commands (e.g. --on, --off, --brightness, etc.).
-
The project is GPL-3.0, so modifications and redistributions must remain open-source.
-
The code aims to be a clean, human-readable representation of the protocol, not just a decompiler dump.
-
Contributions that:
- clean up the encoder,
- add safer interfaces,
- or support more lamp models are very welcome.
- Trademarks: “LampSmart” / “LampSmart Pro” are likely trademarks of their respective owner. This project is not affiliated with or endorsed by them.
- Electrical safety: You are ultimately controlling mains-powered lighting. Don’t use this to automate anything that could cause fire risk or other hazards.
This project is licensed under the GNU General Public License v3.0.
See the LICENSE file for details.
LampSmartOpen は LampSmart Pro の制御ロジックをオープンソースで再実装したプロジェクトです。
Linux マシンから btmgmt など標準的なツールだけで BLE ランプを制御でき、ベンダーの Android アプリやクラウドは不要です。
⚠️ このプロジェクトは 実験的 で、BLE・Linux・リバースエンジニアリングに慣れている開発者/ハッカー向けです。利用は自己責任でお願いします。
-
完全ローカル制御 — クラウドもアプリも不要
-
LampSmart Pro(V3系)のプロトコル実装
-
小さくシンプルな C コア実装(BLE Advertising Payload生成ツール)
-
シェルラッパー
lampctrl.sh.envの UUID から制御アドレスを計算btmgmtを使って BLE Advertising を 1 回だけ送信
-
読みやすく、変更しやすく、再現可能
-
.envUUID などローカル設定(jqで読み取る) -
lampctrl.shlampctrlバイナリとbtmgmtを包むシェルスクリプト.envから UUID を抽出- UUID の一部から制御アドレスを生成
lampctrlを呼び出しペイロード生成btmgmtで Advertising を短時間送信
-
main.cコマンドラインツールlampctrlの実装。 LampSmart V3 のペイロードを生成。 -
CMakeLists.txtlampctrlのビルド設定。 -
.gitmodulesエンコーダ関係のサブモジュール。 -
LICENSE(GPL-3.0)
LampSmart Pro アプリは、GATT 接続ではなく、特別な BLE Advertising パケット を連続送信する方式でランプを制御している。
LampSmartOpen はその挙動を再現する。
-
.envにランプの UUID を記述 -
lampctrl.shが:- UUID の第2・第3フィールド(例:
27c7-500e)を抽出 - 連結して 32bit 数値に変換し +1
- それを
lampctrlに-aとして渡す
- UUID の第2・第3フィールド(例:
-
lampctrlが:- LampSmart V3 コマンドを構築
btmgmt add-adv用の Advertising データを出力
-
btmgmtが:- LE をオンにし、広告データをセット
- 2 秒程度広告したあと停止
Android アプリがしていることを透明かつシンプルに再現しているだけの構造。
-
Linux
- BLE 対応アダプタ(BlueZ サポート)
btmgmt(BlueZ パッケージに含まれる)
-
ビルドツール
cmakegcc(または対応する C コンパイラ)makeまたは Ninja
-
コマンドラインツール
jq(.env読み取り用)
必須ではないが、以下があると便利:
- LampSmart Pro 対応ランプ
- BLE Advertising の基礎知識
サブモジュール込みで clone。
git clone --recurse-submodules https://github.com/AuroraRAS/LampSmartOpen.git
cd LampSmartOpen
cmake -S . -B build
cmake --build buildlampctrl は IDE によって以下のような場所に出力されることがある:
build/lampctrlbuild/Desktop-Debug/lampctrl
lampctrl.sh 内のパスを適宜調整すること。
.env は JSON 形式で設定を書く。
例:
{
"lu": "89815eb1-27c7-500e-9d7f-d147a47ce477"
}スクリプトは:
- 第2・第3フィールド (
27c7-500e) を抽出 - 16進数を連結 →
27c7500e - 32bit として +1 →
0x27c7500f - それを制御アドレスとして
lampctrl -aに渡す
複数ランプを扱う場合は .env を複数管理しても良い。現状は単一 UUID を想定。
事前確認として:
sudo btmgmt --index 0 power on
sudo btmgmt --index 0 le onlampctrl.sh 自体もこれらを内部で行うが、動作確認のため手動で試す価値がある。
ビルド後、単純に:
./lampctrl.shデフォルト挙動:
.envから UUID を読み取り- 制御アドレス算出
- 例として:
./build/Desktop-Debug/lampctrl -a 0x27c7500f -o 1btmgmt add-advにペイロードを渡して広告- 数秒で広告停止
lampctrl.sh を編集すれば:
- Bluetooth アダプタ index (
IDX) - 操作コード (
-o) - 広告時間
など自由に変更できる。
./build/lampctrl -a 0x27c7500f -o 1サポートされるオプションは main.c に定義されている。
基本は:
-a <address>— 制御アドレス-o <opcode>— 操作コード(点灯/消灯/調光など)
必要に応じて --on, --off など分かりやすいラッパーを追加できる。
- GPL-3.0 のため、改変・再配布は同ライセンスで公開が必要
- コードは「デコンパイル結果をそのまま並べたもの」ではなく、可読性を重視
- エンコーダの整理や追加モデルの対応などのコントリビュートは歓迎
- 「LampSmart」「LampSmart Pro」はそれぞれの権利者の商標であり、当プロジェクトは非公式
- 制御対象は AC 電源に接続された照明器具であり、誤操作による危険に注意
本プロジェクトは GNU GPL v3.0 で公開されています。
詳細は LICENSE を参照してください。