Gaute Svanes Lunde | e7347ea | 2023-01-09 19:43:07 +0100 | [diff] [blame] | 1 | # Python-based lighting example (bridge) device to DALI |
Markus Becker | eddf2b4 | 2021-12-02 08:16:46 +0100 | [diff] [blame] | 2 | |
| 3 | ## Installation |
| 4 | |
| 5 | Build the Python/C library: |
| 6 | |
| 7 | ```shell |
| 8 | cd ~/connectedhomeip/ |
| 9 | git submodule update --init |
| 10 | source scripts/activate.sh |
| 11 | |
| 12 | ./scripts/build_python_device.sh --chip_detail_logging true |
| 13 | |
| 14 | sudo su # dhclient is called, needs root |
| 15 | source ./out/python_env/bin/activate |
| 16 | ``` |
| 17 | |
| 18 | Install the python dependencies: |
| 19 | |
| 20 | ```shell |
| 21 | pip3 install python-dali |
| 22 | ``` |
| 23 | |
| 24 | Plug-in a python-dali compatible USB-DALI interface. |
| 25 | |
| 26 | ## Usage |
| 27 | |
| 28 | Run the Python lighting matter device: |
| 29 | |
| 30 | ```shell |
| 31 | cd examples/lighting-app/python |
| 32 | python lighting.py |
| 33 | ``` |
| 34 | |
| 35 | Control the Python lighting matter device: |
| 36 | |
| 37 | ```shell |
| 38 | source ./out/python_env/bin/activate |
| 39 | |
| 40 | chip-device-ctrl |
| 41 | |
| 42 | chip-device-ctrl > connect -ble 3840 20202021 12344321 |
Song GUO | 5d19a987 | 2021-12-14 04:16:13 +0800 | [diff] [blame] | 43 | chip-device-ctrl > zcl NetworkCommissioning AddOrUpdateWiFiNetwork 12344321 0 0 ssid=str:YOUR_SSID credentials=str:YOUR_PASSWORD breadcrumb=0 |
| 44 | chip-device-ctrl > zcl NetworkCommissioning ConnectNetwork 12344321 0 0 networkID=str:YOUR_SSID breadcrumb=0 |
Markus Becker | eddf2b4 | 2021-12-02 08:16:46 +0100 | [diff] [blame] | 45 | chip-device-ctrl > close-ble |
| 46 | chip-device-ctrl > resolve 5544332211 1 (pass appropriate fabric ID and node ID, you can get this from get-fabricid) |
| 47 | chip-device-ctrl > zcl OnOff Toggle 12344321 1 0 |
| 48 | ``` |