Tiếng Việt | English
A python script allow watch Luxpower SNA inverter in realtime. Tested in Luxpower SNA 6K with old wifi dongle (BAxxxxxx wifi name)See wiki from lxp-bridge here. (You can ignore AC charge setup)
- Copy
.env.exampleto.env - Update configuration in
.envwith your info
You can control which inverter input frame is requested by setting READ_INPUT_MODE in .env:
READ_INPUT_MODE=INPUT1(aliases:INPUT1,READINPUT1,READ_INPUT1): request only ReadInput1 (register0, count40)READ_INPUT_MODE=ALL: request ReadInput1 -> ReadInput4 sequentially (registers0,40,80,120)
ALL provides the most complete data set by combining ReadInput1-4, while INPUT1 uses smaller payloads.
- Sync gitsubmodule with
git submodule init && git submodule update - Python 3 required
- Setup python venv with
python -m venv venv - Active python venv
source venv/Scripts/activateon git-bash Windows orsource venv/bin/activeon Unix/Linux - Install dependencies with
pip install -r requirements.txtor./pip-binary-install.shon low-end device (example: OpenWrt router) - Run application with
python app.py
If you can't install and run you can use docker method bellow
- cd to
dockerfolder - run command
docker compose up -dto run docker container
You can implement your own notification app for Android/iOS and save tokens to devices.json to receive push alerts when grid connection state changes.
The author also provides a Lux App Viewer (Android/iOS). If you need it, feel free to contact for more support.
The built-in web server exposes mobile-friendly APIs:
POST /fcm/registerwith JSON (or form body)token=<firebase_device_token>to register a device tokenGET /mobile/stateto read current grid connection state and state-change history
- Build FE with command
cd web_viewer/fe_src && yarn install && yarn build(Ignore this step if you run via docker) - Now you can see LuxPower realtime web viewer in http://localhost:88 (or another port if you changed
PORTin.env). - HTTPS is also supported; enable it by setting
HTTPS_ENABLED=trueand providingHTTPS_PORT,HTTPS_CERT_FILE, andHTTPS_KEY_FILEin.env.
The app includes a built-in trigger/automation system that can control Tuya smart devices and send push notifications based on inverter data conditions.
Each trigger follows a When → Conditions → Action model:
- When: Optional time window and day-of-week filter (e.g. only on weekdays from 08:00–18:00)
- Conditions: One or more conditions that must all be met (e.g. SOC < 30%, PV power > 2000W, or a Tuya device DPS value)
- Action: Execute one or more actions when all conditions are met (e.g. turn on a relay, set a DPS value, or send a push notification)
- Run tinytuya wizard (
python -m tinytuya wizard) to discover Tuya devices on your network and generatedevices.json - Add devices in Settings → Devices tab (or they are auto-imported from
devices.json) - Create triggers in Settings → Triggers tab
- Set
ADMIN_ALLOWED_CIDRin.envto allow remote access to trigger configuration
- Control any local Tuya device (on/off, toggle, set value) via Wi-Fi
- Conditions based on inverter data (SOC, PV power, grid power, battery temperature, etc.) or Tuya device DPS values
- Support for multiple actions per trigger
- Cooldown period to prevent rapid re-triggering
- Execution history with detailed action logs (last 10 per trigger)
- Push notifications via Firebase Cloud Messaging (FCM)
- Test triggers manually from the UI
Note: Tuya devices must be on the same local network. The app uses
tinytuyafor direct local device control — no cloud API required.
This project is licensed under the MIT License. See the LICENSE file for details.
Thanks to @celsworth by awesome project celsworth/lxp-packet (has been deleted) and celsworth/lxp-bridge (under MIT License)
This project includes code from aiohttp library (https://github.com/aio-libs/aiohttp.git) which is licensed under the Apache License 2.0.
