openapi: 3.0.3
info:
  title: CoAP Loader API Documentation
  description: |
    This section provides the technical specifications for the three REST endpoints used by the CoAP Loader to forward data from Efento NB-IoT sensors to your platform.

  version: 3.0.0

tags:
  - name: Measurements
    description: Endpoint for receiving periodic measurement data from sensors
  - name: Configuration
    description: Endpoint for receiving sensor configuration updates
  - name: Device Info
    description: Endpoint for receiving device hardware and diagnostics information

paths:
  /measurements:
    post:
      tags:
        - Measurements
      summary: Receive measurements from sensors
      description: |
        ## Overview
        
        This endpoint is used by the CoAP Loader to forward periodic measurement data from Efento NB-IoT sensors to your platform.
        
        **Important:** The endpoint paths shown in this documentation (`/measurements`, `/configuration`, `/device-info`) are **examples only**.
    
        The actual endpoint URLs are fully configurable in the CoAP Loader's `application.yml` file
        
        **When is it called?**
        - At regular intervals configured on the sensor (e.g., every 15 minutes)
        - When a rule/alarm is triggered on the sensor
        - When the sensor's buffer is full
        
        **What data do you receive?**
        - Sensor readings: temperature, humidity, pressure, alarms, water/electricity meters, air quality, etc.
        - Metadata: battery status, signal strength, measurement timestamps
        - Multiple sensors can send data in a single request
        
        ## Request Structure
        
        **Method:** `POST`
        
        **Endpoint:** Configurable in `application.yml` under the `endpoint` key. The path `/measurements` shown here is just an example.
        
        **Headers:**
        - `Content-Type: application/json`
        - `charset: UTF-8`
        - `X-Api-Token: "optional api token"` (if configured on sensor via CLOUD_TOKEN parameter)
        
        **Body:** JSON array containing measurement objects. Each measurement object includes:
        - `serial` - Unique sensor identifier
        - `battery` - Battery status: "ok" or "low"
        - `signal` - Signal quality (0-63, based on RSSI)
        - `measured_at` - UTC timestamp of measurement
        - `measurement_interval` - Interval between measurements in seconds
        - `next_measurement_at` - Scheduled UTC time for next connection
        - `params` - Array of measured parameters (channels 1-6)
        
        ## Data Filtering - Empty Measurements
        
        The CoAP Loader automatically filters out channels with type "NO_SENSOR" (unconfigured/disabled sensor channels). This may result in:
        - **Empty measurements array**: If all sensor channels are of type NO_SENSOR, the measurements array will be empty and **no data will be forwarded** to your REST API
        - **Partial data**: Only channels with actual sensors connected will be included in the request
        
        This is normal behavior - sensors can have 1-6 channels, and not all channels need to be physically connected.
        
        ## Response Options
        
        Your platform must respond with HTTP status code **2xx** (e.g., 200, 201, or 204) to confirm receipt.
        
        ### Option 1: Empty Response
        Simply confirms receipt of data:
        ```json
        {}
        ```
        
        ### Option 2: Configuration Update
        You can include a JSON object in the response body to remotely change the sensor's settings:
        ```json
        {
          "parameters": [
            {
              "type": "MEASUREMENT_PERIOD",
              "settings": {
                "period": "600"
              }
            }
          ]
        }
        ```
        
        For a full list of available configuration parameter types and their validation rules, see the **ConfigurationParametersReference** in the Models section.
        
        ## Response: Configuration Parameter Validation
        
        When you return configuration parameters in the response:
        - **Duplicate parameter types**: If you send multiple parameters with the same `type`, the CoAP Loader will keep only the **last occurrence** and log a warning
        - **Invalid parameters**: Parameters that fail validation (wrong value ranges, missing required fields, etc.) are **automatically removed** and logged as errors - the remaining valid parameters are still applied to the sensor
        - **Partial success**: Even if some parameters fail validation, the valid ones will be sent to the sensor
        
        ## Important - Software Version Compatibility
        
        Configuration updates are only supported on sensors with modern firmware. The CoAP Loader determines this by checking the sensor's `hash` value:
        - **hash = "0"**: Deprecated software version - configuration changes are NOT sent to the sensor (the CoAP Loader will log a warning and skip configuration)
        - **hash > "0"**: Modern software version - configuration changes can be applied normally
        
        If you send configuration parameters in the response for a sensor with hash="0", they will be ignored by the CoAP Loader.
      operationId: receiveMeasurements
      parameters:
        - name: X-Api-Token
          in: header
          description: Optional API token for authentication (if configured)
          required: false
          schema:
            type: string
            example: your_api_token
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
            default: application/json
        - name: charset
          in: header
          required: true
          schema:
            type: string
            default: UTF-8
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - measurements
              properties:
                measurements:
                  type: array
                  description: Array of measurement objects from sensors
                  items:
                    $ref: '#/components/schemas/Measurement'
            examples:
              multipleSensors:
                summary: Multiple sensors with different parameters
                value:
                  measurements:
                    - serial: "282C024FFFB1"
                      battery: "ok"
                      signal: 13
                      measured_at: "2018-10-12 15:28:21"
                      measurement_interval: 180
                      next_measurement_at: "2018-10-12 18:28:21"
                      params:
                        - channel: 1
                          type: "temperature"
                          value: 6
                          status: "ok"
                    - serial: "282C024FFFB2"
                      battery: "ok"
                      signal: 21
                      measured_at: "2026-02-09 15:28:21"
                      measurement_interval: 180
                      next_measurement_at: "2026-02-09 18:58:21"
                      params:
                        - channel: 1
                          type: "temperature"
                          value: "12"
                          status: "ok"
                        - channel: 2
                          type: "humidity"
                          value: "51"
                          status: "ok"
      responses:
        '2XX':
          description: |
            Success - Data received successfully.
            
            You can return an empty response or include configuration parameters to update the sensor.
            See endpoint description above for details on parameter validation and error handling.
            
            **HTTP to CoAP mapping:** Any 2xx HTTP status code (200, 201, 204, etc.) will be converted to CoAP 2.01 CREATED.
            
            **Sensor behavior:** The sensor receives the response and applies any configuration parameters included in the response body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfigurationResponse'
              examples:
                emptyResponse:
                  summary: Empty response confirming receipt
                  value: { }
                basicConfiguration:
                  summary: Basic configuration - ACK interval and measurement period
                  value:
                    parameters:
                      - type: "ACK_INTERVAL"
                        settings:
                          mode: "CUSTOM"
                          interval: "3600"
                      - type: "MEASUREMENT_PERIOD"
                        settings:
                          period: "180"
                transmissionInterval:
                  summary: Change transmission interval
                  value:
                    parameters:
                      - type: "TRANSMISSION_INTERVAL"
                        settings:
                          interval: "900"
                serverConfiguration:
                  summary: Server configuration with IP and port
                  value:
                    parameters:
                      - type: "SERVER_DATA"
                        settings:
                          ip: "192.168.1.100"
                          port: "5683"
                ruleHighThreshold:
                  summary: Rule - High temperature threshold with alarm
                  description: Triggers transmission when temperature exceeds 25°C with 2°C hysteresis, using moving average of 3 samples
                  value:
                    parameters:
                      - type: "RULE_1"
                        settings:
                          condition: "HIGH_THRESHOLD"
                          action: "ACTION_TRIGGER_TRANSMISSION_WITH_ACK"
                          type: "TEMPERATURE"
                          channelNumbers: "1"
                          threshold: "25.0"
                          hysteresis: "2.0"
                          averageMode: "MOVING_AVERAGE"
                          averageNumberOfSamples: "3"
                ruleLowThreshold:
                  summary: Rule - Low humidity threshold
                  description: Triggers transmission when humidity drops below 30% with 5% hysteresis
                  value:
                    parameters:
                      - type: "RULE_2"
                        settings:
                          condition: "LOW_THRESHOLD"
                          action: "ACTION_TRIGGER_TRANSMISSION"
                          type: "HUMIDITY"
                          channelNumbers: "2"
                          threshold: "30.0"
                          hysteresis: "5.0"
                          averageMode: "CONSECUTIVE_SAMPLES"
                          averageNumberOfSamples: "2"
                ruleDiffThreshold:
                  summary: Rule - Temperature change threshold
                  description: Triggers when temperature changes by more than 5°C between consecutive measurements
                  value:
                    parameters:
                      - type: "RULE_3"
                        settings:
                          condition: "DIFF_THRESHOLD"
                          action: "ACTION_TRIGGER_TRANSMISSION"
                          type: "TEMPERATURE"
                          channelNumbers: "1"
                          threshold: "5.0"
                          averageMode: "WINDOW_MODE"
                          averageNumberOfSamples: "1"
                ruleBinaryChange:
                  summary: Rule - Binary state change (door sensor)
                  description: Triggers transmission when open-close sensor changes state
                  value:
                    parameters:
                      - type: "RULE_4"
                        settings:
                          condition: "BINARY_CHANGE_STATE"
                          action: "ACTION_TRIGGER_TRANSMISSION_WITH_ACK"
                          channelNumbers: "3"
                ruleLogicOperator:
                  summary: Rule - Logic operator combining multiple rules
                  description: Triggers when both RULE_1 AND RULE_2 are active, with delays
                  value:
                    parameters:
                      - type: "RULE_5"
                        settings:
                          condition: "LOGIC_OPERATOR"
                          action: "ACTION_TRIGGER_TRANSMISSION"
                          logicOperator: "AND"
                          selectedRules: "1,2"
                          actionDelay: "300"
                          returnDelay: "600"
                ruleOnMeasurement:
                  summary: Rule - Trigger every N measurements
                  description: Triggers transmission every 10 measurements
                  value:
                    parameters:
                      - type: "RULE_6"
                        settings:
                          condition: "ON_MEASUREMENT"
                          action: "ACTION_TRIGGER_TRANSMISSION"
                          measurementTransmission: "10"
                ruleDisabled:
                  summary: Rule - Disabled
                  value:
                    parameters:
                      - type: "RULE_7"
                        settings:
                          condition: "DISABLED"
                ruleCalendar:
                  summary: Rule calendar - Active on weekdays
                  description: Activates RULE_1 and RULE_2 on weekdays from 8:00 to 17:00 (UTC+1)
                  value:
                    parameters:
                      - type: "RULE_CALENDAR_1"
                        settings:
                          type: "WEEK"
                          selectedRules: "1,2"
                          from: "480"
                          to: "1020"
                          timezone: "4"
                          days: "MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY"
                complexConfiguration:
                  summary: Complex configuration with multiple parameters
                  description: Complete sensor configuration with server, rules, transmission settings
                  value:
                    parameters:
                      - type: "MEASUREMENT_PERIOD"
                        settings:
                          period: "300"
                      - type: "TRANSMISSION_INTERVAL"
                        settings:
                          interval: "1800"
                      - type: "SERVER_DATA"
                        settings:
                          ip: "10.0.0.50"
                          port: "5683"
                      - type: "RULE_1"
                        settings:
                          condition: "HIGH_THRESHOLD"
                          action: "ACTION_TRIGGER_TRANSMISSION_WITH_ACK"
                          type: "TEMPERATURE"
                          channelNumbers: "1"
                          threshold: "30.0"
                          hysteresis: "2.0"
                          averageMode: "MOVING_AVERAGE"
                          averageNumberOfSamples: "5"
                      - type: "RULE_2"
                        settings:
                          condition: "LOW_THRESHOLD"
                          action: "ACTION_TRIGGER_TRANSMISSION"
                          type: "HUMIDITY"
                          channelNumbers: "2"
                          threshold: "20.0"
                          hysteresis: "5.0"
                          averageMode: "CONSECUTIVE_SAMPLES"
                          averageNumberOfSamples: "3"
                      - type: "RULE_CALENDAR_1"
                        settings:
                          type: "WEEK"
                          selectedRules: "1,2"
                          from: "420"
                          to: "1140"
                          timezone: "4"
                          days: "MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY,SUNDAY"
        '401':
          description: |
            Unauthorized.
            
            **HTTP to CoAP mapping:** HTTP 401 or 403 will be converted to CoAP 4.01 UNAUTHORIZED.
            
            **Sensor behavior:** The sensor does NOT receive any configuration updates. The sensor will retry according to its retry policy.
        '403':
          description: |
            Forbidden.
            
            **HTTP to CoAP mapping:** HTTP 401 or 403 will be converted to CoAP 4.01 UNAUTHORIZED.
            
            **Sensor behavior:** The sensor does NOT receive any configuration updates. The sensor will retry according to its retry policy.
        '3XX':
          description: |
            Redirection.
            
            **HTTP to CoAP mapping:** Any 3xx HTTP status code (301, 302, 304, etc.) will be converted to CoAP 5.00 INTERNAL SERVER ERROR.
            
            **Sensor behavior:** The sensor does NOT receive any configuration updates. The sensor will retry according to its retry policy.
        '4XX':
          description: |
            Client Error.
            
            **HTTP to CoAP mapping:** Any 4xx HTTP status code (except 401/403) will be converted to CoAP 4.00 BAD REQUEST.
            
            **Sensor behavior:** The sensor does NOT receive any configuration updates. The sensor will retry according to its retry policy.
        '5XX':
          description: |
            Server Error.
            
            **HTTP to CoAP mapping:** Any 5xx HTTP status code (500, 502, 503, etc.) will be converted to CoAP 5.00 INTERNAL SERVER ERROR.
            
            **Sensor behavior:** The sensor does NOT receive any configuration updates. The sensor will retry according to its retry policy.

  /configuration:
    post:
      tags:
        - Configuration
      summary: Receive sensor configuration
      description: |
        ## Overview
        
        This endpoint is used to report the current configuration settings stored in the sensor's memory.
        The CoAP Loader forwards this data to help you track and synchronize sensor settings with your platform.
        
        **Important:** The endpoint paths shown in this documentation (`/measurements`, `/configuration`, `/device-info`) are **examples only**.
        
        The actual endpoint URLs are fully configurable in the CoAP Loader's `application.yml` file
        
        **When is it called?**
        - During the **first communication** after sensor boot/reset
        - Whenever a **configuration change is detected** on the device (hash value changes)
        - After you remotely update sensor settings via the `/measurements` response
        
        **What data do you receive?**
        - Complete snapshot of all current sensor settings
        - Configuration metadata: hash (version), timestamp, serialNumber
        - Information about configuration split (if payload is divided into multiple parts)
        
        **Use cases:**
        - Synchronize your database with actual sensor settings
        - Audit and track configuration changes over time
        - Verify that remote configuration updates were applied successfully
        
        ## Request Structure
        
        **Method:** `POST`
        
        **Endpoint:** Configurable in `application.yml` under the `endpointConfiguration` key. The path `/configuration` shown here is just an example.
        
        **Headers:**
        - `Content-Type: application/json`
        - `charset: UTF-8`
        - `X-Api-Token: "optional api token"` (if configured on sensor via CLOUD_TOKEN parameter)
        
        **Body:** JSON object containing:
        - `serialNumber` - Unique sensor identifier
        - `timestamp` - Configuration timestamp
        - `hash` - Configuration version (changes with every update). **Important:** If hash = "0", the sensor runs deprecated software.
        - `partsCount` - Total number of configuration parts (for large configs)
        - `partIndex` - Current part index (1-based)
        - `parameters` - Array of configuration parameters. For detailed specification of all available parameter types, see **ConfigurationParametersReference** in the Models section.
        
        ## Data Processing Notes
        
        The CoAP Loader preprocesses the configuration data before forwarding:
        - **Duplicate parameters**: If the sensor sends duplicate parameter types, the CoAP Loader keeps only the **last occurrence** and logs a warning
        - **Invalid parameters**: Parameters that cannot be parsed are **automatically removed** and logged as errors - the remaining valid parameters are still forwarded to your API
        - **Partial data**: Even if some parameters fail to parse, you will receive all successfully parsed parameters
        
        ## Response
        
        Your platform must respond with HTTP status code **2xx** (e.g., 200, 201, or 204) with an **empty body** to confirm receipt.
        
        **Note:** Unlike `/measurements`, this endpoint does NOT support returning configuration updates in the response.
      operationId: receiveSensorConfiguration
      parameters:
        - name: X-Api-Token
          in: header
          description: Optional API token for authentication (if configured)
          required: false
          schema:
            type: string
            example: your_api_token
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
            default: application/json
        - name: charset
          in: header
          required: true
          schema:
            type: string
            default: UTF-8
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SensorConfiguration'
            examples:
              basicConfiguration:
                summary: Basic sensor configuration
                value:
                  serialNumber: "282C024FFFB1"
                  timestamp: "1"
                  partsCount: 1
                  partIndex: 1
                  hash: "1"
                  parameters:
                    - type: "ACK_INTERVAL"
                      settings:
                        mode: "CUSTOM"
                        interval: "3600"
                    - type: "MEASUREMENT_PERIOD"
                      settings:
                        period: "300"
                    - type: "TRANSMISSION_INTERVAL"
                      settings:
                        interval: "900"
              serverConfiguration:
                summary: Configuration with server and endpoints
                value:
                  serialNumber: "282C024FFFB1"
                  timestamp: "1707830000"
                  partsCount: 1
                  partIndex: 1
                  hash: "12345"
                  parameters:
                    - type: "SERVER_DATA"
                      settings:
                        ip: "192.168.1.100"
                        port: "5683"
                    - type: "DATA_ENDPOINT"
                      settings:
                        endpoint: "/api/data"
                    - type: "CONFIGURATION_ENDPOINT"
                      settings:
                        endpoint: "/api/config"
                    - type: "DEVICE_INFO_ENDPOINT"
                      settings:
                        endpoint: "/api/device"
              apnConfiguration:
                summary: Configuration with custom APN
                value:
                  serialNumber: "282C024FFFB1"
                  timestamp: "1707830000"
                  partsCount: 1
                  partIndex: 1
                  hash: "54321"
                  parameters:
                    - type: "APN"
                      settings:
                        mode: "CUSTOM"
                        apn: "internet.example.com"
                        apnUsername: "user123"
                        apnPassword: "pass123"
                    - type: "PLMN"
                      settings:
                        mode: "CUSTOM"
                        time: "26001"
                    - type: "BANDS"
                      settings:
                        bands: "1,3,5,8,20"
              highThresholdRule:
                summary: Configuration with high temperature threshold rule
                value:
                  serialNumber: "282C024FFFB1"
                  timestamp: "1707830000"
                  partsCount: 1
                  partIndex: 1
                  hash: "11111"
                  parameters:
                    - type: "RULE_1"
                      settings:
                        condition: "HIGH_THRESHOLD"
                        action: "ACTION_TRIGGER_TRANSMISSION_WITH_ACK"
                        type: "TEMPERATURE"
                        channelNumbers: "1"
                        threshold: "25.0"
                        hysteresis: "2.0"
                        averageMode: "MOVING_AVERAGE"
                        averageNumberOfSamples: "3"
              multipleRules:
                summary: Configuration with multiple rule types
                value:
                  serialNumber: "282C024FFFB1"
                  timestamp: "1707830000"
                  partsCount: 1
                  partIndex: 1
                  hash: "22222"
                  parameters:
                    - type: "RULE_1"
                      settings:
                        condition: "HIGH_THRESHOLD"
                        action: "ACTION_TRIGGER_TRANSMISSION_WITH_ACK"
                        type: "TEMPERATURE"
                        channelNumbers: "1"
                        threshold: "30.0"
                        hysteresis: "2.0"
                        averageMode: "MOVING_AVERAGE"
                        averageNumberOfSamples: "5"
                    - type: "RULE_2"
                      settings:
                        condition: "LOW_THRESHOLD"
                        action: "ACTION_TRIGGER_TRANSMISSION"
                        type: "HUMIDITY"
                        channelNumbers: "2"
                        threshold: "20.0"
                        hysteresis: "5.0"
                        averageMode: "CONSECUTIVE_SAMPLES"
                        averageNumberOfSamples: "3"
                    - type: "RULE_3"
                      settings:
                        condition: "DIFF_THRESHOLD"
                        action: "ACTION_TRIGGER_TRANSMISSION"
                        type: "TEMPERATURE"
                        channelNumbers: "1"
                        threshold: "5.0"
                        averageMode: "WINDOW_MODE"
                        averageNumberOfSamples: "1"
                    - type: "RULE_4"
                      settings:
                        condition: "BINARY_CHANGE_STATE"
                        action: "ACTION_TRIGGER_TRANSMISSION_WITH_ACK"
                        channelNumbers: "3"
              logicOperatorRule:
                summary: Configuration with logic operator rule
                value:
                  serialNumber: "282C024FFFB1"
                  timestamp: "1707830000"
                  partsCount: 1
                  partIndex: 1
                  hash: "33333"
                  parameters:
                    - type: "RULE_1"
                      settings:
                        condition: "HIGH_THRESHOLD"
                        action: "ACTION_NO_ACTION"
                        type: "TEMPERATURE"
                        channelNumbers: "1"
                        threshold: "25.0"
                        hysteresis: "2.0"
                        averageMode: "MOVING_AVERAGE"
                        averageNumberOfSamples: "3"
                    - type: "RULE_2"
                      settings:
                        condition: "LOW_THRESHOLD"
                        action: "ACTION_NO_ACTION"
                        type: "HUMIDITY"
                        channelNumbers: "2"
                        threshold: "30.0"
                        hysteresis: "5.0"
                        averageMode: "CONSECUTIVE_SAMPLES"
                        averageNumberOfSamples: "2"
                    - type: "RULE_5"
                      settings:
                        condition: "LOGIC_OPERATOR"
                        action: "ACTION_TRIGGER_TRANSMISSION_WITH_ACK"
                        logicOperator: "AND"
                        selectedRules: "1,2"
                        actionDelay: "300"
                        returnDelay: "600"
              ruleWithCalendar:
                summary: Configuration with rule calendar
                value:
                  serialNumber: "282C024FFFB1"
                  timestamp: "1707830000"
                  partsCount: 1
                  partIndex: 1
                  hash: "44444"
                  parameters:
                    - type: "RULE_1"
                      settings:
                        condition: "HIGH_THRESHOLD"
                        action: "ACTION_TRIGGER_TRANSMISSION"
                        type: "TEMPERATURE"
                        channelNumbers: "1"
                        threshold: "28.0"
                        hysteresis: "2.0"
                        averageMode: "MOVING_AVERAGE"
                        averageNumberOfSamples: "3"
                    - type: "RULE_CALENDAR_1"
                      settings:
                        type: "WEEK"
                        selectedRules: "1"
                        from: "480"
                        to: "1020"
                        timezone: "4"
                        days: "MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY"
              fullConfiguration:
                summary: Complete sensor configuration example
                description: Full configuration with server, rules, calendars, and network settings
                value:
                  serialNumber: "282C024FFFB1"
                  timestamp: "1707830000"
                  partsCount: 1
                  partIndex: 1
                  hash: "99999"
                  parameters:
                    - type: "MEASUREMENT_PERIOD"
                      settings:
                        period: "300"
                    - type: "TRANSMISSION_INTERVAL"
                      settings:
                        interval: "1800"
                    - type: "ACK_INTERVAL"
                      settings:
                        mode: "CUSTOM"
                        interval: "3600"
                    - type: "SERVER_DATA"
                      settings:
                        ip: "10.0.0.50"
                        port: "5683"
                    - type: "DATA_ENDPOINT"
                      settings:
                        endpoint: "/measurements"
                    - type: "CONFIGURATION_ENDPOINT"
                      settings:
                        endpoint: "/configuration"
                    - type: "CLOUD_TOKEN"
                      settings:
                        mode: "CUSTOM"
                        token: "my-secret-token-123"
                    - type: "APN"
                      settings:
                        mode: "CUSTOM"
                        apn: "internet"
                        apnUsername: "user"
                        apnPassword: "pass"
                    - type: "RULE_1"
                      settings:
                        condition: "HIGH_THRESHOLD"
                        action: "ACTION_TRIGGER_TRANSMISSION_WITH_ACK"
                        type: "TEMPERATURE"
                        channelNumbers: "1"
                        threshold: "30.0"
                        hysteresis: "2.0"
                        averageMode: "MOVING_AVERAGE"
                        averageNumberOfSamples: "5"
                    - type: "RULE_2"
                      settings:
                        condition: "LOW_THRESHOLD"
                        action: "ACTION_TRIGGER_TRANSMISSION"
                        type: "HUMIDITY"
                        channelNumbers: "2"
                        threshold: "20.0"
                        hysteresis: "5.0"
                        averageMode: "CONSECUTIVE_SAMPLES"
                        averageNumberOfSamples: "3"
                    - type: "RULE_CALENDAR_1"
                      settings:
                        type: "WEEK"
                        selectedRules: "1,2"
                        from: "420"
                        to: "1140"
                        timezone: "4"
                        days: "MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY,SUNDAY"
      responses:
        '2XX':
          description: |
            Success - Configuration data received successfully.
            Response body should be empty.
            
            **HTTP to CoAP mapping:** Any 2xx HTTP status code (200, 201, 204, etc.) will be converted to CoAP 2.01 CREATED.
            
            **Note:** This endpoint does NOT support returning configuration updates to the sensor. The sensor only sends configuration data and does not expect configuration in response.
          content:
            application/json:
              schema:
                type: object
                properties: { }
              example: { }
        '401':
          description: |
            Unauthorized.
            
            **HTTP to CoAP mapping:** HTTP 401 or 403 will be converted to CoAP 4.01 UNAUTHORIZED.
        '403':
          description: |
            Forbidden.
            
            **HTTP to CoAP mapping:** HTTP 401 or 403 will be converted to CoAP 4.01 UNAUTHORIZED.
        '3XX':
          description: |
            Redirection.
            
            **HTTP to CoAP mapping:** Any 3xx HTTP status code (301, 302, 304, etc.) will be converted to CoAP 5.00 INTERNAL SERVER ERROR.
        '4XX':
          description: |
            Client Error.
            
            **HTTP to CoAP mapping:** Any 4xx HTTP status code (except 401/403) will be converted to CoAP 4.00 BAD REQUEST.
        '5XX':
          description: |
            Server Error.
            
            **HTTP to CoAP mapping:** Any 5xx HTTP status code (500, 502, 503, etc.) will be converted to CoAP 5.00 INTERNAL SERVER ERROR.

  /device-info:
    post:
      tags:
        - Device Info
      summary: Receive device information
      description: |
        ## Overview
        
        This endpoint provides detailed hardware specifications, firmware versions, and technical diagnostics regarding the device's health and modem performance.
        
        **Important:** The endpoint paths shown in this documentation (`/measurements`, `/configuration`, `/device-info`) are **examples only**.
        
        The actual endpoint URLs are fully configurable in the CoAP Loader's `application.yml` file
        
        **When is it called?**
        - During the **first communication** after sensor boot/reset
        - Periodically (frequency depends on sensor configuration)
        - After firmware updates
        
        **What data do you receive?**
        - **Software information**: firmware version, commit ID
        - **Runtime diagnostics**: uptime, MCU temperature, battery voltage, message statistics
        - **Modem information**: modem type, network quality parameters (34 values for BC66 modem)
        - **Memory statistics**: internal memory usage/allocation
        - **Error tracking**: runtime error codes (if any)
        
        **Use cases:**
        - Monitor device health and battery status
        - Track firmware versions across your sensor fleet
        - Diagnose connectivity issues using modem parameters
        - Alert on critical conditions (low battery, high temperature, errors)
        
        ## Request Structure
        
        **Method:** `POST`
        
        **Endpoint:** Configurable in `application.yml` under the `endpointDeviceInfo` key. The path `/device-info` shown here is just an example.
        
        **Headers:**
        - `Content-Type: application/json`
        - `charset: UTF-8`
        - `X-Api-Token: "optional api token"` (if configured on sensor via CLOUD_TOKEN parameter)
        
        **Body:** JSON object containing device information fields (see DeviceInfo schema below for complete structure)
        
        ## Response
        
        Your platform must respond with HTTP status code **2xx** (e.g., 200, 201, or 204) with an **empty body** to confirm receipt.
        
        **Note:** This endpoint does NOT support returning configuration updates in the response.
      operationId: receiveDeviceInfo
      parameters:
        - name: X-Api-Token
          in: header
          description: Optional API token for authentication (if configured)
          required: false
          schema:
            type: string
            example: your_api_token
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
            default: application/json
        - name: charset
          in: header
          required: true
          schema:
            type: string
            default: UTF-8
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceInfo'
            examples:
              deviceInfoExample:
                summary: Device information example
                value:
                  serialNumber: "282C024FFFB1"
                  softwareVersion: "1546"
                  runtimeInfo:
                    uptime: 12345
                    confirmableMessagesAttempts: 50
                    nonConfirmableMessagesAttempts: 10
                    succeededMessages: 58
                    mcuTemperature: 22
                    minBatteryVoltage: 3600
                    minBatteryMcuTemperature: 20
                    batteryResetTimestamp: 1707830000
                    maxMcuTemperature: 35
                    minMcuTemperature: 15
                    runtimeErrors: [ ]
                  modemInfo:
                    modemType: "MODEM_TYPE_BC66"
                    parameters: [ 5, 12, 3 ]
                  commitId: "a1b2c3d4"
                  cloudToken: "token123"
                  memoryStatistics: [ 1024, 2048 ]
                  updateTimestamp: 1707830000
                  updateStatus: 0
      responses:
        '2XX':
          description: |
            Success - Device information received successfully.
            Response body should be empty.
            
            **HTTP to CoAP mapping:** Any 2xx HTTP status code (200, 201, 204, etc.) will be converted to CoAP 2.01 CREATED.
            
            **Note:** This endpoint does NOT support returning configuration updates to the sensor. The sensor only sends device information and does not expect configuration in response.
          content:
            application/json:
              schema:
                type: object
                properties: { }
              example: { }
        '401':
          description: |
            Unauthorized.
            
            **HTTP to CoAP mapping:** HTTP 401 or 403 will be converted to CoAP 4.01 UNAUTHORIZED.
        '403':
          description: |
            Forbidden.
            
            **HTTP to CoAP mapping:** HTTP 401 or 403 will be converted to CoAP 4.01 UNAUTHORIZED.
        '3XX':
          description: |
            Redirection.
            
            **HTTP to CoAP mapping:** Any 3xx HTTP status code (301, 302, 304, etc.) will be converted to CoAP 5.00 INTERNAL SERVER ERROR.
        '4XX':
          description: |
            Client Error.
            
            **HTTP to CoAP mapping:** Any 4xx HTTP status code (except 401/403) will be converted to CoAP 4.00 BAD REQUEST.
        '5XX':
          description: |
            Server Error.
            
            **HTTP to CoAP mapping:** Any 5xx HTTP status code (500, 502, 503, etc.) will be converted to CoAP 5.00 INTERNAL SERVER ERROR.

components:
  schemas:
    Measurement:
      type: object
      required:
        - serial
        - battery
        - signal
        - measured_at
        - measurement_interval
        - next_measurement_at
        - params
      properties:
        serial:
          type: string
          description: Unique serial number of the sensor
          example: "282C024FFFB1"
        battery:
          type: string
          description: Battery level status
          enum: [ ok, low ]
          example: "ok"
        signal:
          type: integer
          description: Signal quality indicator based on RSSI (0-63)
          minimum: 0
          maximum: 63
          example: 13
        measured_at:
          type: string
          description: UTC date and time of the measurement
          example: "2018-10-12 15:28:21"
        measurement_interval:
          type: integer
          description: The interval between measurements in seconds
          example: 180
        next_measurement_at:
          type: string
          description: The scheduled UTC time for the next connection
          example: "2018-10-12 18:28:21"
        params:
          type: array
          description: |
            A list of measured physical parameters.
            
            **Note:** This array may be empty if all sensor channels are of type NO_SENSOR (unconfigured/disabled channels).
            The CoAP Loader automatically filters out NO_SENSOR channels before forwarding data to your API.
          items:
            $ref: '#/components/schemas/MeasurementParam'

    MeasurementParam:
      type: object
      required:
        - channel
        - type
        - value
        - status
      properties:
        channel:
          type: integer
          description: The sensor channel number
          minimum: 1
          maximum: 6
          example: 1
        type:
          type: string
          description: The Measurement Type
          example: "temperature"
          enum:
            - temperature
            - humidity
            - pressure
            - pressure_diff
            - open-close
            - iaq
            - flooding
            - pulse_counter
            - electricity_usage
            - water_usage
            - soil_moisture
            - co_gas
            - no2_gas
            - h2s_gas
            - ambient_light
            - pm_1_0
            - pm_2_5
            - pm_10_0
            - noise_level
            - nh3_gas
            - ch4_gas
            - high_pressure
            - distance_mm
            - water_meter_acc
            - co2_gas
            - humidity_accurate
            - static_iaq
            - co2_equivalent
            - breath_voc
            - percentage
            - voltage
            - current
            - electricity_meter_acc
            - output_control
            - shared_modem
        value:
          oneOf:
            - type: string
            - type: number
          description: The actual value recorded for this measurement
          example: 6
        status:
          type: string
          description: Indicates reading health
          enum: [ ok, error ]
          example: "ok"

    SensorConfiguration:
      type: object
      required:
        - serialNumber
        - timestamp
        - partsCount
        - partIndex
        - hash
        - parameters
      properties:
        serialNumber:
          type: string
          description: Unique serial number of the sensor
          example: "282C024FFFB1"
        timestamp:
          type: string
          description: Data timestamp
          example: "1"
        partsCount:
          type: integer
          description: Total number of parts the configuration is divided into
          minimum: 1
          example: 1
        partIndex:
          type: integer
          description: Index of the currently transmitted configuration part
          minimum: 1
          example: 1
        hash:
          type: string
          description: |
            Configuration hash (changes with every setting update).
            **Important:** If hash = "0", the sensor runs deprecated software and cannot receive configuration updates.
          example: "1"
        parameters:
          type: array
          description: |
            Current sensor settings. For detailed specification of all available parameter types and validation rules, see **ConfigurationParametersReference** in the Models section.
            
            Most commonly used types: MEASUREMENT_PERIOD, TRANSMISSION_INTERVAL, ACK_INTERVAL, SERVER_DATA, APN, PLMN, CLOUD_TOKEN, RULE_1-12, RULE_CALENDAR_1-6.
          items:
            $ref: '#/components/schemas/SensorParameter'

    SensorParameter:
      type: object
      required:
        - type
        - settings
      properties:
        type:
          type: string
          description: |
            The unique name of the parameter. Available types include:
            ACK_INTERVAL, APN, BANDS, BLE_TURNOFF_TIME, BLE_TX_POWER_LEVEL,
            CELLULAR_CONFIG, CLOUD_TOKEN, CLOUD_TOKEN_COAP_OPTION,
            CONFIGURATION_ENDPOINT, DATA_ENDPOINT, DEVICE_INFO_ENDPOINT,
            DNS_SERVER, DNS_TTL_CONFIG, ENCRYPTION_KEY, LED_CONFIG,
            MEASUREMENT_PERIOD, NETWORK_TROUBLESHOOTING,
            PAYLOAD_SIGNATURE_COAP_OPTION, PLMN, REQUEST_DISABLE_MODEM,
            SERVER_DATA, SERVER_UPDATE, SUPERVISION_PERIOD, TIME_ENDPOINT,
            TRANSMISSION_INTERVAL, TRANSFER_LIMIT, TRANSFER_LIMIT_TIMER,
            CALIBRATION, RULE_1 through RULE_12, RULE_CALENDAR_1 through RULE_CALENDAR_6
            
            For detailed specification of each parameter type, including required fields and validation rules, see **ConfigurationParametersReference** in the Models section.
          example: "ACK_INTERVAL"
        settings:
          type: object
          description: A nested object containing specific key-value pairs for that parameter
          additionalProperties: true
          example:
            mode: "CUSTOM"
            interval: "3600"

    DeviceInfo:
      type: object
      required:
        - serialNumber
        - softwareVersion
        - commitId
        - cloudToken
        - memoryStatistics
        - updateTimestamp
        - updateStatus
      properties:
        serialNumber:
          type: string
          description: Unique serial number of the sensor
          example: "282C024FFFB1"
        softwareVersion:
          type: string
          description: Current firmware version
          example: "1546"
        runtimeInfo:
          $ref: '#/components/schemas/RuntimeInfo'
        modemInfo:
          $ref: '#/components/schemas/ModemInfo'
        commitId:
          type: string
          description: Unique identifier of the specific software build
          example: "a1b2c3d4"
        cloudToken:
          type: string
          description: Unique token used for cloud authentication
          example: "token123"
        memoryStatistics:
          type: array
          description: A list of numbers representing internal memory usage/allocation
          items:
            type: integer
          example: [ 1024, 2048 ]
        updateTimestamp:
          type: integer
          format: int64
          description: The timestamp of the last firmware or configuration update
          example: 1707830000
        updateStatus:
          type: integer
          description: Numeric code representing the status of the last update attempt
          example: 0

    RuntimeInfo:
      type: object
      description: Diagnostic data regarding the device's stability and power
      properties:
        uptime:
          type: integer
          description: Total seconds the device has been running since the last boot
          example: 12345
        confirmableMessagesAttempts:
          type: integer
          description: (Optional) Number of attempts to send messages requiring an ACK
          example: 50
        nonConfirmableMessagesAttempts:
          type: integer
          description: (Optional) Number of attempts to send messages without an ACK
          example: 10
        succeededMessages:
          type: integer
          description: (Optional) Number of messages successfully delivered to the platform
          example: 58
        mcuTemperature:
          type: integer
          description: Current temperature of the processor in Celsius
          example: 22
        minBatteryVoltage:
          type: integer
          description: Minimum recorded battery voltage in mV
          example: 3600
        minBatteryMcuTemperature:
          type: integer
          description: Processor temperature at the time the minimum battery voltage was recorded
          example: 20
        batteryResetTimestamp:
          type: integer
          format: int64
          description: Unix timestamp of the last battery replacement or manual reset (Polish00)
          example: 1707830000
        maxMcuTemperature:
          type: integer
          description: Highest recorded processor temperature in Celsius
          example: 35
        minMcuTemperature:
          type: integer
          description: Lowest recorded processor temperature in Celsius
          example: 15
        runtimeErrors:
          type: array
          description: A list of internal system error codes (max length 20)
          items:
            type: integer
          example: [ ]

    ModemInfo:
      type: object
      description: |
        Low-level parameters from the cellular modem, crucial for analyzing network performance.
        
        ## Modem Info Parameters
        
        The `parameters` array contains 34 numeric values representing detailed network and modem diagnostics (for BC66 modem type).
        Each index in the array corresponds to a specific parameter:
        
        | Index | Parameter Name | Description | Range | Unknown Value |
        |-------|----------------|-------------|-------|---------------|
        | 0 | sc_EARFCN | Serving cell E-UTRA Absolute Radio Frequency Channel Number | [0:262143] | -1 |
        | 1 | sc_EARNFCN_offset | Serving cell frequency offset (mapped to [-2, -1, -0.5, 0, 1]) | [0:4] | -1 |
        | 2 | sc_PCI | Serving cell Physical Cell ID | [0:502] | -1 |
        | 3 | sc_Cell_id | Serving cell ID | [1:268435456] | 0 |
        | 4 | sc_RSRP | Serving cell Reference Signal Received Power [dBm] | [-140:-44] | 0 |
        | 5 | sc_RSRQ | Serving cell Reference Signal Received Quality [dB] | [-20:-3] | 0 |
        | 6 | sc_RSSI | Serving cell Received Signal Strength Indicator [dBm] | [-110:-3] | 0 |
        | 7 | sc_SINR | Serving cell Signal to Interference plus Noise Ratio [dB] | [-10:30] | 31 |
        | 8 | sc_Band | The current serving cell band | [see module supported bands] | -1 |
        | 9 | sc_TAC | Serving cell Tracking Area Code | [0:65536] | -1 |
        | 10 | sc_ECL | Serving cell Extended Coverage Level | [0:2] | -1 |
        | 11 | sc_TX_PWR | Serving cell Transmit Power [0.1cBm] | [-440:230] | -1000 |
        | 12 | OP_MODE | Operation Mode | [0:3] | -1 |
        | 13 | nc_EARFCN | Neighbor cell E-UTRA Absolute Radio Frequency Channel Number | [0:262143] | -1 |
        | 14 | nc_EARNFCN_offset | Neighbor cell frequency offset (mapped to [-2, -1, -0.5, 0, 1]) | [0:4] | -1 |
        | 15 | nc_PCI | Neighbor cell Physical Cell ID | [0:502] | -1 |
        | 16 | nc_RSRP | Neighbor cell Reference Signal Received Power [dBm] | [-140:-44] | 0 |
        | 17 | RLC_UL_BLER | Radio Link Control Uplink Block Error Rate | [0:100] | -1 |
        | 18 | RLC_DL_BLER | Radio Link Control Downlink Block Error Rate | [0:100] | -1 |
        | 19 | MAC_UL_BLER | Medium Access Control Uplink Block Error Rate | [0:100] | -1 |
        | 20 | MAC_DL_BLER | Medium Access Control Downlink Block Error Rate | [0:100] | -1 |
        | 21 | MAC_UL_TOTAL_BYTES | Medium Access Control Uplink Total Bytes | [0:2147483647] | -1 |
        | 22 | MAC_DL_TOTAL_BYTES | Medium Access Control Downlink Total Bytes | [0:2147483647] | -1 |
        | 23 | MAC_UL_total_HARQ_Tx | Medium Access Control Uplink Total HARQ Transmissions | [0:2147483647] | -1 |
        | 24 | MAC_DL_total_HARQ_Tx | Medium Access Control Downlink Total HARQ Transmissions | [0:2147483647] | -1 |
        | 25 | MAC_UL_HARQ_re_Tx | Medium Access Control Uplink HARQ Retransmissions | [0:2147483647] | -1 |
        | 26 | MAC_DL_HARQ_re_Tx | Medium Access Control Downlink HARQ Retransmissions | [0:2147483647] | -1 |
        | 27 | RLC_UL_tput | Radio Link Control Uplink Throughput | [0:2147483647] | -1 |
        | 28 | RLC_DL_tput | Radio Link Control Downlink Throughput | [0:2147483647] | -1 |
        | 29 | MAC_UL_tput | Medium Access Control Uplink Throughput | [0:2147483647] | -1 |
        | 30 | MAC_DL_tput | Medium Access Control Downlink Throughput | [0:2147483647] | -1 |
        | 31 | sleep_duration | Sleep Duration [0.1s] | [0:2147483647] | -1 |
        | 32 | Rx_time | Receive Time [0.1s] | [0:2147483647] | -1 |
        | 33 | Tx_time | Transmit Time [0.1s] | [0:2147483647] | -1 |
        
        **Note:** "Unknown value" indicates the value used when the parameter is unavailable or not applicable.
      properties:
        modemType:
          type: string
          description: The model identification of the modem
          enum:
            - MODEM_TYPE_UNSPECIFIED
            - MODEM_TYPE_BC66
            - MODEM_TYPE_BC66NA
            - MODEM_TYPE_SHARED_MODEM
            - MODEM_TYPE_BC660
          example: "MODEM_TYPE_BC66"
        parameters:
          type: array
          description: An array of 34 numeric values representing network quality and modem diagnostics (for BC66 modem). See the table above for detailed parameter descriptions.
          items:
            type: integer
          example: [ 5, 12, 3 ]

    ConfigurationResponse:
      type: object
      description: Response body to remotely change the sensor's settings
      properties:
        parameters:
          type: array
          description: List of parameters to update on the sensor
          items:
            $ref: '#/components/schemas/SensorParameter'

    ConfigurationParametersReference:
      type: object
      description: |
        # Configuration Parameters Reference
        
        This section provides complete documentation for all available configuration parameters that can be:
        - Received in the `/configuration` endpoint (current sensor settings)
        - Returned in the `/measurements` response (to remotely update sensor settings)
        
        ## Available Configuration Parameters
        
        The following table describes all available configuration parameters:
        
        | [type] | [settings - key] | [settings - value for key] |
        |--------|------------------|----------------------------|
        | **ACK_INTERVAL** | mode* | ALWAYS / CUSTOM |
        | | interval (with mode CUSTOM only) | Integer [180 - 2592000 sec] |
        | **APN** | mode* | AUTO / CUSTOM |
        | | apn (with mode CUSTOM only) | String [max 49 characters] |
        | | apnUsername | String [max 31 characters] |
        | | apnPassword | String [max 31 characters] |
        | **BANDS** | bands* | String (integers separated by comma) example: '1,2,3' [1, 2, 3, 4, 5, 6, 8, 12, 13, 17, 18, 19, 20, 25, 26, 28, 66, 71, 85] |
        | **BLE_TURNOFF_TIME** | mode* | ALWAYS_ON / CUSTOM |
        | | time (with mode CUSTOM only) | Integer [60 - 604800 sec] |
        | **BLE_TX_POWER_LEVEL** | level* | Integer [1 - 4] |
        | **CELLULAR_CONFIG** | parameters* | String (integers separated by comma, without size - index 0) max number of integers: 11, example: '1,2,3' |
        | **CLOUD_TOKEN** | mode* | DISABLED / CUSTOM / IMEI |
        | | token (with mode CUSTOM only) | String [max 255 chars] |
        | **CLOUD_TOKEN_COAP_OPTION** | mode* | AUTO / CUSTOM |
        | | optionId (with mode CUSTOM only) | Integer [1 - 65000] |
        | **CONFIGURATION_ENDPOINT** | endpoint | String [max 16 characters] |
        | **DATA_ENDPOINT** | endpoint | String [max 16 characters] |
        | **DEVICE_INFO_ENDPOINT** | endpoint | String [max 16 characters] |
        | **DNS_SERVER** | ip | String [valid ip address] (e.g., 192.168.1.1) |
        | **DNS_TTL_CONFIG** | mode* | ACCEPT_TTL_FROM_DNS / AFTER_COMMUNICATION_FAILED / CUSTOM |
        | | ttl (with mode CUSTOM only) | Integer [1 - 864000]  |
        | **ENCRYPTION_KEY** | key* | String [max 16 characters] |
        | **LED_CONFIG** | parameters* | String (integers separated by comma) example: '1,2,3' |
        | **MEASUREMENT_PERIOD** | period* | Integer [1 - 65535] |
        | **NETWORK_TROUBLESHOOTING** | mode* | DISABLED / ENABLED] |
        | **PAYLOAD_SIGNATURE_COAP_OPTION** | mode* | AUTO / CUSTOM |
        | | optionId (with mode CUSTOM only) | Integer [1 - 65000] |
        | **PLMN** | mode* | AUTO / CUSTOM |
        | | time (with mode CUSTOM only) | Integer [100 - 999999] |
        | **REQUEST_DISABLE_MODEM** | time* | Integer [180 - 604800] |
        | **SERVER_DATA** | ip* | String [valid ip address] (e.g., 192.168.1.1) |
        | | port* | Integer [1 - 65535] |
        | **SERVER_UPDATE** | ip* | String [valid ip address] (e.g., 192.168.1.1) |
        | | portCoap* | Integer [1 - 65535] |
        | | portUdp* | Integer [1 - 65535] |
        | **SUPERVISION_PERIOD** | mode* | DISABLED / CUSTOM |
        | | period (with mode CUSTOM only) | Integer [180 - 604800] |
        | **TIME_ENDPOINT** | endpoint* | String [max 16 characters] |
        | **TRANSMISSION_INTERVAL** | interval* | Integer [60 - 604800 sec] |
        | **TRANSFER_LIMIT** | mode* | DISABLED / CUSTOM |
        | | time (with mode CUSTOM only) | Integer [180 - 65534] |
        | **TRANSFER_LIMIT_TIMER** | mode* | DISABLED / CUSTOM |
        | | time (with mode CUSTOM only) | Integer [180 - 65534] |
        | **CALIBRATION** | channelNumbers* | String (integers seperated by comma, no duplicates) example: '1,2,3' [1 - 6] |
        | | channelAssignment* | Integer |
        | | parameters* | String (integers seperated by comma, max number of integers: 8) example: '1,2,3' |
        | **RULE_1** to **RULE_12** | condition* | HIGH_THRESHOLD, LOW_THRESHOLD, DIFF_THRESHOLD, BINARY_CHANGE_STATE, LOGIC_OPERATOR, ON_MEASUREMENT, DISABLED |
        | | action* | ACTION_TRIGGER_TRANSMISSION, ACTION_NO_ACTION, ACTION_TRIGGER_TRANSMISSION_WITH_ACK - Required for: HIGH_THRESHOLD, LOW_THRESHOLD, DIFF_THRESHOLD, BINARY_CHANGE_STATE, LOGIC_OPERATOR, ON_MEASUREMENT. (Not present when condition = DISABLED) |
        | | type* | Required for: HIGH_THRESHOLD, LOW_THRESHOLD, DIFF_THRESHOLD. Not used for: BINARY_CHANGE_STATE, LOGIC_OPERATOR, ON_MEASUREMENT, DISABLED |
        | | channelNumbers* | String (integers separated by comma, no duplicates) example: '1,2,3' [1 - 6] |
        | | | Required for: HIGH_THRESHOLD, LOW_THRESHOLD, DIFF_THRESHOLD, BINARY_CHANGE_STATE. Not used for: LOGIC_OPERATOR, ON_MEASUREMENT, DISABLED |
        | | threshold* | Float - required for: HIGH_THRESHOLD, LOW_THRESHOLD, DIFF_THRESHOLD |
        | | hysteresis* | Float - required for: HIGH_THRESHOLD, LOW_THRESHOLD. Not used for: DIFF_THRESHOLD |
        | | averageMode* | MOVING_AVERAGE, WINDOW_MODE, CONSECUTIVE_SAMPLES - required for: HIGH_THRESHOLD, LOW_THRESHOLD, DIFF_THRESHOLD |
        | | averageNumberOfSamples* | Integer [1 - 10] - required for: HIGH_THRESHOLD, LOW_THRESHOLD, DIFF_THRESHOLD |
        | | logicOperator* | AND, OR - required for: LOGIC_OPERATOR |
        | | selectedRules* | String (integers separated by comma, no duplicates) example: '1,2,3' [1 - 12] - required for: LOGIC_OPERATOR. Optional for: ON_MEASUREMENT |
        | | actionDelay* | Integer [0 - 864000] - required for: LOGIC_OPERATOR |
        | | returnDelay* | Integer [0 - 864001] - required for: LOGIC_OPERATOR |
        | | negatedRules | String (integers separated by comma, no duplicates) example: '1,2,3' [1 - 12] - optional for: LOGIC_OPERATOR, ON_MEASUREMENT |
        | | measurementTransmission* | Integer [1 - 500] - required for: ON_MEASUREMENT |
        | **RULE_CALENDAR_1** to **RULE_CALENDAR_6** | type* | DISABLED, WEEK |
        | | selectedRules* | String (integers separated by comma, no duplicates) example: '1,2,3' [1 - 12] (required for WEEK, not present when DISABLED) |
        | | from* | Integer (minutes from midnight) [0 - 1439] (required for WEEK, not present when DISABLED) |
        | | to* | Integer (minutes from midnight) [0 - 1439] (required for WEEK, not present when DISABLED) |
        | | timezone* | Integer (number of 15 minute offsets) [-48 - 56] (required for WEEK, not present when DISABLED) |
        | | days* | String (enums separated by comma) example: 'MONDAY, SATURDAY' - allowed: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY (required for WEEK, not present when DISABLED) |
        
        **Note:** Fields marked with * are required for the given parameter type.
        
        ## Threshold Ranges for Rules
        
        The following table describes valid threshold and hysteresis ranges for different measurement types used in Rule conditions:
        
        | Type | Threshold Range | Hysteresis Range | Resolution |
        |------|-----------------|------------------|-----------|
        | **TEMPERATURE** | -273.2 – 4000.0 | 0.0 – 4273.2 | 0.1 |
        | **HUMIDITY** | 0.0 – 100.0 | 0.0 – 100.0 | 1.0 |
        | **ATMOSPHERIC_PRESSURE** | 1.0 – 2000.0 | 0.0 – 1999.0 | 0.1 |
        | **DIFFERENTIAL_PRESSURE** | -10000.0 – 10000.0 | 0.0 – 20000.0 | 1.0 |
        | **IAQ** | 0.0 – 500.0 | 0.0 – 500.0 | 1.0 |
        | **PULSE_CNT, WATER_METER** | 0.0 – 8000000.0 | 0.0 – 8000000.0 | 1.0 |
        | **ELECTRICITY_METER** | 0.0 – 8000000.0 | 0.0 – 8000000.0 | 1.0 |
        | **SOIL_MOISTURE** | -1000.0 – 0.0 | 0.0 – 1000.0 | 1.0 |
        | **CO_GAS, NO2_GAS** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        | **H2S_GAS** | 0.0 – 80000.0 | 0.0 – 800000.0 | 0.01 |
        | **AMBIENT_LIGHT** | 0.0 – 100000.0 | 0.0 – 1000000.0 | 0.1 |
        | **PM_1_0, PM_2_5, PM_10_0** | 0.0 – 1000.0 | 0.0 – 1000.0 | 1.0 |
        | **NOISE_LEVEL** | 0.0 – 200.0 | 0.0 – 200.0 | 0.1 |
        | **NH3_GAS, CH4_GAS** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        | **HIGH_PRESSURE** | 0.0 – 2000000.0 | 0.0 – 2000000.0 | 1.0 |
        | **DISTANCE_MM** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        | **WATER_METER_ACCUMULATIVE** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 0.001 |
        | **CO2_GAS, CO2_EQUIVALENT** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        | **HUMIDITY_ACCURATE** | 0.0 – 100.0 | 0.0 – 100.0 | 0.1 |
        | **STATIC_IAQ** | 0.0 – 10000.0 | 0.0 – 10000.0 | 1.0 |
        | **BREATH_VOC** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        | **PERCENTAGE** | 0.0 – 100.0 | 0.0 – 100.0 | 0.01 |
        | **VOLTAGE** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 0.1 |
        | **CURRENT** | 0.0 – 100000.0 | 0.0 – 100000.0 | 0.01 |
        | **PULSE_COUNTER_ACCUMULATIVE** | 0.0 – 10010000000.0 | 0.0 – 10010000000.0 | 1.0 |
        | **PULSE_COUNTER_ACCUMULATIVE_WIDE** | 0 – 999 999 999 999 | 0 – 999 999 999 999 | 1.0 |
        | **ELECTRICITY_METER_ACC** | 0.0 – 10010000.0 | 0.0 – 10010000.0 | 0.001 |
        | **CURRENT_PRECISE** | -4000.0 – 4000.0 | 0.0 – 4000.0 | 0.001 |
        | **RESISTANCE** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        
        **Note:** Fields marked with * are required for the given parameter type.
        
        ## Required Fields by Rule Condition
        
        The following table shows exactly which settings fields are required or optional for each rule condition type:
        
        | Condition | Required Fields | Optional Fields |
        |-----------|----------------|-----------------|
        | **HIGH_THRESHOLD** | condition, action, type, channelNumbers, threshold, hysteresis, averageMode, averageNumberOfSamples | — |
        | **LOW_THRESHOLD** | condition, action, type, channelNumbers, threshold, hysteresis, averageMode, averageNumberOfSamples | — |
        | **DIFF_THRESHOLD** | condition, action, type, channelNumbers, threshold, averageMode, averageNumberOfSamples | — |
        | **BINARY_CHANGE_STATE** | condition, action, channelNumbers | — |
        | **LOGIC_OPERATOR** | condition, action, logicOperator, selectedRules, actionDelay, returnDelay | negatedRules |
        | **ON_MEASUREMENT** | condition, action, measurementTransmission | selectedRules, negatedRules |
        | **DISABLED** | condition | — |
        
        ## Threshold Ranges for Rules
        
        The following table describes valid threshold and hysteresis ranges for different measurement types used in Rule conditions:
        
        | Type | Threshold Range | Hysteresis Range | Resolution |
        |------|-----------------|------------------|-----------|
        | **TEMPERATURE** | -273.2 – 4000.0 | 0.0 – 4273.2 | 0.1 |
        | **HUMIDITY** | 0.0 – 100.0 | 0.0 – 100.0 | 1.0 |
        | **ATMOSPHERIC_PRESSURE** | 1.0 – 2000.0 | 0.0 – 1999.0 | 0.1 |
        | **DIFFERENTIAL_PRESSURE** | -10000.0 – 10000.0 | 0.0 – 20000.0 | 1.0 |
        | **IAQ** | 0.0 – 500.0 | 0.0 – 500.0 | 1.0 |
        | **PULSE_CNT, WATER_METER** | 0.0 – 8000000.0 | 0.0 – 8000000.0 | 1.0 |
        | **ELECTRICITY_METER** | 0.0 – 8000000.0 | 0.0 – 8000000.0 | 1.0 |
        | **SOIL_MOISTURE** | -1000.0 – 0.0 | 0.0 – 1000.0 | 1.0 |
        | **CO_GAS, NO2_GAS** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        | **H2S_GAS** | 0.0 – 80000.0 | 0.0 – 800000.0 | 0.01 |
        | **AMBIENT_LIGHT** | 0.0 – 100000.0 | 0.0 – 1000000.0 | 0.1 |
        | **PM_1_0, PM_2_5, PM_10_0** | 0.0 – 1000.0 | 0.0 – 1000.0 | 1.0 |
        | **NOISE_LEVEL** | 0.0 – 200.0 | 0.0 – 200.0 | 0.1 |
        | **NH3_GAS, CH4_GAS** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        | **HIGH_PRESSURE** | 0.0 – 2000000.0 | 0.0 – 2000000.0 | 1.0 |
        | **DISTANCE_MM** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        | **WATER_METER_ACCUMULATIVE** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 0.001 |
        | **CO2_GAS, CO2_EQUIVALENT** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        | **HUMIDITY_ACCURATE** | 0.0 – 100.0 | 0.0 – 100.0 | 0.1 |
        | **STATIC_IAQ** | 0.0 – 10000.0 | 0.0 – 10000.0 | 1.0 |
        | **BREATH_VOC** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |
        | **PERCENTAGE** | 0.0 – 100.0 | 0.0 – 100.0 | 0.01 |
        | **VOLTAGE** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 0.1 |
        | **CURRENT** | 0.0 – 100000.0 | 0.0 – 100000.0 | 0.01 |
        | **PULSE_COUNTER_ACCUMULATIVE** | 0.0 – 10010000000.0 | 0.0 – 10010000000.0 | 1.0 |
        | **PULSE_COUNTER_ACCUMULATIVE_WIDE** | 0 – 999 999 999 999 | 0 – 999 999 999 999 | 1.0 |
        | **ELECTRICITY_METER_ACC** | 0.0 – 10010000.0 | 0.0 – 10010000.0 | 0.001 |
        | **CURRENT_PRECISE** | -4000.0 – 4000.0 | 0.0 – 4000.0 | 0.001 |
        | **RESISTANCE** | 0.0 – 1000000.0 | 0.0 – 1000000.0 | 1.0 |

