### Example: Hourly Energy Production Request Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Example request to get the hourly energy production for a specific meter on a given date. This uses the 'diff' endpoint for preprocessed data. ```http getStatistic/_diff_/1661983200/1662069599/hour/1/total ``` -------------------------------- ### Add or Edit User Request Example Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Example of a request to add a new user by omitting the UUID. The 'addoredituser/{json}' endpoint is used. ```bash jdev/sps/addoredituser/{"name":"A","userid":"1234","changePassword":true,"userState":4,"validUntil":371738510,"validFrom":371736410,"expirationAction":{ACTION}} ``` -------------------------------- ### Irrigation Zone Configuration Example Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Example of a zone object within the 'zones' array for Irrigation control. It specifies the zone ID, name, and duration, and whether the duration is set by logic. ```json [{"id":0,"name":"Name of zone","duration":600}] ``` -------------------------------- ### Commit Convention Example Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/AGENTS.md Examples of commit messages following the conventional commits specification. Scopes like 'core', 'auth', 'http', 'ws' are used to categorize changes. ```bash feat(core): add timeout parameter ``` ```bash fix(auth): handle token expiry ``` ```bash build(deps): pin ws to 8.20.1 ``` -------------------------------- ### Spot Price Optimizer Forecast Example Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md This JSON object represents a forecast for the Spot Price Optimizer, indicating the unique ID, value, start and end timestamps, and whether the output is planned. ```json { "u": "1a173fef-02bf-223c-ffff504f94a00067", "v": 24.795, "s": 1668510000, "e": 1668513600, "planned": true } ``` -------------------------------- ### IntercomV2 Options Resolution Example Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Example of an optionsResolution object, used to specify video resolution settings for IntercomV2 devices. The 'id' is used in the setvideosettings command. ```json { "id": 720, "name": "720p" } ``` -------------------------------- ### IntercomV2 Options Framerate Example Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Example of an optionsFramerate object, used to specify video framerate settings for IntercomV2 devices. The 'id' is used in the setvideosettings command. ```json { "id": 5, "name": "5 fps" } ``` -------------------------------- ### Set Sequence Command (ColorPickerV2) Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Use this command to set a sequence for the ColorPickerV2. Specify the duration in seconds, up to six colors separated by '/', and an optional start index for the sequence. A start index of -1 means the sequence position will not be modified. ```bash setSequence/{duration_seconds}/{color_n...}/{startIdx} ``` -------------------------------- ### Get List of Existing Options for Fields Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Retrieves the available options for general system fields. ```APIDOC ## Get List of Existing Options for Fields ### Description Retrieves the existing options for system fields. ### Method GET ### Endpoint /fields/options/{field_name} ### Parameters #### Path Parameters - **field_name** (string) - Required - The name of the system field. ### Response #### Success Response (200) - **options** (array) - A list of available options for the specified system field. #### Response Example { "options": [ "string" ] } ``` -------------------------------- ### Intelligent Room Controller Daytimer v2 Custom Temperature Example Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Example illustrating the binary representation and extraction of a custom temperature (22.5°C) and heating-only mode from a Daytimer entry value. ```text Double: 57.648,0 UInt32: 57.648 Binary: 0000 0000 0000 0000 1110 0001 0011 0000 Binary: 000 **1** 0000 Binary: 00 **11** 0000 Binary: 0 **101** 0000 Binary: 0 **111** 0000 Binary: 0000 0000 1110 0001 Binary: 0000 0000 1110 0001 INT16-Value: 225 Target-Temperature: 22.5°C ``` -------------------------------- ### startTimer Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Starts the timer with the currently defined duration. ```APIDOC ## POST /startTimer ### Description Starts the timer with the defined duration. ### Method POST ### Endpoint /startTimer ``` -------------------------------- ### SpotPriceOptimizer Commands Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Provides details on commands available for the SpotPriceOptimizer, including starting, canceling, and retrieving forecasts. ```APIDOC ## cancel ### Description Cancel active cycle. ### Method POST ### Endpoint /dev/smarteon/loxone/SpotPriceOptimizer/cancel ## start/[demand in hours]/[period in hours] ### Description Start a new cycle with the given parameters. When demand is set by logic the parameter can be set to 0. ### Method POST ### Endpoint /dev/smarteon/loxone/SpotPriceOptimizer/start/[demand in hours]/[period in hours] ## getForecasts ### Description Current available forecast objects as json array. ### Method GET ### Endpoint /dev/smarteon/loxone/SpotPriceOptimizer/getForecasts ### Response #### Success Response (200) - **u** (string) - unique id - **v** (number) - value - **s** (integer) - Start Unix UTC Timestamp - **e** (integer) - End Unix UTC Timestamp - **planned** (boolean) - optional, true when the block has planned to activate the output at this timestamp ``` -------------------------------- ### Intelligent Room Controller v2 Commands Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md This section details the commands available for the Intelligent Room Controller v2, specifically for starting an override timer. ```APIDOC ## override/{modeId}/[{until}]/[{temp}] ### Description Starts an override timer. ### Method POST ### Endpoint /override/{modeId}/[{until}]/[{temp}] ### Parameters #### Path Parameters - **modeId** (integer) - Required - The requested modeId of the timer. - **until** (integer) - Optional - Seconds since 2009 when the timer should end. - **temp** (float) - Optional - The target temperature for the override. ``` -------------------------------- ### Start Mode Timer Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Set a specific mode for a defined duration or indefinitely. ```APIDOC ## POST startmodetimer/{mode}/{until}/{modeend} ### Description Sets a specific mode for a given duration. If you want to set a mode without a timer, use the `setMode` command. Setting `until` to zero stops an existing timer, and `-1` activates the mode endlessly. ### Method POST ### Endpoint /startmodetimer/{mode}/{until}/{modeend} ### Parameters #### Path Parameters - **mode** (integer) - Required - The mode to be set during the timer period. - **until** (integer) - Required - Seconds since 2009 until the timer should run. `0` stops the timer, `-1` activates the mode endlessly. - **modeend** (integer) - Required - The mode to be set after the timer elapses or is stopped. ### Request Example POST /startmodetimer/2/7200/1 ``` -------------------------------- ### Get all available users Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Retrieves a list of all configured users in the system. ```APIDOC ## GET /jdev/sps/getuserlist2 ### Description Gets a list of all configured users. ### Method GET ### Endpoint /jdev/sps/getuserlist2 ### Response #### Success Response (200) - expirationAction (object) - Describes the action taken upon user expiration. - ActionDeactivate (integer) - Value representing deactivation. - ActionDelete (integer) - Value representing deletion. ``` -------------------------------- ### Get all configurable user-groups Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Lists all available user groups and their associated information. ```APIDOC ## GET /jdev/sps/getgrouplist ### Description Lists all available user-groups and additional information. ### Method GET ### Endpoint /jdev/sps/getgrouplist ``` -------------------------------- ### Miniserver Command Format Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/CommunicatingWithMiniserver.md Format for sending commands to the Miniserver. Commands can start with 'jdev/' for JSON format or 'dev/' for deprecated XML format. ```HTTP “ - _jdev/sps/io/{uuid}/{command}_ ” ``` ```HTTP all commands can either start with “ _jdev/_ ” or just “ _dev_ /" - _“jdev/”_ in JSON-Format (Beware, the answer will contain ‘dev’ instead of ‘jdev’) - _“dev/”_ delivers responses in XML-Format and is deprecated ``` -------------------------------- ### Get User Details Command Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Retrieve full user configuration details using the 'getuser/{uuidUser}' command. Requires the user's UUID. ```bash jdev/sps/getuser/{uuidUser} ``` -------------------------------- ### Get User Groups Command Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Lists all available user groups and their associated information using the 'getgrouplist' command. ```bash jdev/sps/getgrouplist ``` -------------------------------- ### get Command Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Retrieves calculated data values for a specified view type, including power, energy, and financial data. ```APIDOC ## get/{viewType} ### Description Retrieves pre-calculated data values for a specified view type. This command is useful for obtaining aggregated energy statistics. ### Method GET ### Endpoint `/get/{viewType}` ### Parameters #### Path Parameters - **viewType** (string) - Specifies the type of data to retrieve. Possible values are the same as for `getNodeValue` command: `actual`, `day`, `week`, `month`, `year`, `lifetime`. ### Response #### Success Response (200) A JSON object containing calculated data values. - **Actual**: Includes `Gpwr`, `Ppwr`, `Spwr`, `Cpwr` (Power of loads), and `Rest`. - **Day, week, month, year, lifetime**: Includes `Export`, `Import`, `Production`, `Charge`, `Discharge`, `Consumption`, and `Income`. ``` -------------------------------- ### Get User List Command Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Use the 'getuserlist2' command to retrieve a list of all configured users. The response includes expiration actions. ```bash jdev/sps/getuserlist2 ``` -------------------------------- ### Working with Miniserver Information Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone-app-parsing.md Retrieve and display general information about the Miniserver, including its name, serial number, project name, local URL, and temperature unit. ```kotlin val msInfo = app.msInfo println("Miniserver: ${msInfo.msName}") println("Serial: ${msInfo.serialNr}") println("Project: ${msInfo.projectName}") println("Local URL: ${msInfo.localUrl}") println("Temperature Unit: ${if (msInfo.tempUnit == 0) "°C" else "°F"}") when (msInfo.miniserverType) { 0 -> println("Miniserver Gen 1") 1 -> println("Miniserver Go Gen 1") 2 -> println("Miniserver Gen 2") 3 -> println("Miniserver Go Gen 2") 4 -> println("Miniserver Compact") } msInfo.currentUser?.let { user -> println("User: ${user.name}") println("Admin: ${user.isAdmin}") println("UUID: ${user.uuid}") } ``` -------------------------------- ### Get Statistic Info Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Retrieves information about available statistics for a given control, including IDs and the start date of availability. ```APIDOC ## Get Statistic Info ### Description Get info about statistics of a control. ### Method GET ### Endpoint `/sps/getStatisticInfo/{controlUuid}` ### Parameters #### Path Parameters - **controlUuid** (string) - Required - The UUID of the control. ### Response #### Success Response (200) - **id** (integer) - Statistic group id. - **activeSince** (integer) - Unix UTC timestamp, specifies since what date statistics are available. ``` -------------------------------- ### Build and Publish Locally Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/README.md Use this command to build and publish the library locally if you need to use a version from master that has not yet been released. ```bash ./gradlew build publishToMavenLocal ``` -------------------------------- ### Authenticate using Token (Plaintext - Version 11.2+) Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/CommunicatingWithMiniserver.md Starting with version 11.2, the token can be sent in plaintext instead of a hash for authentication. This example shows the WebSocket command format. ```text authwithtoken/{token}/{user} ``` -------------------------------- ### Acquiring Tokens Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/CommunicatingWithMiniserver.md This section outlines the steps to acquire a JSON Web Token (JWT) for authentication with the Loxone Miniserver. It involves retrieving a key and salt, hashing the password, and then requesting the token with appropriate permissions and client information. The process requires specific parameters and encryption for security. ```APIDOC ## Acquiring Tokens ### Description Acquire a JSON Web Token (JWT) for authentication with the Loxone Miniserver. This process involves obtaining a key and salt, hashing the password, and then requesting the token with specific permissions and client details. Encryption is required for the token request. ### Steps: 1. **Get Key, Salt, and Hash Algorithm:** - **Endpoint:** `jdev/sys/getkey2/{user}` - **Method:** GET (or equivalent for the interface) - **Path Parameters:** - `{user}` (string) - The username for whom to acquire the token. - **Response:** Returns `key`, `salt` (referred to as `{userSalt}`), and `hashAlg`. 2. **Hash the Password:** - Hash the string `{password}:{userSalt}` using the `hashAlg` obtained in the previous step. The result should be uppercase and referred to as `{pwHash}`. 3. **Create the Final Hash:** - Hash the string `{user}:{pwHash}` using HMAC-SHA1 or HMAC-SHA256 with the `key` from the `getkey2` request. The result (`{hash}`) should not be converted to upper or lower case. - **Optional:** Append `?tokenHash=true` to the command if using a hashed token (supported since v12.2.10.6). 4. **Request JSON Web Token:** - **Endpoint:** `jdev/sys/getjwt/{hash}/{user}/{permission}/{uuid}/{info}` - **Method:** POST (or equivalent, requires encryption) - **Path Parameters:** - `{hash}` (string) - The final hash created in the previous step. - `{user}` (string) - The username. - `{permission}` (integer) - Specifies the token's permissions and lifespan (e.g., web-permission=2, app-permission=4). - `{uuid}` (string) - A unique identifier for the client requesting the token (e.g., "098802e1-02b4-603c-ffffeee000d80cfd"). - `{info}` (string) - A URL-encoded text describing the client (e.g., "Thomas%20iPhone%20X"). - **Encryption:** This request **must be encrypted**. - **Optional (since v12.2):** If using a token to acquire a new token, `{hash}` will be a token-hash, and `?authHash=True` should be appended. ### Response (Success): - **{token}** (string) - The JSON Web Token itself. - **{validUntil}** (integer) - The token's lifespan in seconds since 1.1.2009. - **{tokenRights}** (bitmap) - A bitmap indicating granted permissions. - **{unsecurePass}** (boolean) - True if a weak password is in use. - **{key}** (string) - Can be used for subsequent commands. ``` -------------------------------- ### Switch on Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Activates the switch. ```APIDOC ## POST /on ### Description Activates the switch. ### Method POST ### Endpoint /on ``` -------------------------------- ### Get All Available Users Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Retrieves a list of all users available in the system. This is useful for getting an overview of registered users. ```APIDOC ## Get All Available Users ### Description Retrieves a list of all users. ### Method GET ### Endpoint /user ### Response #### Success Response (200) - **users** (array) - List of user objects. #### Response Example { "users": [ { "user": { "name": "string", "uuid": "string" } } ] } ``` -------------------------------- ### Gradle Build Commands Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/AGENTS.md Common Gradle tasks for building, testing, and publishing the loxone-client-kotlin library. Ensure JDK 21 is used for building. ```bash ./gradlew check ``` ```bash ./gradlew jvmTest ``` ```bash ./gradlew detekt ``` ```bash ./gradlew koverXmlReport ``` ```bash ./gradlew publishToMavenLocal ``` ```bash ./gradlew dokkaHtml ``` ```bash ./gradlew jvmAcceptanceTest ``` ```bash ./gradlew release -Prelease.versionIncrementer=incrementPatch ``` ```bash ./gradlew kotlinUpgradeYarnLock ``` -------------------------------- ### Acquire Key, Salt, and Hash Algorithm Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/CommunicatingWithMiniserver.md Use this endpoint to retrieve the necessary 'key', 'salt', and 'hashAlg' for token acquisition. The 'salt' is user-specific and referred to as {userSalt}. ```http GET /jdev/sys/getkey2/{user} ``` -------------------------------- ### Authenticating using Tokens Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/CommunicatingWithMiniserver.md This section details how to authenticate with the Loxone Miniserver using an acquired token, either via HTTP requests or WebSocket. It involves preparing a hash of the token and appending it to the appropriate command. ```APIDOC ## Authenticating using Tokens ### Description Authenticate with the Loxone Miniserver using an acquired JSON Web Token (JWT) or legacy token. This involves preparing a hash of the token and appending it to the authentication command for either HTTP requests or WebSockets. ### Steps: 1. **Prepare the Token Hash:** - Hash the `{token}` along with the result of a `getkey` request using HMAC-SHA1 or HMAC-SHA256. - **Note:** As of v10.0, both JWTs and legacy tokens can be used. Starting with v11.2, the token can also be sent in plaintext. 2. **Prepare the Authentication Command (`{authCmd}`):** - **For WebSockets:** `authwithtoken/{hash}/{user}` - **For HTTP Requests:** Append `?autht={hash}&user={user}` to the existing command. 3. **Encrypt and Send the `{authCmd}`:** - Details on encrypted commands via Websocket. - Details on encrypted commands via HTTP-Requests. ``` -------------------------------- ### Get Statistic Info Request Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Use this endpoint to get information about available statistics for a control. The response includes the statistic group ID and the timestamp since which statistics are available. ```http _jdev/sps/getStatisticInfo/{controlUuid}_ ``` -------------------------------- ### Set Temperature Color Command (ColorPickerV2) Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Sets a light color using temperature values, suitable for warm or cold white lighting. Requires brightness and temperature parameters. ```bash temp({brightness},{temperature}) ``` -------------------------------- ### Download Structure File Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/CommunicatingWithMiniserver.md Requests the Loxone Miniserver's structure file. This is a text-based file containing configuration details. The Miniserver will respond with appropriate message headers. ```http GET /data/LoxAPP3.json ``` -------------------------------- ### Receive Real-time Events Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/README.md Connect to the Miniserver via WebSocket and collect real-time events. Ensure binary status updates are enabled to receive events. ```kotlin val endpoint = LoxoneEndpoint.fromUrl("http://192.168.1.100") val authenticator = LoxoneTokenAuthenticator(LoxoneProfile(endpoint, LoxoneCredentials("user", "pass"))) val wsClient = KtorWebsocketLoxoneClient(endpoint, authenticator) // Enable binary status updates to start receiving events wsClient.callForMsg(LoxoneCommands.App.enableBinStatusUpdate()) // Collect events scope.launch { wsClient.events.collect { event -> when (event) { is ValueEvent -> println("Value: ${event.uuid} = ${event.value}") is TextEvent -> println("Text: ${event.uuid} = ${event.text}") is DaytimerEvent -> println("Daytimer: ${event.uuid}") is WeatherEvent -> println("Weather: ${event.uuid}") } } } ``` -------------------------------- ### Prepare Authentication Command for HTTP Requests Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/CommunicatingWithMiniserver.md Append '?autht={hash}&user={user}' to the existing command for HTTP request authentication. ```http ?autht={hash}&user={user} ``` -------------------------------- ### Secured Commands Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/CommunicatingWithMiniserver.md This section details the process of sending secured commands to the Miniserver, which involves obtaining a visualization password, generating hashes, and then sending the command. ```APIDOC ## Secured Commands ### Description This endpoint allows for sending commands to the Miniserver that require a visualization password for authentication. ### Steps: 1. Request the visualization password from the user. 2. Obtain a key, salt, and hashing algorithm from the Miniserver using the endpoint `_jdev/sys/getvisusalt/{user}_`. 3. Create a hash of the visualization password and salt using the specified hashing algorithm: `{visuPwHash}`. 4. Create an HMAC hash using the `visuPwHash` and the key obtained in step 2. 5. Send the secured command to the Miniserver using the endpoint `_jdev/sps/ios/{hash}/{uuid}/{command}_`. ### Response Codes: - **200 OK**: Password was correct and command executed successfully. - **500 Internal Server Error**: Password was incorrect. ### Check Visualization Password To verify the visualization password without executing a command, use the endpoint `jdev/sps/checkuservisupwd/{hash}`. ``` -------------------------------- ### Ventilation Timer Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Start or stop the ventilation timer. ```APIDOC ## POST startVentilationTimer/{secondsSince2009Until} ### Description Starts or stops the ventilation timer. A value of 0 stops the timer, and -1 keeps it running indefinitely. ### Method POST ### Endpoint /startVentilationTimer/{secondsSince2009Until} ### Parameters #### Path Parameters - **secondsSince2009Until** (integer) - Required - The duration in seconds since 2009 until the ventilation should run. Use `0` to stop, `-1` for always on. ### Request Example POST /startVentilationTimer/3600 ``` -------------------------------- ### Get All Permissions for a Control Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Retrieves all permissions associated with a specific control. ```APIDOC ## Get All Permissions for a Control ### Description Retrieves all permissions for a control. ### Method GET ### Endpoint /permissions/control/{control_uuid} ### Parameters #### Path Parameters - **control_uuid** (string) - Required - The unique identifier of the control. ### Response #### Success Response (200) - **permissions** (object) - An object containing permission details for the control. #### Response Example { "permissions": { "read": [ "string" ], "write": [ "string" ] } } ``` -------------------------------- ### Get Codes Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Retrieves a JSON array of Code objects configured on the keypad. ```APIDOC ## Get Codes ### Description Retrieves a JSON array with Code objects from this keypad. ### Method GET ### Endpoint `/codes` ### Response #### Success Response (200) - **codes** (array) - A JSON array of Code objects. - **uuid** (string) - Unique identifier for the code. - **name** (string) - Name of the code. - **isActive** (boolean) - Indicates if the code is currently active. - **isEmpty** (boolean) - Indicates if the code has not yet been set. - **type** (int) - Type of code (0-5). - **outputs** (int) - Bitmask representing permitted outputs. - **standardOutput** (int) - The standard output for this code (1-6). - **timeFrom** (int, optional) - Unix timestamp in UTC for time-dependent codes. - **timeTo** (int, optional) - Unix timestamp in UTC for time-dependent codes. ``` -------------------------------- ### Prepare Authentication Command for WebSockets Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/CommunicatingWithMiniserver.md Prepare the {authCmd} for WebSocket authentication using the generated {hash} and {user}. ```text authwithtoken/{hash}/{user} ``` -------------------------------- ### Generic Control Command Format Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/protocol-gap-analysis.md This is the expected format for sending generic control commands to Loxone devices. It is currently not implemented. ```text jdev/sps/io/{uuid}/{command} ``` -------------------------------- ### HTTP Request Command Encryption Steps Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/CommunicatingWithMiniserver.md Follow these steps to encrypt commands for HTTP requests to the Miniserver. This involves acquiring the public key, preparing the command, generating keys and salts, encrypting with AES, and then encrypting the session key with RSA. ```plaintext 1. Acquire the Miniservers public key via “jdev/sys/getPublicKey” -> {publicKey} 2. Prepare your command -> {cmd} 3. Generate a random salt, hex string (length may vary, e.g. 2 bytes) -> {salt} 4. Prepend the salt to the actual message “salt/{salt}/{cmd}” ->{plaintext} 5. Generate a AES256 key -> {key} (Hex) 6. Generate a random AES iv (16 byte) -> {iv} (Hex) 7. Encrypt the {plaintext} with AES {key} + {iv} -> {cipher} (Base64) 8. URI-Component-Encode the {cipher} -> {enc-cipher} 9. Prepare the command-> {encrypted-command} 10. RSA Encrypt the AES key+iv with the {publicKey} -> {session-key} (Base64) 11. URI-Component-Encode the {session-key} -> {enc-session-key} 12. Append the session key to the {encrypted-command} -> {encrypted-command} 13. Send the request! ``` -------------------------------- ### Get all permissions for a control Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Retrieves a list of all users and groups directly assigned to a control. ```APIDOC ## Get all permissions for a control ### Description Returns a list of all users and groups assigned to a control. ### Method GET ### Endpoint getcontrolpermissions/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The UUID of the control. ``` -------------------------------- ### Get all permissions for a control Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Retrieves a list of all users and groups directly assigned to a control. ```HTTP getcontrolpermissions/{uuid} ``` -------------------------------- ### Download Loxone App Configuration Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone-app-parsing.md Download the complete Loxone app configuration. Check the last modified date to avoid unnecessary downloads if the configuration has not changed. ```kotlin val app = client.call(LoxoneCommands.App.get()) ``` ```kotlin val version = client.call(LoxoneCommands.App.version()) if (version.lastModified != cachedApp.lastModified) { val newApp = client.call(LoxoneCommands.App.get()) } ``` -------------------------------- ### Get All Details for a User Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Fetches comprehensive details for a specific user identified by their UUID. ```APIDOC ## Get All Details for a User ### Description Retrieves all details for a specific user. ### Method GET ### Endpoint /user/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the user. ### Response #### Success Response (200) - **user** (object) - Detailed information about the user. #### Response Example { "user": { "name": "string", "uuid": "string", "email": "string", "enabled": "boolean", "validFrom": "string", "validUntil": "string", "userstate": "integer", "type": "integer", "userrights": { "admin": "boolean", "control": "boolean", "room": "boolean", "device": "boolean" }, "groups": [ "string" ], "passwords": { "visu": "boolean", "admin": "boolean" }, "keycodes": [ { "keyCode": "string", "validFrom": "string", "validUntil": "string" } ], "nfctags": [ { "nfcTag": "string", "validFrom": "string", "validUntil": "string" } ] } } ``` -------------------------------- ### Get Current Cooling Period Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/OperatingModeSchedule.md Retrieves the current cooling period information from the Miniserver. ```APIDOC ## Get Current Cooling Period ### Description Returns the current cooling period on the Miniserver. The return value comes as ISO-Date start/end, e.g., 10-15/04-15. ### Method GET ### Endpoint /jdev/sps/calendargetcoolperiod ``` -------------------------------- ### Work with Different Control Types and States Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone-app-parsing.md Access specific states (e.g., 'active', 'position', 'tempActual') for various control types like Switches, Dimmers, Jalousies, and Intelligent Room Controllers. Also demonstrates accessing sub-controls. ```kotlin // Switch val switch = app.getControlsByType("Switch").first() val activeState = switch.getState("active") ``` ```kotlin // Dimmer val dimmer = app.getControlsByType("Dimmer").first() val positionState = dimmer.getState("position") ``` ```kotlin // Jalousie (Blinds) val jalousie = app.getControlsByType("Jalousie").first() val upState = jalousie.getState("up") val downState = jalousie.getState("down") val positionState = jalousie.getState("position") ``` ```kotlin // Intelligent Room Controller V2 val irc = app.getControlsByType("IRoomControllerV2").first() val tempActual = irc.getState("tempActual") val tempTarget = irc.getState("tempTarget") val operatingMode = irc.getState("activeMode") irc.subControls?.forEach { (name, subControl) -> when (subControl.type) { "Temperature" -> println("Temperature sensor: ${subControl.name}") "Daytimer" -> println("Daytimer: ${subControl.name}") } } ``` -------------------------------- ### Get Current Heating Period Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/OperatingModeSchedule.md Retrieves the current heating period information from the Miniserver. ```APIDOC ## Get Current Heating Period ### Description Returns the current heating period on the Miniserver. The return value comes as ISO-Date start/end, e.g., 10-15/04-15. ### Method GET ### Endpoint /jdev/sps/calendargetheatperiod ``` -------------------------------- ### Create User Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/UserManagement.md Creates a new user with a specified username. ```APIDOC ## POST /jdev/sps/createuser/{username} ### Description Creates a user with the given username. The result will contain the UUID of the new user. ### Method POST ### Endpoint /jdev/sps/createuser/{username} ### Parameters #### Path Parameters - **username** (string) - Required - The desired username for the new user. ``` -------------------------------- ### Get History Source: https://github.com/smarteon/loxone-client-kotlin/blob/master/docs/loxone/StructureFile.md Retrieves a JSON array containing history entry objects for access events. ```APIDOC ## Get History ### Description Retrieves a JSON array with history entry objects. ### Method GET ### Endpoint `/history` ### Response #### Success Response (200) - **history** (array) - A JSON array of history entry objects. - **ts** (int) - Unix timestamp in UTC. - **output** (int) - Output number (1-6, 1-9999 with preselection, 0 for 2FA first factor, -1 for denied access). - **type** (int) - Type of event (0-11). - **user** (string, optional) - Name of the user. - **description** (string, optional) - Description of the event (e.g., code name, tag name). - **extMedium** (string, optional) - External medium used (for types 10 and 11). - **extAuthority** (string, optional) - External authority (for types 10 and 11). ```