WiZ is a smart lighting brand under Signify that supports local UDP control within the same network. This project is a Python-based automation suite designed to test core functionalities of WiZ lights.
⚠️ This is a side project for learning and experimentation.
- Power control: ON / OFF
- Color adjustment: R / G / B / CW / WW (range: 0–225)
- Brightness control: 0–100
- Color temperature: 2700–6500K
- Light scenes:
scene_id1–28 (possibly more supported)
| Phase | Description | Link |
|---|---|---|
| Phase 1 | Basic test script | basic.py |
| Phase 2 | Refactored script with cleaner structure and result output | basic_refactor.py |
| Phase 3 | Pytest-based test suite | pytest/ |
| Phase 4 | CLI tool implementation |
cli.py |
| Phase 5 | Simple frontend for triggering tests |
app.py |
wiz-light-local-test-script
|__ modules/ # For the use of cli.py and app.py
| |__ __init__.py
| |__ communication.py # Build the udp connection, send and receive the udp packet
| |__ runner.py # Run the test cases
| |__ type_data.py # Test cases based on different device types
|__ pytest/
| |__ tests/
| | |__ conftest.py
| | |__ test_basic.py
| |__ pytest.ini
|__ simple_scripts
| |__ basic_refactor.py
| |__ basic.py
|__ cli.py # CLI tool
|__ app.py # streamlit
|__ README.md
First, download the script file
git clone https://github.com/maudes/wiz-light-local-test-script.git
cd wiz-light-local-test-script/simple_scriptsSecond, run the script with your test device's ip address
python3 basic_refactor.py --ip xxx.xxx.xxx.xxxHOW to find the device IP address? Install the device to WiZ app and check the device info
Last, check your result. In the best scenario, it shall shows as below:
WiZ response: {'method': 'getPilot', 'env': 'pro', 'result': {'mac': 'd8a011xxxxxx', 'rssi': -77, 'state': True, 'sceneId': 0, 'r': 100, 'g': 0, 'b': 140, 'c': 0, 'w': 0, 'dimming': 74}}
WiZ response: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
WiZ response: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
WiZ response: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
WiZ response: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
Total 5 tests passed, and 0 tests failed.
First, go into the pytest file
cd wiz_testThen, run the pytest in tests file
python3 -m pytest --ip=xxx.xxx.xxx.xxxAnd, you should see the test results shown as
..... [100%]
5 passed in 0.30sPlus, you can generate a HTML report (don't foreget to download pytest-html first!)
python3 -m pytest tests --html={filename}.htmlFirst, execute the file with ip address and device type.
python3 cli.py --ip xxx.xxx.xxx.xxx --type="Color light/ Tuneable white light/ Dimmable light"You shall receive results like below:
Total 10 with 10 tests passed and 0 tests failed.
get_state: {'method': 'getPilot', 'env': 'pro', 'result': {'mac': 'd8a011xxxxxx', 'rssi': -48, 'state': True, 'sceneId': 0, 'r': 100, 'g': 0, 'b': 140, 'c': 0, 'w': 0, 'dimming': 20}}
turn_off: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
turn_on_brightness: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
change_temp_warm: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
change_temp_cold: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
scene_relax: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
scene_ocean: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
scene_romance: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
scene_mojito: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
change_rgb: {'method': 'setPilot', 'env': 'pro', 'result': {'success': True}}
Install streamlit in your local machine, and run in local env (for receiving the UDP packet).
The default port of streamlit should be: http://localhost:8501
pip3 install streamlit
streamlit run app.pyIn terms of the UI, you can have a look here.