### Start deCONZ-GUI Service Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Access-deCONZ-GUI-in-headless-setups Start the deCONZ-GUI service after configuring it to use the X server. ```bash sudo systemctl start deconz-gui ``` -------------------------------- ### Install QMake Dependencies Source: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/BUILDING.md Installs the deCONZ development package required for building with QMake on Linux. ```bash sudo apt install deconz-dev ``` -------------------------------- ### Install deCONZ REST API Plugin (Qt6) Source: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/BUILDING.md Installs the compiled plugin into a local temporary directory, adjusting the RPATH to find the libdeCONZ library. ```bash cmake --install build --prefix tmp ``` -------------------------------- ### Install Manual deCONZ Package Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Network-lost-and-configuration-restore-does-not-help Install the downloaded deCONZ .deb package using dpkg. This command installs the application and its dependencies. ```bash sudo dpkg -i deconz-2.05.77-qt5.deb ``` -------------------------------- ### Install Linux Qt6 Dependencies Source: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/BUILDING.md Installs necessary development packages for building with Qt6 on Debian-based systems. ```bash apt-get update && \ apt-get install --no-install-recommends -y \ lsb-release \ ca-certificates \ build-essential \ cmake \ pkg-config \ git \ sqlite3 \ libsqlite3-dev \ libgpiod-dev \ libssl-dev \ qt6-base-dev \ qt6-base-dev-tools \ qt6-serialport-dev \ qt6-websockets-dev \ qt6-declarative-dev \ qt6-5compat-dev \ dpkg-dev \ fakeroot \ curl \ wget ``` -------------------------------- ### Install Windows MINGW32 Dependencies Source: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/BUILDING.md Installs required Qt5 and OpenSSL packages for Windows development using MSYS2 MINGW32. ```bash pacman -Sy mingw-w64-i686-qt5 mingw-w64-i686-openssl mingw-w64-i686-sqlite3 ``` -------------------------------- ### Start Debug Logging in Headless Mode Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Debugging-101 Use these commands to stop the deCONZ services and start them with debug logging enabled in a headless installation. Logs are saved to debug.txt. Ensure you capture several minutes of logs, especially during pairing attempts. ```bash sudo systemctl stop deconz-gui sudo systemctl stop decon /usr/bin/deCONZ -platform minimal --dbg-aps=2 --dbg-info=2 --dbg-error=2 | tee debug.txt ``` -------------------------------- ### Install deCONZ Beta and Dev Package Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Compiling-the-REST-plugin-for-device-specific-testing Installs the latest beta version of deCONZ and the corresponding development package, which includes necessary headers and libraries for compiling plugins. ```bash sudo apt-get install deconz deconz-dev ``` -------------------------------- ### Auto Connect to Hardware Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/deCONZ-command-line-parameters Instruct deCONZ to automatically connect to a hardware device and start upon launch. ```bash /usr/bin/deCONZ --dev=/dev/ttyAMA0 --auto-connect=1 ``` -------------------------------- ### Install macOS Dependencies Source: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/BUILDING.md Installs Qt5, Ninja, and CMake using Homebrew for macOS development. This is currently only supported on Intel Macs. ```bash brew install qt@5 ninja cmake ``` -------------------------------- ### Start in Hybrid Mode Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/deCONZ-command-line-parameters Enable 'dev-test-managed' mode to allow devices to join and process data based on DDFs. ```bash /usr/bin/deCONZ --dev-test-managed=1 ``` -------------------------------- ### Download Manual deCONZ Installation Package Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Network-lost-and-configuration-restore-does-not-help For manual installations, download the latest deCONZ .deb package using wget. This is an alternative to using the apt repository. ```bash wget http://deconz.dresden-elektronik.de/ubuntu/beta/deconz-2.05.77-qt5.deb ``` -------------------------------- ### Start deCONZ Service (Raspbian/Ubuntu/Debian) Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Update-deCONZ-manually Restarts the deCONZ service after the firmware or package update. Use the command corresponding to your deCONZ installation type (headless or GUI). ```bash sudo systemctl start deconz ``` ```bash sudo systemctl start deconz-gui ``` -------------------------------- ### Install Linux Qt5 Dependencies Source: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/BUILDING.md Installs necessary development packages for building with Qt5 on older Debian-based systems. Note the alternative package names for newer Ubuntu versions. ```bash apt-get update && \ apt-get install --no-install-recommends -y \ qt5-default \ lsb-release ca-certificates build-essential pkg-config git \ libqt5serialport5-dev libqt5websockets5-dev qtdeclarative5-dev \ sqlite3 libsqlite3-dev libgpiod-dev libssl-dev curl cmake ninja-build ``` -------------------------------- ### Install deCONZ Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/deCONZ-on-Arm64-aarch64-Ubuntu-Focal,-Debian-Stretch. Installs the deCONZ software package. This is the core component for managing Zigbee devices. ```bash sudo apt install deconz ``` -------------------------------- ### Install deCONZ Build Dependencies (Ubuntu/Debian) Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Installs the necessary build dependencies for compiling the deCONZ REST plugin from source on Ubuntu/Debian systems, including Qt6 components. ```bash sudo apt-get update && sudo apt-get install --no-install-recommends -y \ build-essential cmake pkg-config git sqlite3 libsqlite3-dev \ libgpiod-dev libssl-dev \ qt6-base-dev qt6-base-dev-tools qt6-serialport-dev \ qt6-websockets-dev qt6-declarative-dev qt6-5compat-dev \ dpkg-dev fakeroot curl wget ninja-build ``` -------------------------------- ### Get All Lights (GET /api//lights) Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Retrieves the complete state of all paired light resources, including their on/off status, brightness, color, and reachability. Requires a valid API key. ```bash curl -s http://192.168.1.100:80/api/A1B2C3D4E5F6H8/lights | python3 -m json.tool ``` -------------------------------- ### Start deCONZ with Debugging Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Compiling-the-REST-plugin-for-device-specific-testing Starts deCONZ with specified debug flags to capture detailed output for troubleshooting. The output is redirected to a file named 'test_debug'. ```bash /usr/bin/deCONZ --dbg-info=2 --dbg-error=2 > test_debug ``` ```bash /usr/bin/deCONZ --platform minimal --dbg-info=2 --dbg-error=2 > test_debug ``` -------------------------------- ### Install deCONZ .deb Package Source: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/README.md Use these commands to manually install a deCONZ .deb package on Debian-based systems. Ensure to resolve any dependency issues with apt-get. ```bash sudo dpkg -i .deb sudo apt-get install -f ``` -------------------------------- ### Build the Plugin from Source (Linux/CMake) Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Compile the REST plugin against a local or custom deCONZ installation using CMake on Linux. ```APIDOC ## Build deCONZ REST Plugin from Source ### Description Compile the REST plugin against a local or custom deCONZ installation using CMake. ### Prerequisites (Ubuntu/Debian with Qt6) ```bash sudo apt-get update && sudo apt-get install --no-install-recommends -y \ build-essential cmake pkg-config git sqlite3 libsqlite3-dev \ libgpiod-dev libssl-dev \ qt6-base-dev qt6-base-dev-tools qt6-serialport-dev \ qt6-websockets-dev qt6-declarative-dev qt6-5compat-dev \ dpkg-dev fakeroot curl wget ninja-build ``` ### Build Steps ```bash # Clone the repository git clone https://github.com/dresden-elektronik/deconz-rest-plugin.git cd deconz-rest-plugin # Configure and build using CMake cmake -DCMAKE_INSTALL_PREFIX=/usr -DQT_VERSION_MAJOR=6 -G Ninja -B build cmake --build build cmake --install build --prefix tmp # The compiled plugin is located at: # tmp/share/deCONZ/plugins/libde_rest_plugin.so # Copy to deCONZ plugins directory to activate sudo cp tmp/share/deCONZ/plugins/libde_rest_plugin.so /usr/share/deCONZ/plugins/ # Restart deCONZ service sudo systemctl restart deconz ``` ``` -------------------------------- ### Successful Firmware Update Output (Windows) Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Update-deCONZ-manually This is an example of the console output indicating a successful firmware update process on Windows. ```text read file success: deCONZ_ConBeeII_0x26780700.bin.GCF (163244 bytes) flash firmware connect \\.\COM8, baudrate 115200 command reset timeout connect \\.\COM8, baudrate 115200 query bootloader id V1 bootloader detected (60) bootloader synced: unlock! READY 100% uploading ############################################################# done, wait validation... firmware successful written ``` -------------------------------- ### Get Gateway Configuration (GET /api//config) Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Retrieves the full gateway configuration, including network settings, Zigbee channel, software version, and WebSocket port. Requires a valid API key. ```bash curl -s http://192.168.1.100:80/api/A1B2C3D4E5F6G7H8/config | python3 -m json.tool ``` -------------------------------- ### Get Light State Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Xiaomi-Aqara-QBKG12LM Retrieve the state of the lights associated with the Xiaomi Aqara QBKG12LM switch. ```APIDOC ## GET /lights/ ### Description Retrieves the state of the individual lights controlled by the switch. The switch typically exposes two lights, one for each rocker. ### Method GET ### Endpoint /lights/ ### Response #### Success Response (200) - **manufacturername** (string) - The manufacturer name of the device. - **modelid** (string) - The model ID of the device. - **name** (string) - The name assigned to the light. - **state** (object) - Contains the current state of the light. - **alert** (string) - The alert status of the light. - **on** (boolean) - Indicates if the light is currently on. - **reachable** (boolean) - Indicates if the light is reachable. - **swversion** (any) - The software version of the device (can be null). - **type** (string) - The type of the device, e.g., "Smart plug". - **uniqueid** (string) - The unique identifier for the light. ### Response Example ```json { "manufacturername": "LUMI", "modelid": "lumi.ctrl_ln2.aq1", "name": "Light 55", "state": { "alert": "none", "on": true, "reachable": true }, "swversion": null, "type": "Smart plug", "uniqueid": "00:15:8d:00:02:a1:e9:52-01" } ``` ``` -------------------------------- ### Get All Groups Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Lists all available light groups, providing a summary for each. Use a specific group ID to fetch full details. ```bash curl -s http://192.168.1.100:80/api/A1B2C3D4E5F6G7H8/groups | python3 -m json.tool ``` -------------------------------- ### Alternate Configuration Folder Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/deCONZ-command-line-parameters Use 'appdata' to specify an alternate configuration folder, useful for testing setups or running multiple deCONZ instances. ```bash /usr/bin/deCONZ --appdata=/home/deconz/ ``` -------------------------------- ### Enable deCONZ Systemd Service Source: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/README.md Enable the deCONZ systemd service to ensure deCONZ starts automatically at boot time. This is useful for headless operation. ```bash $ sudo systemctl enable deconz ``` -------------------------------- ### Get Group State (Hue API) Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Groups Example JSON response for a GET request to a single group on the Hue API. This shows the standard structure including name, lights, type, state, and action attributes. ```json { "name": "Living Room", "lights": [ "1", "2", "3", "4", "5", "6", "7", "8" ], "type": "Room", "state": { "all_on": false, "any_on": false }, "recycle": false, "class": "Living room", "action": { "on": false, "bri": 127, "hue": 5500, "sat": 254, "effect": "none", "xy": [ 0.6468, 0.348 ], "ct": 463, "alert": "none", "colormode": "hs" } } ``` -------------------------------- ### Docker Example: Build Custom deCONZ Image Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Compiling-the-REST-plugin-for-device-specific-testing Demonstrates how to build a custom deCONZ Docker image with a specific REST plugin repository and branch. This is an alternative for users preferring Docker. ```bash git clone https://github.com/franciscogouveia/docker-deconz-rest-plugin-test.git cd docker-deconz-rest-plugin-test docker pull marthoc/deconz docker build -t my-deconz-image --build-arg PLUGIN_REPOSITORY=https://github.com/XXXX/deconz-rest-plugin.git --build-arg PLUGIN_GIT_COMMIT=special_branch . ``` -------------------------------- ### Get Group State (deCONZ API) Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Groups Example JSON response for a GET request to a single group on the deCONZ REST API. This response includes deCONZ-specific attributes and differs in the structure and presence of certain fields compared to the Hue API. ```json { "action": { "bri": 127, "ct": 0, "effect": "none", "hue": 0, "on": false, "sat": 127, "xy": [ 0, 0 ] }, "devicemembership": [], "etag": "a395a7405598df6e0ac929d039e9cc8e", "hidden": false, "id": "49650", "lights": [ "8", "17", "11", "22", "25", "26", "20", "21" ], "lightsequence": [ "20", "25", "26", "8", "21", "22", "11", "17" ], "multideviceids": [], "name": "Living Room", "scenes": [], "state": 0 } ``` -------------------------------- ### Launch deCONZ (Headless / Service) Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Instructions for running deCONZ as a headless systemd service, including how to customize HTTP and WebSocket ports. ```APIDOC ## Running deCONZ as a Headless Service ### Description Run deCONZ as a headless systemd service with custom HTTP and WebSocket ports. ### Service Management ```bash # Enable headless service at boot sudo systemctl enable deconz sudo systemctl disable deconz-gui sudo systemctl stop deconz-gui # Override HTTP port via systemd drop-in sudo systemctl edit deconz # Paste into editor: # [Service] # ExecStart= # ExecStart=/usr/bin/deCONZ --http-port=8080 --ws-port=8081 # Apply and restart sudo systemctl daemon-reload sudo systemctl restart deconz ``` ### Direct Launch (Testing) Launch deCONZ directly for testing purposes (headless, specific device, debug enabled). ```bash /usr/bin/deCONZ \ -platform minimal \ --dev=/dev/ttyAMA0 \ --auto-connect=1 \ --http-port=8080 \ --ws-port=8081 \ --dbg-info=2 ``` ### Parameters - `--http-port` (integer) - Specifies the HTTP port. - `--ws-port` (integer) - Specifies the WebSocket port. - `-platform minimal` - Runs deCONZ without a GUI. - `--dev=` - Specifies the serial device for the Zigbee coordinator. - `--auto-connect=1` - Automatically connect to the Zigbee device. - `--dbg-info=` - Sets the debug information level. ``` -------------------------------- ### Configure deCONZ Automatic Startup with Arguments Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/deCONZ-on-macOS This plist file configures deCONZ to start automatically on login and allows passing command-line arguments. Customize the ProgramArguments, WorkingDirectory, and log file paths as needed. Ensure deCONZ is stopped cleanly before modifying related files. ```xml Disabled KeepAlive Label de.dresden-elektronik/deCONZ ProgramArguments /Applications/deCONZ.app/Contents/MacOS/deCONZ --http-port=80 --dbg-ddf=1 --dbg-error=2 --dbg-js=1 WorkingDirectory /Users/ebaauw StandardErrorPath /Users/ebaauw/Library/Logs/deCONZ.log StandardOutPath /Users/ebaauw/Library/Logs/deCONZ.log ``` -------------------------------- ### Launch deCONZ Directly for Testing (Headless) Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Starts deCONZ directly from the command line in a headless mode, specifying custom ports, the serial device, and debug levels. Useful for testing configurations. ```bash /usr/bin/deCONZ \ -platform minimal \ --dev=/dev/ttyAMA0 \ --auto-connect=1 \ --http-port=8080 \ --ws-port=8081 \ --dbg-info=2 ``` -------------------------------- ### Update deCONZ Package (Ubuntu/Debian Stable) Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Update-deCONZ-manually Downloads and installs the latest stable deCONZ package for Ubuntu/Debian. Use dpkg to install the downloaded .deb file. ```bash wget https://deconz.dresden-elektronik.de/ubuntu/stable/deconz-2.31.2-qt5.deb ``` ```bash sudo dpkg -i deconz-2.31.2-qt5.deb ``` -------------------------------- ### Compile REST Plugin Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Compiling-the-REST-plugin-for-device-specific-testing Navigates to the cloned plugin directory and compiles the REST plugin using qmake and make. The '-j2' flag can be removed on less powerful machines to prevent freezing. ```bash cd ./test qmake && make -j2 ``` -------------------------------- ### Add deCONZ beta APT Repository Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Compiling-the-REST-plugin-for-device-specific-testing Adds the deCONZ beta APT repository to your system's sources. This is a prerequisite for installing beta versions of deCONZ and its development packages. ```bash sudo sh -c "echo 'deb http://phoscon.de/apt/deconz $(lsb_release -cs)-beta main' > /etc/apt/sources.list.d/deconz.list" ``` -------------------------------- ### Get All Groups (Hue API) Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Groups The Hue API returns the full state of each group when performing a GET request to `/groups`. Note that Group 0 (all lights) is typically excluded. ```json { "10": { "name": "Living Room", "lights": [ "1", "2", "3", "4", "5", "6", "7", "8" ], "type": "Room", "state": { "all_on": false, "any_on": false }, "recycle": false, "class": "Living room", "action": { "on": false, "bri": 127, "hue": 5500, "sat": 254, "effect": "none", "xy": [ 0.6468, 0.348 ], "ct": 463, "alert": "none", "colormode": "hs" } } } ``` -------------------------------- ### Headless Operation with Minimal Platform Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/deCONZ-command-line-parameters Use '-platform minimal' for headless operation. Omit it to access the GUI. This parameter requires a single dash. ```bash /usr/bin/deCONZ -platform minimal --auto-connect=1 ``` -------------------------------- ### Configure deCONZ Service (Raspbian) Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Update-deCONZ-manually Optional step to check and configure the deCONZ service file, ensuring it starts correctly after a reboot. Modify the ExecStart line as needed. ```bash sudo nano /lib/systemd/system/deconz.service ``` ```bash ExecStart=/usr/bin/deCONZ -platform minimal --http-port=8081 ``` -------------------------------- ### Enable Headless deCONZ Service at Boot Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Configures deCONZ to run as a headless systemd service, disabling the GUI and ensuring it starts automatically on boot. Custom ports can be specified. ```bash sudo systemctl enable deconz sudo systemctl disable deconz-gui sudo systemctl stop deconz-gui ``` -------------------------------- ### Get All Groups (deCONZ API) Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Groups The deCONZ API provides a partial state of each group on a GET request to `/groups`. This response includes `devicemembership`, `etag`, `hidden`, and `name`, but omits detailed state information found in the Hue API. ```json { "49650": { "devicemembership": [], "etag": "a395a7405598df6e0ac929d039e9cc8e", "hidden": false, "name": "Living Room" } } ``` -------------------------------- ### Import deCONZ Public Key Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/deCONZ-on-Arm64-aarch64-Ubuntu-Focal,-Debian-Stretch. This command fetches and adds the deCONZ public GPG key to your system's APT keyring, allowing it to verify packages from the deCONZ repository. ```bash wget -O - http://phoscon.de/apt/deconz.pub.key | sudo apt-key add - ``` -------------------------------- ### GET Sensor Data Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Xiaomi-WXKG03LM-2016 Retrieve the current state and configuration of the WXKG03LM sensor via the REST-API. ```APIDOC ## GET /sensors/ ### Description Retrieves the current state and configuration of the WXKG03LM sensor. ### Method GET ### Endpoint /sensors/ ### Response #### Success Response (200) - **manufacturername** (string) - The manufacturer of the device. - **modelid** (string) - The model ID of the device. - **type** (string) - The type of the sensor (e.g., ZHASwitch). - **uniqueid** (string) - The unique identifier for the device. - **state** (object) - Contains the current state of the sensor. - **buttonevent** (number) - The event code for the button press. - **lastupdated** (string) - The timestamp of the last update. - **config** (object) - Contains the configuration of the sensor. - **battery** (number) - The battery level of the device. - **on** (boolean) - Indicates if the device is on. - **reachable** (boolean) - Indicates if the device is reachable. - **temperature** (number) - The current temperature measured by the device. ### Response Example ```json { "manufacturername": "LUMI", "modelid": "lumi.sensor_86sw1", "type": "ZHASwitch", "uniqueid": "00:15:8d:00:01:2a:34:44-01-0006", "state": { "buttonevent": 1002, "lastupdated": "2017-11-04T19:14:12" }, "config": { "battery": 100, "on": true, "reachable": true, "temperature": 2300 } } ``` ### Button events | Event | Button | Action | |-------|---------|--------------| | 1002 | One | short press | ``` -------------------------------- ### Get All Lights Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Retrieves the complete state of all paired light resources, including their current status and capabilities. ```APIDOC ## Get All Lights (`GET /api//lights`) ### Description Returns the full state of all paired light resources, including on/off, brightness, color, and reachability. ### Method GET ### Endpoint `/api//lights` ### Parameters #### Path Parameters - **apikey** (string) - Required - The API key obtained during registration. ### Response #### Success Response (200) - A dictionary where keys are light IDs and values are light resource objects. - **etag** (string) - ETag for resource versioning. - **hascolor** (boolean) - Indicates if the light supports color. - **manufacturer** (string) - The manufacturer of the light. - **modelid** (string) - The model ID of the light. - **name** (string) - The name of the light. - **state** (object) - The current state of the light. - **alert** (string) - The current alert status. - **bri** (integer) - The brightness level (0-254). - **colormode** (string) - The current color mode (e.g., "xy", "hs", "ct"). - **ct** (integer) - The color temperature. - **effect** (string) - The current effect applied. - **hue** (integer) - The hue value. - **on** (boolean) - Whether the light is on. - **reachable** (boolean) - Whether the light is reachable. - **sat** (integer) - The saturation value. - **xy** (array) - The XY color coordinates. - **swversion** (string) - The software version of the light. - **type** (string) - The type of the light (e.g., "Extended color light"). - **uniqueid** (string) - The unique ID of the light. ### Response Example ```json { "1": { "etag": "1e6fe902a4aa8c0bbd2ef8528f654532", "hascolor": true, "manufacturer": "Philips", "modelid": "LCT003", "name": "Living Room 1", "state": { "alert": "none", "bri": 254, "colormode": "xy", "ct": 370, "effect": "none", "hue": 13158, "on": true, "reachable": true, "sat": 210, "xy": [0.312615, 0.329362] }, "swversion": "5.50.1.19085", "type": "Extended color light", "uniqueid": "00:17:88:01:00:f0:71:18-0b" } } ``` ``` -------------------------------- ### Get Sensor State Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Xiaomi-Aqara-QBKG12LM Retrieve the current state and configuration of the Xiaomi Aqara QBKG12LM switch as a sensor. ```APIDOC ## GET /sensors/ ### Description Retrieves the sensor data for the switch, including button events and device state. ### Method GET ### Endpoint /sensors/ ### Response #### Success Response (200) - **manufacturername** (string) - The manufacturer name of the device. - **modelid** (string) - The model ID of the device. - **type** (string) - The type of the device, e.g., "ZHASwitch". - **uniqueid** (string) - The unique identifier for the device. - **state** (object) - Contains the current state of the sensor. - **buttonevent** (number) - The last button event that occurred. - **lastupdated** (string) - The timestamp of the last update. - **config** (object) - Contains the configuration of the sensor. - **battery** (number) - The battery level of the device. - **on** (boolean) - Indicates if the device is currently on. - **reachable** (boolean) - Indicates if the device is reachable. - **temperature** (number) - The current temperature reported by the device. ### Response Example ```json { "manufacturername": "LUMI", "modelid": "lumi.ctrl_ln2.aq1", "type": "ZHASwitch", "uniqueid": "00:15:8d:00:02:a1:e9:52-05-0012", "state": { "buttonevent": 3002, "lastupdated": "2018-11-04T19:14:12" }, "config": { "battery": 100, "on": true, "reachable": true, "temperature": 2300 } } ``` ``` -------------------------------- ### Control a Light (PUT /api//lights//state) Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Sets the state of a specific light resource. Supports controlling on/off, brightness, hue, saturation, color temperature, and XY color space. Includes transition time for smooth changes. ```bash # Turn on with warm white color temperature at 80% brightness curl -s -X PUT http://192.168.1.100:80/api/A1B2C3D4E5F6G7H8/lights/1/state \ -H "Content-Type: application/json" \ -d '{"on": true, "bri": 200, "ct": 370, "transitiontime": 10}' # Response: # [{"success":{"/lights/1/state/on":true}}, # {"success":{"/lights/1/state/bri":200}}, # {"success":{"/lights/1/state/ct":370}}] ``` -------------------------------- ### Get All Sensors Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Retrieves all sensor resources, including their current state. The output is formatted using `json_tool` for readability. ```bash curl -s http://192.168.1.100:80/api/A1B2C3D4E5F6G7H8/sensors | python3 -m json.tool ``` -------------------------------- ### Get Sensor State Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Xiaomi-Aqara-QBKG11LM Retrieves the current state and configuration of the Xiaomi Aqara QBKG11LM switch via the REST-API. ```APIDOC ## GET /sensors/ ### Description Retrieves the current state and configuration of the Xiaomi Aqara QBKG11LM switch. ### Method GET ### Endpoint /sensors/ ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the sensor. ### Response #### Success Response (200) - **manufacturername** (string) - The manufacturer of the device. - **modelid** (string) - The model ID of the device. - **type** (string) - The type of the device (e.g., ZHASwitch). - **uniqueid** (string) - The unique ID of the device. - **state** (object) - The current state of the sensor. - **buttonevent** (integer) - The last button event code. - **lastupdated** (string) - The timestamp of the last update. - **config** (object) - The configuration of the sensor. - **battery** (integer) - The battery level. - **on** (boolean) - The on/off state of the switch. - **reachable** (boolean) - Indicates if the device is reachable. - **temperature** (integer) - The temperature reported by the device. #### Response Example ```json { "manufacturername": "LUMI", "modelid": "lumi.ctrl_ln1.aq1", "type": "ZHASwitch", "uniqueid": "00:15:8d:00:01:2a:34:44-01-0012", "state": { "buttonevent": 1002, "lastupdated": "2018-11-04T19:14:12" }, "config": { "battery": 100, "on": true, "reachable": true, "temperature": 2300 } } ``` ### Button events | Event | Button | Action | |-------|---------|---------------| | 1002 | One | single press | | 1004 | One | double press | ``` -------------------------------- ### Configure deCONZ-GUI service with device override Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Add---dev-flag-to-deconz-and-deconz-gui-services Use this configuration in a systemd override file to specify the deCONZ device when running the GUI version. This ensures deCONZ-GUI connects to the correct Conbee stick. ```bash [Service] ExecStart=/usr/bin/deCONZ --http-port=80 --dev=/dev/ttyACM0 ``` -------------------------------- ### Start deCONZ Service Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Compiling-the-REST-plugin-for-device-specific-testing Restarts the deCONZ service in the preferred running mode (GUI or headless) after the custom plugin has been copied. ```bash sudo systemctl start deconz-gui ``` ```bash sudo systemctl start deconz ``` -------------------------------- ### Get All Scenes in a Group Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Retrieves all scenes associated with a specific group. This is useful for listing available scenes before recalling or modifying them. ```bash curl -s http://192.168.1.100:80/api/A1B2C3D4E5F6G7H8/groups/1/scenes ``` -------------------------------- ### Create and Secure Core Dump Directory Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Enable-core-dumps-on-Raspbian Create the directory where core dumps will be stored and set appropriate permissions to ensure security and accessibility. ```bash # mkdir /var/lib/coredumps # chmod 1777 /var/lib/coredumps # ls -ld /var/lib/coredumps ``` ```text drwxrwxrwt 2 root root 4096 Sep 23 15:39 /var/lib/coredumps/ ``` -------------------------------- ### Restart deCONZ Service Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Network-lost-and-configuration-restore-does-not-help Restart the deCONZ service after updates. Use 'deconz' for headless setups and 'deconz-gui' for graphical environments. ```bash sudo systemctl restart deconz ``` ```bash sudo systemctl restart deconz-gui ``` -------------------------------- ### Clone and Build deCONZ REST Plugin from Source Source: https://context7.com/dresden-elektronik/deconz-rest-plugin/llms.txt Clones the deCONZ REST plugin repository and compiles it using CMake and Ninja. The output plugin is placed in a temporary directory. ```bash git clone https://github.com/dresden-elektronik/deconz-rest-plugin.git cd deconz-rest-plugin cmake -DCMAKE_INSTALL_PREFIX=/usr -DQT_VERSION_MAJOR=6 -G Ninja -B build cmake --build build cmake --install build --prefix tmp ``` -------------------------------- ### Configure Core Dump Pattern and Settings Source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Enable-core-dumps-on-Raspbian Define the naming pattern for core dump files and enable PID usage for core dumps. Also, set the SUID dumpable behavior. ```bash # cat > /etc/sysctl.d/core.conf <<+++ kernel.core_pattern = /var/lib/coredumps/core-%e-sig%s-user%u-group%g-pid%p-time%t kernel.core_uses_pid = 1 fs.suid_dumpable = 2 +++ ```