# Configure Device Configuration

> Configure various preferences of the device.

#### Request

* <mark style="color:red;">`packetID`</mark> : Represents the ID of the packet. This can be any six-digit number, no leading zeros.
* <mark style="color:red;">`payload`</mark> :&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 2
  * <mark style="color:red;">`callbackArgs`</mark> :
    * <mark style="color:red;">`acc_prefs`</mark> :
      * <mark style="color:red;">`outletPwrIndicatorOn`</mark>: Enable/disable InvisDeco outlet indicator lights; 1 - On, 0 - Off.
      * <mark style="color:red;">`pmIndicatorBrightness`</mark>: Configure the indicators brightness; 1 - 100.
      * <mark style="color:red;">`capacitiveCtrl`</mark>: Enable/disable InvisDeco to control outlets via capacitive touch; 1 - On, 0 - Off.
      * <mark style="color:red;">`magicTouchCtrl`</mark>: Enable/disable InvisDeco capacitive touch as magic touch; 1 - On, 0 - Off.
      * <mark style="color:red;">`adaptiveNightlightFeature`</mark>: Enable/disable InvisDeco's Adaptive Nightlight feature; 1 - On, 0 - Off.
      * <mark style="color:red;">`adaptiveMinBrightness`</mark>: Configure the minimum brightness for Adaptive Nightlight feature; 0-99.
      * <mark style="color:red;">`adaptiveMaxBrightness`</mark>: Configure the maximum brightness for Adaptive Nightlight feature; 1-100. The value cannot be less than <mark style="color:red;">`adaptiveMinBrightness`</mark>.
      * <mark style="color:red;">`occupancyNightlightFeature`</mark>: Enable/disable InvisDeco's Occupancy Nightlight feature; 1 - On, 0 - Off.
      * <mark style="color:red;">`overrideAdaptiveOccupancyNightlightFeature`</mark>: Override <mark style="color:red;">`adaptiveNightlightFeature`</mark>  if it is enabled. If enabled, <mark style="color:red;">`adaptiveNightlightFeature`</mark>   will be disabled when the user controls the nightlight on/off or brightness; 1 - On, 0 - Off.
      * <mark style="color:red;">`homeAwayMode`</mark>: Home Away Mode (Vacation Mode) settings.
        * <mark style="color:red;">`enabled`</mark>: Enable/disable Home Away Mode (Vacation Mode); 1 - On, 0 - Off.
        * <mark style="color:red;">`outlet1Enabled`</mark>: Enable/disable Home Away Mode being applied to Outlet 1; 1 - On, 0 - Off.
        * <mark style="color:red;">`outlet2Enabled`</mark>: Enable/disable Home Away Mode being applied to Outlet 2; 1 - On, 0 - Off.
        * <mark style="color:red;">`nightlightEnabled`</mark>: Enable/disable Home Away Mode being applied to Nightlight; 1 - On, 0 - Off.
        * <mark style="color:red;">`minBrightness`</mark>: Set minimum Nightlight brightness when Home Away Mode is enabled; 0-100.
        * <mark style="color:red;">`maxBrightness`</mark>: Set maximum Nightlight brightness when Home Away Mode is enabled; 1-100.
        * <mark style="color:red;">`minOnDuration`</mark>: Set minimum on duration for Outlet 1, Outlet 2, and/or Nightlight; 0-65535 minutes.
        * <mark style="color:red;">`maxOnDuration`</mark>: Set maximum on duration for Outlet 1, Outlet 2, and/or Nightlight; 1-65535 minutes.
        * <mark style="color:red;">`minOffDuration`</mark>: Set minimum off duration for Outlet 1, Outlet 2, and/or Nightlight; 0-65535 minutes.
        * <mark style="color:red;">`maxOffDuration`</mark>: Set maximum off duration for Outlet 1, Outlet 2, and/or Nightlight; 1-65535 minutes.
    * <mark style="color:red;">`sys_prefs`</mark> :
      * <mark style="color:red;">`mqtt`</mark> :&#x20;
        * <mark style="color:red;">`enabled`</mark> : Enable/disable MQTT TCP client service; 1 - On, 0 - Off.
        * <mark style="color:red;">`mqtt_broker_url`</mark> : The URL of the MQTT broker that InvisOutlet will be connected to.
        * <mark style="color:red;">`user`</mark> : The username to authenticate and connect to the MQTT broker.
        * <mark style="color:red;">`pass`</mark> : The password to authenticate and connect to the MQTT broker.
        * <mark style="color:red;">`qos`</mark> : The QoS level of the MQTT message; 0, 1, 2, or 3.
      * <mark style="color:red;">`internet`</mark> :&#x20;
        * <mark style="color:red;">`ip`</mark> : IP address of the device in `uint32_t`.
        * <mark style="color:red;">`mainDNS`</mark> : IP address of the primary DNS in `uint32_t`.
        * <mark style="color:red;">`backupDNS`</mark> : IP address of the secondary DNS in `uint32_t`.

```json
{
    "packetID": 713327,
    "payload":
    {
        "callbackName": 2,
        "callbackArgs":
        [
            {
                "acc_prefs": {
                    "outletPwrIndicatorOn": 1,
                    "pmIndicatorBrightness": 50,
                    "capacitiveCtrl": 0,
                    "magicTouchCtrl": 0,
                    "adaptiveNightlightFeature": 0,
                    "adaptiveMinBrightness": 0,
                    "adaptiveMaxBrightness": 100,
                    "overrideAdaptiveOccupancyNightlightFeature": 0,
                    "homeAwayMode": {
                        "enabled": 0,
                        "outlet1Enabled": 0,
                        "outlet2Enabled": 0,
                        "nightlightEnabled": 1,
                        "minBrightness": 0,
                        "maxBrightness": 100,
                        "minOnDuration": 10,
                        "maxOnDuration": 60,
                        "minOffDuration": 10,
                        "maxOffDuration": 60
                    }
                },
                "sys_prefs": {
                    "mqtt": {
                        "enabled": 1,
                        "mqtt_broker_url": "mqtt://homeassistant.local:1883",
                        "user": "mqttuser",
                        "pass": "mqttpass",
                        "qos": 1
                    }
                }
            }
        ]
    }
}
```

<details>

<summary>Special Features Description</summary>

* Adaptive Nightlight: The nightlight will automatically adjust its brightness based on ambient brightness. The adaptive minimum and maximum brightness can be adjusted via the <mark style="color:red;">`adaptiveMinBrightness`</mark> and <mark style="color:red;">`adaptiveMaxBrightness`</mark> parameter to suit your preferences.
* Home Away Mode: The home away mode will randomly turn on/off outlet 1, outlet 2, and/or nightlight depending on if <mark style="color:red;">`outlet1Enabled`</mark> <mark style="color:red;">`outlet2Enabled`</mark> <mark style="color:red;">`nightlightEnabled`</mark> is enabled or not. The Nightlight brightness can be randomized with a range set, with <mark style="color:red;">`minBrightness`</mark> and <mark style="color:red;">`maxBrightness`</mark>. The brightness can be static when both  <mark style="color:red;">`minBrightness`</mark> and <mark style="color:red;">`maxBrightness`</mark> are set to the same value. The on/off duration can also be randomized, with <mark style="color:red;">`minOnDuration`</mark> <mark style="color:red;">`maxOnDuration`</mark> <mark style="color:red;">`minOffDuration`</mark> <mark style="color:red;">`maxOffDuration`</mark> . If the on off duration are set to the same, then the duration will be static instead of randomlized.

</details>

#### Response

* <mark style="color:red;">`sn`</mark>: The serial number of the InvisOutlet.
* <mark style="color:red;">`packetID`</mark>: Represents the ID of the packet based on request <mark style="color:red;">`packetID`</mark>.
* <mark style="color:red;">`PUBACK`</mark> : If the request is successfully processed; 1 - Successful, 0 - Fail.

```json
{
    "sn": "11B29200071",
    "packetID": 713327,
    "PUBACK": 1
}
```

&#x20;
