# Getting Started

Establishing Connections

{% hint style="info" %}
TCP connection can be established via Command Prompt or Terminal, depending on the operating system.
{% endhint %}

Establishing connection in Windows:

```sh
netcat {{aabbccddeeff.local}} 3333
```

Establishing connection in macOS or Linux:

```bash
nc {{aabbccddeeff.local}} 3333
```


# Information and Preferences

{% content-ref url="/pages/ASk6Tvj2j128DbiwGnJk" %}
[Get Device Information](/invisoutlet-pro/information-and-preferences/get-device-information)
{% endcontent-ref %}

{% content-ref url="/pages/FVASn1txQF6GQahULctQ" %}
[Request Device Configuration](/invisoutlet-pro/information-and-preferences/request-device-configuration)
{% endcontent-ref %}

{% content-ref url="/pages/FwNpjerXwCZlxUdtbG7s" %}
[Configure Device Configuration](/invisoutlet-pro/information-and-preferences/configure-device-configuration)
{% endcontent-ref %}

{% content-ref url="/pages/eGTCAQIdiNQCHKdvd9Tj" %}
[Request Accessory Names](/invisoutlet-pro/information-and-preferences/request-accessory-names)
{% endcontent-ref %}

{% content-ref url="/pages/bLbZqkXVrHfUw9W3oCFx" %}
[Configure Accessory Names](/invisoutlet-pro/information-and-preferences/configure-accessory-names)
{% endcontent-ref %}


# Get Device Information

\[TCP/WebSocket -> InvisOutlet]

> Request and retrieve detailed device information for both InvisOutlet and InvisDeco.

**Request**

* <mark style="color:red;">`packetID`</mark>: A randomly generated six-digit number.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 12

```json
{
    "packetID": 373184,    
    "payload":
    {
        "callbackName": 12,  
    }
}
```

**Response**

* <mark style="color:red;">`sn`</mark>: The serial number of the device.
* <mark style="color:red;">`packetID`</mark>: A randomly generated six-digit number.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 12
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * <mark style="color:red;">`IM`</mark>:
      * <mark style="color:red;">`sn`</mark>: Serial number
      * <mark style="color:red;">`MAC`</mark>: MAC address
      * <mark style="color:red;">`device`</mark>: Name of the device role
      * <mark style="color:red;">`fw_rev`</mark>: Firmware version of the InvisOutlet
    * <mark style="color:red;">`PM`</mark>:
      * <mark style="color:red;">`online`</mark>: The status of whether the InvisDeco is connected to InvisOutlet
      * <mark style="color:red;">`sn`</mark>: Serial number
      * <mark style="color:red;">`MAC`</mark>: MAC address
      * <mark style="color:red;">`device`</mark>: Name of the device role
      * <mark style="color:red;">`type`</mark>: Name of the device type
      * <mark style="color:red;">`fw_rev`</mark>: Firmware version of the InvisDeco
      * <mark style="color:red;">`radar`</mark>: Occupancy sensor device information
        * <mark style="color:red;">`fw_rev`</mark>: Firmware version of the occupancy sensor
        * <mark style="color:red;">`hw_type`</mark>: Hardware type of the occupancy sensor
        * <mark style="color:red;">`MAC`</mark>: MAC address of the occupancy sensor

```json
{
    "sn": "11A1F7000FE",
    "packetID": 373184,
    "PUBACK": 1,
    "payload": {
        "callbackName": 12,
        "callbackArgs": {
            "IM": {
                "sn": "11A1F7000FE",
                "MAC": "4C7525F05D04",
                "device": "InvisOutlet",
                "fw_rev": "0.5.7"
            },
            "PM": {
                "online": true,
                "sn": "24A173000A2",
                "MAC": "10061CD059F8",
                "device": "InvisDeco",
                "type": "Pro",
                "fw_rev": "0.8.4",
                "radar": {
                    "fw_ver": "V2.49.24092710",
                    "hw_type": "0100",
                    "MAC": "1677294004E7"
                }
            }
        }
    }
}
```


# Request Device Configuration

\[TCP/WebSocket <--> InvisOutlet]

> Returns a list of configuration preferences of the device.

**Request**

* <mark style="color:red;">`packetID`</mark> : A random six-digit ID for this packet.
* <mark style="color:red;">`payload`</mark> :&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 1

```json
{
    "packetID": 819796,
    "payload":
    {
        "callbackName": 1
    }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 1
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * <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;">`aqiColorRGBFeature`</mark>: Enable/disable InvisDeco's RGB indicator light to indicator AQI color code; 1 - On, 0 - Off.
      * <mark style="color:red;">`motionAwayFeature`</mark>: Enable/disable InvisDeco's Security Alert feature; 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>: Enable this setting to override <mark style="color:red;">`adaptiveNightlightFeature`</mark>  and <mark style="color:red;">`occupancyNightlightFeature`</mark> if either one is enabled. If enabled, <mark style="color:red;">`adaptiveNightlightFeature`</mark>  and <mark style="color:red;">`occupancyNightlightFeature`</mark>  will be disabled when the user controls the nightlight on/off or brightness; 1 - On, 0 - Off.
    * <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
{
    "sn": "11A1F7000FE",
    "packetID": 819796,
    "PUBACK": 1,
    "payload": {
        "callbackName": 1,
        "callbackArgs": {
            "acc_prefs": {
                "outletPwrIndicatorOn": 1,
                "pmIndicatorBrightness": 50,
                "capacitiveCtrl": 0,
                "aqiColorRGBFeature": 1,
                "motionAwayFeature": 0,
                "adaptiveNightlightFeature": 0,
                "adaptiveMinBrightness": 0,
                "adaptiveMaxBrightness": 100,
                "occupancyNightlightFeature": 0,
                "overrideAdaptiveOccupancyNightlightFeature": 0
            },
            "sys_prefs": {
                "mqtt": {
                    "enabled": 1,
                    "mqtt_broker_url": "mqtt://homeassistant.local:1883",
                    "user": "mqttuser",
                    "pass": "mqttpass",
                    "qos": 1
                },
                "internet": {
                    "ip": 2835523776,
                    "mainDNS": 16843009,
                    "backupDNS": 16777217
                }
            }
        }
    }
}
```

<details>

<summary>Special Features Description</summary>

* Security Alert: If any motion is detected, all InvisDeco indicators and nightlight will flash at maximum brightness, until no motion is detected.
* 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.
* Occupancy Nightlight: The nightlight will automatically be turned on when occupancy is detected. <mark style="color:red;">`adaptiveNightlightFeature`</mark> and <mark style="color:red;">`occupancyNightlightFeature`</mark> can be activated at the same time. When <mark style="color:red;">`adaptiveNightlightFeature`</mark> is not activated, the nightlight will be turned on based on previously set brightness, when <mark style="color:red;">`adaptiveNightlightFeature`</mark> is activated, then it will follow *Adaptive Nightlight*'s settings to turn on/off the nightlight.
* 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>


# Configure Device Configuration

\[TCP/WebSocket <--> InvisOutlet]

> 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;">`aqiColorRGBFeature`</mark>: Enable/disable InvisDeco's RGB indicator light to indicate AQI color code; 1 - On, 0 - Off.
      * <mark style="color:red;">`motionAwayFeature`</mark>: Enable/disable InvisDeco's Security Alert feature; 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>  and <mark style="color:red;">`occupancyNightlightFeature`</mark> if either one is enabled. If enabled, <mark style="color:red;">`adaptiveNightlightFeature`</mark>  and <mark style="color:red;">`occupancyNightlightFeature`</mark>  will be disabled when the user controls the nightlight on/off or brightness; 1 - On, 0 - Off.
    * <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,
                    "aqiColorRGBFeature": 1,
                    "motionAwayFeature": 0,
                    "adaptiveNightlightFeature": 0,
                    "adaptiveMinBrightness": 0,
                    "adaptiveMaxBrightness": 100,
                    "occupancyNightlightFeature": 0,
                    "overrideAdaptiveOccupancyNightlightFeature": 0
                },
                "sys_prefs": {
                    "mqtt": {
                        "enabled": 1,
                        "mqtt_broker_url": "mqtt://homeassistant.local:1883",
                        "user": "mqttuser",
                        "pass": "mqttpass",
                        "qos": 1
                    }
                }
            }
        ]
    }
}
```

<details>

<summary>Special Features Description</summary>

* Security Alert: If any motion is detected, all InvisDeco indicators and nightlight will flash at maximum brightness, until no motion is detected.
* 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.
* Occupancy Nightlight: The nightlight will automatically be turned on when occupancy is detected. <mark style="color:red;">`adaptiveNightlightFeature`</mark> and <mark style="color:red;">`occupancyNightlightFeature`</mark> can be activated at the same time. When <mark style="color:red;">`adaptiveNightlightFeature`</mark> is not activated, the nightlight will be turned on based on previously set brightness, when <mark style="color:red;">`adaptiveNightlightFeature`</mark> is activated, then it will follow *Adaptive Nightlight*'s settings to turn on/off the nightlight.
* 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": "0003C44076",
    "packetID": 713327,
    "PUBACK": 1
}
```

&#x20;


# Request Accessory Names

\[TCP/WebSocket -> InvisOutlet]

> Request and retrieve accessory names from 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>: 3

```json
{
    "packetID": 180072,
    "payload":
    {
        "callbackName": 3   
    }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 3
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * <mark style="color:red;">`accessory`</mark>: 1 - Outlet 1 (Top), 2 - Outlet 2 (Bottom), 3 - Nightlight (if InvisDeco is installed).
    * <mark style="color:red;">`name`</mark>: The corresponding names for the <mark style="color:red;">`accessory`</mark>.

```json
{
    "sn": "0003C44076",
    "packetID": 180072,
    "PUBACK": 1,
    "payload": {
        "callbackName": 3,
        "callbackArgs": {
            "payload": [
                {
                    "accessory": 1,
                    "name": "Outlet 1"
                },
                {
                    "accessory": 2,
                    "name": "Outlet 2"
                },
                {
                    "accessory": 3,
                    "name": "Nightlight"
                }
            ]
        }
    }
}
```


# Configure Accessory Names

\[TCP/WebSocket -> InvisOutlet]

> Configure and set accessory names for 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> : 4
  * <mark style="color:red;">`callbackArgs`</mark> :
    * <mark style="color:red;">`accessory`</mark>: 1 - Outlet 1 (Top), 2 - Outlet 2 (Bottom), 3 - Nightlight (if InvisDeco is installed).
    * <mark style="color:red;">`name`</mark>: The corresponding names for the <mark style="color:red;">`accessory`</mark>.

```json
{
    "packetID": 950302,
    "payload":
    {
        "callbackName": 4,  
        "callbackArgs":
        [
            {
                "accessory": 1,    
                "name": "Fan"
            },
            {
                "accessory": 2,    
                "name": "Charger"
            },
            {
                "accessory": 3,     
                "name": "Nightlight"
            }
        ]
    }
}
```

**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": "0003C44076",
    "packetID": 950302,
    "PUBACK": 1
}
```


# Accessory Controls

{% content-ref url="/pages/pfWfIYYqSEMh9SWNN5G2" %}
[Outlets](/invisoutlet-pro/accessory-controls/outlets)
{% endcontent-ref %}

{% content-ref url="/pages/XJ4ssL23seq4fa6UNZvN" %}
[Nightlight](/invisoutlet-pro/accessory-controls/nightlight)
{% endcontent-ref %}


# Outlets

\[TCP/WebSocket <--> InvisOutlet]

> Control InvisOutlet's outlet 1 or outlet 2.

**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> : 10
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: 1 - Outlet 1 (Top), 2 - Outlet 2 (Bottom).
    * `2`: 1 - On, 0 - Off.

```json
{
    "packetID": 684761,
    "payload": {
        "callbackName": 10,
        "callbackArgs": [
            1,
            1
        ]
    }
}
```

#### 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": "0003C44076",
    "packetID": 684761,
    "PUBACK": 1
}
```


# Nightlight

\[TCP/WebSocket -> InvisOutlet]

> Control InvisDeco Pro's nightlight on/off and its brightness.

**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> : 14
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: 1 - On, 0 - Off.
    * `2`: The nightlight brightness, ranging from 0 to 100.

```json
{
    "packetID": 164423,
    "payload":
    {
        "callbackName": 14,
        "callbackArgs": [1, 100]
    }
}
```

#### 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": "0003C44076",
    "packetID": 164423,
    "PUBACK": 1
}
```


# Fetch Accessory Status

{% content-ref url="/pages/sZe6ig5jo7ZGXscJcSUx" %}
[Outlets](/invisoutlet-pro/fetch-accessory-status/outlets)
{% endcontent-ref %}

{% content-ref url="/pages/ZbeaMNPybKpJcrQt34bn" %}
[Nightlight](/invisoutlet-pro/fetch-accessory-status/nightlight)
{% endcontent-ref %}

{% content-ref url="/pages/KtXae3X9aB9gYZwHas51" %}
[Sensors](/invisoutlet-pro/fetch-accessory-status/sensors)
{% endcontent-ref %}


# Outlets

\[TCP/WebSocket -> InvisOutlet]

> Fetch InvisOutlet's latest outlets status.

**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>: 9

```json
{
    "packetID": 369953,
    "payload":
    {
        "callbackName": 9
    }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 9
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Whether the Outlet 1 power is on or off; 1 - On, 0 - Off.
    * `2` : Whether the Outlet 2 power is on or off; 1 - On, 0 - Off.

```json
{
    "sn": "0003C44076",
    "packetID": 369953,
    "PUBACK": 1,
    "payload": {
        "callbackName": 9,
        "callbackArgs": [
            1,
            0
        ]
    }
}
```


# Nightlight

\[TCP/WebSocket -> InvisOutlet]

> Fetch InvisDeco's latest nightlight status.

**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>: 15

```json
{
    "packetID": 349027,
    "payload":
    {
        "callbackName": 15
    }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 15
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Whether the Nightlight power is on or off; 1 - On, 0 - Off.
    * `2` : The nightlight brightness; ranging from 0 to 100 percent.

```json
{
    "sn": "0003C44076",
    "packetID": 349027,
    "PUBACK": 1,
    "payload": {
        "callbackName": 15,
        "callbackArgs": [
            1,
            100
        ]
    }
}
```


# Sensors

\[TCP/WebSocket -> InvisOutlet]

> Fetch InvisDeco Pro's latest sensor readings.

**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>: 11

```json
{
    "packetID": 371939,
    "payload":
    {
        "callbackName": 11
    }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 11
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : The InvisDeco device type; reserved for internal use.
    * `2` :&#x20;
      * <mark style="color:red;">`temp_valid`</mark> : A flag indicating the validity of the temperature and humidity sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`aqi_valid`</mark> : A flag indicating the validity of the air quality sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`temp_celsius`</mark>: Temperature in Celsius.
      * <mark style="color:red;">`humidity`</mark>: Relative humidity in percentage.
      * <mark style="color:red;">`BME680_temp_celsius`</mark>: Temperature from the air quality sensor. *for development use only*
      * <mark style="color:red;">`BME680_humidity`</mark>: Humidity from the air quality sensor. *for development use only*
      * <mark style="color:red;">`AQI`</mark>: Air quality index level.
      * <mark style="color:red;">`AQI_accuracy`</mark> : Accuracy of the AQI measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`pressure`</mark>: Atmospheric pressure in Pascals (Pa).
      * <mark style="color:red;">`gas`</mark>: Gas sensor reading in Ohms.
      * <mark style="color:red;">`co2_equiv`</mark>: Equivalent CO2 concentration in parts per million (ppm).
      * <mark style="color:red;">`co2_peak_lvl`</mark>: Peak CO2 concentration in ppm.
      * <mark style="color:red;">`co2_accuracy`</mark>: Accuracy of the CO2 measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`bvoc_equiv`</mark>: Equivalent breathe volatile organic compounds (bVOC) concentration in ppm.
      * <mark style="color:red;">`bvoc_accuracy`</mark>: Accuracy of the bVOC measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`lux_valid`</mark>: A flag indicating the ambient brightness sensor validity of the sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`lux`</mark>: Ambient brightness level in LUX.
      * <mark style="color:red;">`occupancy_valid`</mark>: A flag indicating the occupancy sensor validity of the sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`occupancy_state`</mark>: The occupancy detected state; 0: no occupancy, 1: movement only, 2: stationary only, 3: stationary and movement, 4: calibration in progress, 5: calibration completed, 6: calibration failed.
      * <mark style="color:red;">`distance`</mark>: The occupancy detected distance in centimeter (cm) between the device and the human movement.
      * <mark style="color:red;">`movement_energy`</mark>: The energy level of the detected movement occupancy; 0 (lowest) - 100 (highest)
      * <mark style="color:red;">`stationary_energy`</mark>: The energy level of the detected stationary occupancy; 0 (lowest) - 100 (highest)

```json
{
    "sn": "000FE441F7",
    "packetID": 371939,
    "payload": {
        "callbackName": 11,
        "callbackArgs": [
            4,
            {
                "temp_valid": 1,
                "aqi_valid": 1,
                "temp_celsius": "27.95",
                "humidity": "63.00",
                "BME680_temp_celsius": "28.74",
                "BME680_humidity": "63.64",
                "AQI": 50,
                "AQI_accuracy": 0,
                "pressure": 100925,
                "gas": 108414,
                "co2_equiv": 500,
                "co2_peak_lvl": 500,
                "co2_accuracy": 0,
                "bvoc_equiv": "0.49",
                "bvoc_accuracy": 0,
                "lux_valid": 1,
                "lux": "141.51",
                "occupancy_valid": 1,
                "occupancy_state": 3,
                "distance": 76,
                "movement_energy": 100,
                "stationary_energy": 100
            }
        ]
    }
}
```


# Synchronous Updates

The device will send synchronous updates when the TCP/WebSocket connection is established. This section describes all the synchronous updates that will be sent from InvisOutlet.

{% content-ref url="/pages/y66Gq5RoyzeWHZqHHs6q" %}
[Outlets](/invisoutlet-pro/synchronous-updates/outlets)
{% endcontent-ref %}

{% content-ref url="/pages/mJrnGO5NnF7nP2v83bCh" %}
[Nightlight](/invisoutlet-pro/synchronous-updates/nightlight)
{% endcontent-ref %}

{% content-ref url="/pages/bHMSowpNcugN4YqlWJbm" %}
[Sensors](/invisoutlet-pro/synchronous-updates/sensors)
{% endcontent-ref %}


# Outlets

\[InvisOutlet -> TCP/WebSocket]

> Updating InvisOutlet's latest outlets status.

#### Response

* <mark style="color:red;">`sn`</mark>: The serial number of the InvisOutlet.
* <mark style="color:red;">`packetID`</mark>: Represents the packet ID.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 9
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Whether the Outlet 1 power is on or off; 1 - On, 0 - Off.
    * `2` : Whether the Outlet 2 power is on or off; 1 - On, 0 - Off.

```json
{
    "sn": 9,
    "packetID": 887880,
    "payload": {
        "callbackName": 9,
        "callbackArgs": [
            1,    
            0   
        ]
    }
}
```


# Nightlight

\[InvisOutlet -> TCP/WebSocket]

> Updating InvisDeco's latest nightlight status.

#### Response

* <mark style="color:red;">`sn`</mark>: The serial number of the InvisOutlet.
* <mark style="color:red;">`packetID`</mark>: Represents the packet ID.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 15
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Whether the Nightlight power is on or off; 1 - On, 0 - Off.
    * `2` : The nightlight brightness; ranging from 0 to 100 percent.

```json
{
    "sn": "0003C44076",
    "packetID": 574436,
    "payload": {
        "callbackName": 15,   
        "callbackArgs": [
            1,    
            100    
        ]
    }
}
```


# Sensors

\[InvisOutlet -> TCP/WebSocket]

> Updating InvisDeco's latest sensor readings.

#### Response

* <mark style="color:red;">`sn`</mark>: The serial number of the InvisOutlet.
* <mark style="color:red;">`packetID`</mark>: Represents the packet ID.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 11
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `0` : The InvisDeco device type.
    * `1` :&#x20;
      * <mark style="color:red;">`temp_valid`</mark> : A flag indicating the validity of the temperature and humidity sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`aqi_valid`</mark> : A flag indicating the validity of the air quality sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`temp_celsius`</mark>: Temperature in Celsius.
      * <mark style="color:red;">`humidity`</mark>: Relative humidity in percentage.
      * <mark style="color:red;">`BME680_temp_celsius`</mark>: Temperature from the air quality sensor. *for development use only*
      * <mark style="color:red;">`BME680_humidity`</mark>: Humidity from the air quality sensor. *for development use only*
      * <mark style="color:red;">`AQI`</mark>: Air quality index level.
      * <mark style="color:red;">`AQI_accuracy`</mark> : Accuracy of the AQI measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`pressure`</mark>: Atmospheric pressure in Pascals (Pa).
      * <mark style="color:red;">`gas`</mark>: Gas sensor reading in Ohms.
      * <mark style="color:red;">`co2_equiv`</mark>: Equivalent CO2 concentration in parts per million (ppm).
      * <mark style="color:red;">`co2_peak_lvl`</mark>: Peak CO2 concentration in ppm.
      * <mark style="color:red;">`co2_accuracy`</mark>: Accuracy of the CO2 measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`bvoc_equiv`</mark>: Equivalent breathe volatile organic compounds (bVOC) concentration in ppm.
      * <mark style="color:red;">`bvoc_accuracy`</mark>: Accuracy of the bVOC measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`lux_valid`</mark>: A flag indicating the ambient brightness sensor validity of the sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`lux`</mark>: Ambient brightness level in LUX.
      * <mark style="color:red;">`occupancy_valid`</mark>: A flag indicating the occupancy sensor validity of the sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`occupancy_state`</mark>: The occupancy detected state; 0: no occupancy, 1: movement only, 2: stationary only, 3: stationary and movement, 4: calibration in progress, 5: calibration success; 6: calibration failed.
      * <mark style="color:red;">`distance`</mark>: The occupancy detected distance in centimeter (cm) between the device and the human movement.
      * <mark style="color:red;">`movement_energy`</mark>: The energy level of the detected movement occupancy; 0 (lowest) - 100 (highest)
      * <mark style="color:red;">`stationary_energy`</mark>: The energy level of the detected stationary occupancy; 0 (lowest) - 100 (highest)

```json
{
    "sn": "000FE441F7",
    "packetID": 371939,
    "payload": {
        "callbackName": 11,
        "callbackArgs": [
            4,
            {
                "temp_valid": 1,
                "aqi_valid": 1,
                "temp_celsius": "27.95",
                "humidity": "63.00",
                "BME680_temp_celsius": "28.74",
                "BME680_humidity": "63.64",
                "AQI": 50,
                "AQI_accuracy": 0,
                "pressure": 100925,
                "gas": 108414,
                "co2_equiv": 500,
                "co2_peak_lvl": 500,
                "co2_accuracy": 0,
                "bvoc_equiv": "0.49",
                "bvoc_accuracy": 0,
                "lux_valid": 1,
                "lux": "141.51",
                "occupancy_valid": 1,
                "occupancy_state": 3,
                "distance": 76,
                "movement_energy": 100,
                "stationary_energy": 100
            }
        ]
    }
}
```


# Sensors - Magic Touch

\[InvisOutlet -> TCP/WebSocket]

> Sending update when magic touch is triggered.

{% hint style="info" %}
This uses the same <mark style="color:red;">`callbackName`</mark> as [Sensors](/invisoutlet-pro/synchronous-updates/sensors).
{% endhint %}

#### Response

* <mark style="color:red;">`sn`</mark>: The serial number of the InvisOutlet.
* <mark style="color:red;">`packetID`</mark>: Represents the packet ID.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 11
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `0` : The InvisDeco device type.
    * `1` :&#x20;
      * <mark style="color:red;">`magic_touch_1`</mark> : A flag indicating if the first Magic Touch button is pressed with touch duration in milliseconds.
      * <mark style="color:red;">`magic_touch_2`</mark> : A flag indicating if the second Magic Touch button is pressed with touch duration in milliseconds.

```json
{
    "sn": "000FE441F7",
    "packetID": 371939,
    "payload": {
        "callbackName": 11,
        "callbackArgs": [
            4,
            {
                "magic_touch_1": 270
            }
        ]
    }
}
```

{% hint style="info" %}
As the Magic Touch button will likely be triggered one at a time, the response payload will only contain either <mark style="color:red;">`magic_touch_1`</mark>  or <mark style="color:red;">`magic_touch_2`</mark> .
{% endhint %}

{% hint style="info" %}
Make sure <mark style="color:red;">`capacitiveCtrl`</mark> and <mark style="color:red;">`magicTouchCtrl`</mark> is enabled via [Configure Device Configuration](/invisoutlet-pro/information-and-preferences/request-device-configuration).
{% endhint %}


# OTA

{% content-ref url="/pages/j2gDUOAXXMl5Od5SItuE" %}
[Request Available Updates](/invisoutlet-pro/ota/request-available-updates)
{% endcontent-ref %}

{% content-ref url="/pages/j1ftedsvOZZBle1qL3KS" %}
[Perform OTA Update](/invisoutlet-pro/ota/perform-ota-update)
{% endcontent-ref %}

{% content-ref url="/pages/oibrRGZ0k3cRnjp6ThtG" %}
[OTA Download Progress (Synchronous)](/invisoutlet-pro/ota/ota-download-progress-synchronous)
{% endcontent-ref %}

{% content-ref url="/pages/aI6emsSQvbAq853Kj6Ux" %}
[OTA Result Update (Synchronous)](/invisoutlet-pro/ota/ota-result-update-synchronous)
{% endcontent-ref %}


# Request Available Updates

\[TCP/WebSocket <--> InvisOutlet]

> Check available firmware updates (Over-the-Air updates) for InvisOutlet and InvisDeco.

**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>: 20

```json
{
    "packetID": 221040,
    "payload":
    {
        "callbackName": 20
    }
}
```

**Response**

Succes&#x73;**:**

* <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.
  * <mark style="color:red;">`callbackName`</mark>: 20
    * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
      * <mark style="color:red;">`IM`</mark>:
        * <mark style="color:red;">`fw_rev`</mark>: The current running firmware version of the InvisOutlet.
        * <mark style="color:red;">`available_fw_rev`</mark>: The available firmware version for the InvisOutlet; if the available firmware revision matches the current firmware revision, indicating that there is no available updates.
        * <mark style="color:red;">`www_fw_rev`</mark>: The current running web firmware version of the InvisOutlet.
        * <mark style="color:red;">`available_www_fw_rev`</mark>: The available web firmware version for the InvisOutlet; if the available firmware revision matches the current firmware revision, indicating that there is no available updates.
      * <mark style="color:red;">`PM`</mark> :
        * <mark style="color:red;">`fw_rev`</mark>: The current running firmware version of the InvisDeco.
        * <mark style="color:red;">`available_fw_rev`</mark>: The available firmware version for the InvisDeco; if the available firmware revision matches the current firmware revision, indicating that there is no available updates.

```json
{
    "sn": "0003C44076",
    "packetID": 221040,
    "PUBACK": 1,
    "payload": {
        "callbackName": 20,
        "callbackArgs": {
            "IM": {
                "fw_rev": "0.0.1",
                "available_fw_rev": "0.0.1",
                "www_fw_rev": "0.1.2",
                "available_www_fw_rev": "0.3.0"
            },
            "PM": {
                "fw_rev": "0.5.0",
                "available_fw_rev": "0.5.1"
            }
        }
    }
}

```

Fai&#x6C;**:**

* <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; 0 - Failed.

```json
{
    "sn": "0003C44076",
    "packetID": 221040,
    "PUBACK": 0
}
```


# Perform OTA Update

\[TCP/WebSocket <--> InvisOutlet]

> Perform an OTA update for InvisOutlet, InvisDeco, or both devices as one ordered full update.

## Request

* <mark style="color:red;">`packetID`</mark>: The packet ID. This can be any six-digit number with no leading zeros.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 21
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Update target; 1 - InvisOutlet only, 2 - InvisDeco only, 3 - Update all (InvisDeco first, then InvisOutlet)
    * `2` : InvisDeco update method; 0 - Update via Wi-Fi, 1 - Update via InvisOutlet

{% hint style="info" %}
The update method value is ignored when the target is `1`.
{% endhint %}

| `callbackArgs` | Operation                                                               |
| -------------- | ----------------------------------------------------------------------- |
| `[1,0]`        | Update InvisOutlet over Wi-Fi                                           |
| `[2,0]`        | Update InvisDeco over Wi-Fi                                             |
| `[2,1]`        | Update InvisDeco through InvisOutlet.                                   |
| `[3,0]`        | Update all: InvisDeco over Wi-Fi, then InvisOutlet over Wi-Fi           |
| `[3,1]`        | Update all: InvisDeco through InvisOutlet, then InvisOutlet over Wi-Fi. |

{% hint style="info" %}
Use `[3,0]` for the normal update-all flow. If InvisDeco Wi-Fi is unreliable, or if InvisDeco must be force-updated, use `[3,1]`.
{% endhint %}

{% hint style="warning" %}
`[3,1]` always transfers the InvisDeco image via InvisOutlet. The InvisDeco will be updated regardlessly if the firmware version is already up-to-date.
{% endhint %}

### Update all using InvisDeco Wi-Fi

```json
{
    "packetID": 414883,
    "payload": {
        "callbackName": 21,
        "callbackArgs": [3, 0]
    }
}
```

### Update all using InvisDeco via InvisOutlet

```json
{
    "packetID": 414884,
    "payload": {
        "callbackName": 21,
        "callbackArgs": [3, 1]
    }
}
```

## Update-all sequence

For target `3`, InvisOutlet treats both device updates as one ordered transaction:

1. InvisDeco starts using the selected update method.
2. When InvisDeco succeeds, InvisOutlet starts its update over Wi-Fi.
3. If InvisDeco is already up-to-date during `[3,0]`, its stage is treated as a successful no-op and InvisOutlet still starts.
4. If InvisDeco fails, the pending InvisOutlet stage is cancelled.

InvisOutlet owns the handoff. A client must not send a second callback `21` request after receiving the successful InvisDeco result.

If InvisOutlet loses power or unexpectedly restarts before the transaction finishes, refresh both firmware versions and issue a new request if required.

Progress and result events are emitted separately for each device. Clients receive InvisDeco events first (`callbackArgs[0] = 2`), followed by InvisOutlet events (`callbackArgs[0] = 1`). When an InvisOutlet WWW partition update is included, its events use `callbackArgs[0] = 3`.

{% hint style="info" %}
An already-current InvisDeco may complete its `[3,0]` stage without download-progress events. Wait for the InvisDeco result, then continue listening for InvisOutlet events.
{% endhint %}

## Immediate response

The immediate response confirms whether the request was accepted.

* <mark style="color:red;">`sn`</mark>: InvisOutlet serial number.
* <mark style="color:red;">`packetID`</mark>: The request packet ID.
* <mark style="color:red;">`PUBACK`</mark>:
  * `1` — Request accepted and the first stage will start.
  * `0` — Request rejected or could not initialize. Target `3` is also rejected when InvisDeco is offline, the arguments are invalid, or another OTA transaction is active.

```json
{
    "sn": "0003C44076",
    "packetID": 414883,
    "PUBACK": 1
}
```

## Synchronous stage-start response

* <mark style="color:red;">`payload.callbackName`</mark>: `21`
* <mark style="color:red;">`payload.callbackArgs[0]`</mark>: Device whose OTA stage is starting.
  * `1` — InvisOutlet
  * `2` — InvisDeco
* <mark style="color:red;">`payload.callbackArgs[1]`</mark>:
  * `1` — OTA stage can continue
  * `0` — OTA stage failed to initialize

```json
{
    "sn": "0003C44076",
    "packetID": 301551,
    "payload": {
        "callbackName": 21,
        "callbackArgs": [2, 1]
    }
}
```

For an accepted update-all request, the normal order is:

1. InvisDeco stage-start/progress/result events with device role `2`.
2. InvisOutlet stage-start/progress/result events with device role `1`.
3. Optional InvisOutlet WWW progress/result events with role `3`, when a WWW update is included.

A successful InvisDeco result is an intermediate result, not completion of the update-all operation.

{% hint style="info" %}
InvisOutlet revB disconnects and reboots while installing OTA firmware. Reconnect the TCP client and continue listening, but do not automatically resend callback `21`.
{% endhint %}

{% hint style="info" %}
Follow the transaction through [OTA Download Progress (Synchronous)](/invisoutlet-pro/ota/ota-download-progress-synchronous) and [OTA Result Update (Synchronous)](/invisoutlet-pro/ota/ota-result-update-synchronous). Synchronous messages use newly generated packet IDs, not the original request packet ID.
{% endhint %}


# OTA Download Progress (Synchronous)

\[InvisOutlet -> TCP/WebSocket]

> Reports OTA firmware download progress for InvisOutlet or InvisDeco.

## Response

* <mark style="color:red;">`sn`</mark>: InvisOutlet serial number.
* <mark style="color:red;">`packetID`</mark>: A newly generated packet ID for this synchronous update.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 22
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Device being updated; 1 - InvisOutlet, 2 - InvisDeco, 3 - InvisOutlet WWW (revA only)
    * `2` : Download progress; 0 - 100%.

```json
{
    "sn": "0003D44076",
    "packetID": 301552,
    "payload": {
        "callbackName": 22,
        "callbackArgs": [2, 90]
    }
}
```


# OTA Result Update (Synchronous)

\[InvisOutlet -> TCP/WebSocket]

> Reports the final result of an InvisOutlet or InvisDeco OTA stage.

## Response

* <mark style="color:red;">`sn`</mark>: InvisOutlet serial number.
* <mark style="color:red;">`packetID`</mark>: A newly generated packet ID for this synchronous update.
* <mark style="color:red;">`payload.callbackName`</mark>: `23`
* <mark style="color:red;">`payload.callbackArgs[0]`</mark>: Partition or device whose OTA completed.
  * `1` — InvisOutlet application partition
  * `2` — InvisDeco application partition
  * `3` — InvisOutlet WWW partition
* <mark style="color:red;">`payload.callbackArgs[1]`</mark>: Result.
  * `1` — Stage succeeded.
  * `0` — Stage failed.

```json
{
    "sn": "0003D44076",
    "packetID": 301552,
    "payload": {
        "callbackName": 23,
        "callbackArgs": [2, 1]
    }
}
```

## Full update result sequence

For callback 21 update target `3`, evaluate the results as an ordered transaction:

1. Wait for the InvisDeco result: `[2, 1]` or `[2, 0]`.
2. If the result is `[2, 1]`, the InvisOutlet stage starts next.
3. Wait for the InvisOutlet application result: `[1, 1]` or `[1, 0]`.
4. If a WWW partition update is performed, also process its role-`3` updates.

A result of `[2, 0]` ends the full update. The InvisOutlet stage will not run. A successful InvisOutlet application update may reboot the device immediately, so the client should tolerate disconnection and reconnect when necessary.


# Device Management

{% content-ref url="/pages/qTppEdEOcG8sBHQvpGoU" %}
[InvisOutlet](/invisoutlet-pro/device-management/invisoutlet)
{% endcontent-ref %}

{% content-ref url="/pages/dWM4KlKkpgWV1El9g18k" %}
[InvisDeco](/invisoutlet-pro/device-management/invisdeco)
{% endcontent-ref %}


# InvisOutlet


# Restart InvisOutlet

\[TCP/WebSocket <--> InvisOutlet]

> Perform a restart of the InvisOutlet device.
>
> *Note: This only reboots InvisOutlet itself, where double-clicking the button on the InvisOutlet will reboot both InvisOutlet and InvisDeco.*

**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>: 5

```json
{
    "packetID": 221051,
    "payload":
    {
        "callbackName": 5
    }
}
```

**Response**

No response will be sent. The InvisOutlet device will blink for 3 seconds and reboot.


# Reset InvisOutlet's Network Settings

\[TCP/WebSocket <--> InvisOutlet]

> Reset InvisOutlet's network settings.
>
> This will clear Matter commissioning but will not clear device customization settings.
>
> *Note: This is the same as pressing InvisOutlet's button for 5 seconds.*

**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>: 6

```json
{
    "packetID": 221052,
    "payload":
    {
        "callbackName": 6
    }
}
```

**Response**

No response will be sent. The InvisOutlet device will blink for 3 seconds and reboot.


# Factory Reset InvisOutlet

\[TCP/WebSocket <--> InvisOutlet]

> Reset InvisOutlet back to its factory default settings.
>
> This will clear Matter commissioning and clear device customization settings.
>
> *Note: This is the same as pressing InvisOutlet's button for 10 seconds.*

**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>: 7

```json
{
    "packetID": 221053,
    "payload":
    {
        "callbackName": 7
    }
}
```

**Response**

No response will be sent. The InvisOutlet device will blink for 3 seconds and reboot.


# Check MQTT Status

\[TCP/WebSocket <--> InvisOutlet]

> Check if the InvisOutlet's connection status to the MQTT broker.

**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>: 27
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * `0`: Specifies what MQTT commands to send; 0 - Check MQTT status, 1 - Clear Home Assistant Discovery Payload, 2 - Send Home Assistant Discovery Payload.

```json
{
    "packetID": 414883,  
    "payload":
    {
        "callbackName": 27,  
        "callbackArgs": [0] 
    }
}
```

**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 - InvisOutlet is connected to the MQTT broker, 0 - InvisOutlet is not connected to the MQTT broker (check broker IP address, username, password)

```json
{
    "sn": "0003C44076",
    "packetID": 414883,
    "PUBACK": 1
}
```

{% hint style="info" %}
The MQTT configuration is set via [Configure Device Configuration](/invisoutlet-pro/information-and-preferences/configure-device-configuration).
{% endhint %}


# Home Assistant Discovery

\[TCP/WebSocket <--> InvisOutlet]

> Send or clear the InvisOutlet entites in Home Assistant dashboard by the Home Assistant Discovery Payload.

**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>: 27
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * `0`: Specifies what MQTT commands to send; 1 - Clear Home Assistant Discovery Payload, 2 - Send Home Assistant Discovery Payload.

```json
{
    "packetID": 414883,  
    "payload":
    {
        "callbackName": 27,  
        "callbackArgs": [2] 
    }
}
```

**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 - The discovery payload is sent, 0 - The discovery payload is not sent or MQTT broker isn't connected.

```json
{
    "sn": "0003C44076",
    "packetID": 414883,
    "PUBACK": 1
}
```

{% hint style="info" %}
The MQTT configuration is set via [Configure Device Configuration](/invisoutlet-pro/information-and-preferences/configure-device-configuration). Make sure [MQTT is connected](/invisoutlet-pro/device-management/invisoutlet/check-mqtt-status) to the broker before sending/clearing the Home Assistant Discovery Payload.
{% endhint %}


# InvisDeco


# Restart InvisDeco

\[TCP/WebSocket <--> InvisOutlet]

> Perform a restart of the InvisDeco 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>: 24

```json
{
    "packetID": 221054,
    "payload":
    {
        "callbackName": 24
    }
}
```

**Response**

The InvisDeco device will blink for 3 seconds and reboot.

* <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> : 1 - The request is received and will be processed.

```json
{
    "sn": "0003C44076",
    "packetID": 221054,
    "PUBACK": 1
}
```


# Reset InvisDeco

\[TCP/WebSocket <--> InvisOutlet]

> Perform a reset of the InvisDeco device.
>
> This will clear all air quality calibration data for InvisDeco Pro.

**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>: 25

```json
{
    "packetID": 221055,
    "payload":
    {
        "callbackName": 25
    }
}
```

**Response**

The InvisDeco device will blink for 3 seconds and reboot.

* <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> : 1 - The request is received and will be processed.

```json
{
    "sn": "0003C44076",
    "packetID": 221055,
    "PUBACK": 1
}
```

{% hint style="info" %}
If your air quality index (and related) metrics are not accurate, or the InvisDeco Pro has been switched from one place to another, please perform this action ([Reset InvisDeco](/invisoutlet-pro/device-management/invisdeco/reset-invisdeco)) to clear and start calibration from fresh.
{% endhint %}


# Occupancy Sensor Calibration

\[TCP/WebSocket <--> InvisOutlet]

> This request performs the background noise detection of the occupancy sensor for InvisOutlet Pro.

{% hint style="info" %}
If you believe your occupancy sensor is not accurate for your area, please perform this API request.

Before you start, please make sure no one is in the area that InvisOutlet and InvisDeco are installed at. Once the request is sent, the occupancy sensor will start doing background noise detection in 10 seconds, and perform the calibration based on the time you provided in  the request.

*Note: We recommend the detection time to be at least 30 seconds and maximum 60 seconds.*
{% endhint %}

**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>: 26
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * `0`: Specifies the calibration duration, 30 seconds is recommended

```json
{
    "packetID": 221056,
    "payload":
    {
        "callbackName": 26,
        "callbackArgs": [30]
    }
}
```

**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> : 1 - The request is received and calibration will begin in 10 seconds. 0 - Timeout to request occupancy sensor to perform calibration. Please try to restart InvisDeco and try again.

```json
{
    "sn": "0003C44076",
    "packetID": 221056,
    "PUBACK": 1
}
```

{% hint style="info" %}
The status of the occupancy calibration can be checked by the [Synchronous Updates - Sensors](/invisoutlet-pro/synchronous-updates/sensors) response, <mark style="color:red;">`occupancy_state`</mark> is 4/5/6.&#x20;
{% endhint %}


# Temperature and Relative Humidity Calibration

\[TCP/WebSocket <--> InvisOutlet]

> This request calibrates the temperature and relative humidity of the InvisDeco Pro.

{% hint style="info" %}
If you believe your temperature and humidity sensor is not accurate for your area, please perform this API request.

Please make sure no appliances or adapters are plugged into the InvisOutlet for 30 minutes before the calibration.

*Note: This calibration cannot compensate heat generated from plugged-in devices into the receptacle of the InvisOutlet.*
{% endhint %}

**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>: 28
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * `0`: The actual temperature in the area in Celsius in millis. For example: 25ºC would be 25000.
    * `1`: The actual relative humidity in the area in percentage in millis. For example: 50% would be 50000.

```json
{
    "packetID": 221057,
    "payload":
    {
        "callbackName": 28,
        "callbackArgs": [25000, 50000]
    }
}
```

**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> : 1 - The request is received and calibration has been processed successfully. 0 - Timeout to request occupancy sensor to perform calibration. Please try to restart InvisDeco and try again.

```json
{
    "sn": "0003C44076",
    "packetID": 221057,
    "PUBACK": 1
}
```

{% hint style="info" %}
In order to provide the most accurate AQI measurements, the InvisDeco Pro will reset and restart in order to apply the updated temperature and humidity calibration.
{% endhint %}


# API Reference

{% content-ref url="/pages/hzdGrhYrRmPvzHYMATPG" %}
[Terminology](/invisoutlet-pro/api-reference/terminology)
{% endcontent-ref %}


# Terminology

<mark style="color:red;">`callbackName`</mark> is used to define the callback function, as follow:

* Request Device Configuration = 1
* Configure Device Configuration = 2
* Request Accessory Names = 3
* Configure Accessory Names = 4
* Restart InvisOutlet = 5
* Reset InvisOutlet's Network Settings = 6
* Reset InvisOutlet to Factory Defaults = 7
* Fetch Outlet Status = 9
* Outlet Control = 10
* Fetch Sensor Data = 11
* Request Device Information = 12
* Nightlight Control = 14
* Fetch Nightlight Status = 15
* Request Available Updates = 20
* Perform OTA Update = 21
* OTA Download Progress Update = 22
* OTA Result Update = 23
* Restart InvisDeco = 24
* Reset InvisDeco = 25
* Occupancy Sensor Calibration = 26
* MQTT Status and Settings = 27


# Getting Started

Establishing Connections

{% hint style="info" %}
TCP connection can be established via Command Prompt or Terminal, depending on the operating system.
{% endhint %}

Establishing connection in Windows:

```sh
netcat {{aabbccddeeff.local}} 3333
```

Establishing connection in macOS or Linux:

```bash
nc {{aabbccddeeff.local}} 3333
```


# Information and Preferences

{% content-ref url="/pages/ASk6Tvj2j128DbiwGnJk" %}
[Get Device Information](/invisoutlet-pro/information-and-preferences/get-device-information)
{% endcontent-ref %}

{% content-ref url="/pages/FVASn1txQF6GQahULctQ" %}
[Request Device Configuration](/invisoutlet-pro/information-and-preferences/request-device-configuration)
{% endcontent-ref %}

{% content-ref url="/pages/FwNpjerXwCZlxUdtbG7s" %}
[Configure Device Configuration](/invisoutlet-pro/information-and-preferences/configure-device-configuration)
{% endcontent-ref %}

{% content-ref url="/pages/eGTCAQIdiNQCHKdvd9Tj" %}
[Request Accessory Names](/invisoutlet-pro/information-and-preferences/request-accessory-names)
{% endcontent-ref %}

{% content-ref url="/pages/bLbZqkXVrHfUw9W3oCFx" %}
[Configure Accessory Names](/invisoutlet-pro/information-and-preferences/configure-accessory-names)
{% endcontent-ref %}


# Get Device Information

\[TCP -> InvisOutlet]

> Request and retrieve detailed device information for both InvisOutlet and InvisDeco.

**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>: 12

```json
{
  "packetID": 373184,    
  "payload":
  {
    "callbackName": 12
  }
}
```

**Response**

* <mark style="color:red;">`sn`</mark>: The serial number of the device.
* <mark style="color:red;">`packetID`</mark>: A randomly generated six-digit number.
* <mark style="color:red;">`PUBACK`</mark> : If the request is successfully processed; 1 - Successful, 0 - Fail.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 12
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * <mark style="color:red;">`IM`</mark>:
      * <mark style="color:red;">`sn`</mark>: Serial number
      * <mark style="color:red;">`MAC`</mark>: MAC address
      * <mark style="color:red;">`device`</mark>: Name of the device role
      * <mark style="color:red;">`type`</mark>: Name of the device type *(this field only exists if the device type is C)*
      * <mark style="color:red;">`hw_rev`</mark>: Hardware version of the InvisOutlet
      * <mark style="color:red;">`fw_rev`</mark>: Firmware version of the InvisOutlet
    * <mark style="color:red;">`PM`</mark>:
      * <mark style="color:red;">`online`</mark>: The status of whether the InvisDeco is connected to InvisOutlet
      * <mark style="color:red;">`sn`</mark>: Serial number
      * <mark style="color:red;">`MAC`</mark>: MAC address
      * <mark style="color:red;">`device`</mark>: Name of the device role
      * <mark style="color:red;">`type`</mark>: Name of the device type
      * <mark style="color:red;">`radar`</mark>: Occupancy sensor device information
        * <mark style="color:red;">`fw_rev`</mark>: Firmware version of the occupancy sensor
        * <mark style="color:red;">`hw_type`</mark>: Hardware type of the occupancy sensor
        * <mark style="color:red;">`MAC`</mark>: MAC address of the occupancy sensor
      * <mark style="color:red;">`hw_rev`</mark>: Hardware version of the InvisDeco
      * <mark style="color:red;">`fw_rev`</mark>: Firmware version of the InvisDeco

```json
{
  "sn": "12A3520006E",
  "packetID": 373184,
  "PUBACK": 1,
  "payload": {
    "callbackName": 12,
    "callbackArgs": {
      "IM": {
        "sn": "12A3520006E",
        "MAC": "10BDA3AD5F10",
        "device": "InvisOutlet",
        "type": "C",
        "hw_rev": "revA",
        "fw_rev": "0.0.1"
      },
      "PM": {
        "online": true,
        "sn": "24A182018C0",
        "MAC": "08A6F77CBCE8",
        "device": "InvisDeco",
        "type": "Pro",
        "radar": {
          "fw_ver": "V2.49.24092917",
          "hw_type": "0100",
          "MAC": "DE8F27147941"
        },
        "hw_rev": "revA",
        "fw_rev": "1.0.2"
      }
    }
  }
}
```


# Request Device Configuration

\[TCP -> InvisOutlet]

> Returns a list of configuration 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> : 1

```json
{
  "packetID": 819796,
  "payload":
  {
    "callbackName": 1
  }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 1
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * <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;">`aqiColorRGBFeature`</mark>: Enable/disable InvisDeco's RGB indicator light to indicator AQI color code; 1 - On, 0 - Off.
      * <mark style="color:red;">`motionAwayFeature`</mark>: Enable/disable InvisDeco's Security Alert feature; 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>: Enable this setting to override <mark style="color:red;">`adaptiveNightlightFeature`</mark>  and <mark style="color:red;">`occupancyNightlightFeature`</mark> if either one is enabled. If enabled, <mark style="color:red;">`adaptiveNightlightFeature`</mark>  and <mark style="color:red;">`occupancyNightlightFeature`</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;">`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
{
  "sn" : "12A3520006E",
  "packetID" : 819796,
  "PUBACK" : 1,
  "payload" : {
    "callbackName" : 1,
    "callbackArgs" : {
      "acc_prefs" : {
        "outletPwrIndicatorOn" : 1,
        "pmIndicatorBrightness" : 30,
        "capacitiveCtrl" : 1,
        "magicTouchCtrl" : 1,
        "aqiColorRGBFeature" : 1,
        "motionAwayFeature" : 0,
        "adaptiveNightlightFeature" : 0,
        "adaptiveMinBrightness" : 0,
        "adaptiveMaxBrightness" : 100,
        "occupancyNightlightFeature" : 0,
        "overrideAdaptiveOccupancyNightlightFeature" : 1,
        "homeAwayMode" : {
          "enabled" : 0,
          "outlet1Enabled" : 1,
          "nightlightEnabled" : 1,
          "minBrightness" : 0,
          "maxBrightness" : 100,
          "minOnDuration" : 0,
          "maxOnDuration" : 60,
          "minOffDuration" : 0,
          "maxOffDuration" : 60
        }
      },
      "sys_prefs" : {
        "mqtt" : {
          "enabled" : 1,
          "mqtt_broker_url" : "mqtt://homeassistant.local:1883",
          "user" : "mqttuser",
          "pass" : "mqttpass",
          "qos" : 1
        },
        "internet" : {
          "ip" : 2751572160,
          "mainDNS" : 16885952,
          "backupDNS" : 0
        }
      }
    }
  }
}
```

<details>

<summary>Special Features Description</summary>

* Security Alert: If any motion is detected, all InvisDeco indicators and nightlight will flash at maximum brightness, until no motion is detected.
* 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.
* Occupancy Nightlight: The nightlight will automatically be turned on when occupancy is detected. <mark style="color:red;">`adaptiveNightlightFeature`</mark> and <mark style="color:red;">`occupancyNightlightFeature`</mark> can be activated at the same time. When <mark style="color:red;">`adaptiveNightlightFeature`</mark> is not activated, the nightlight will be turned on based on previously set brightness, when <mark style="color:red;">`adaptiveNightlightFeature`</mark> is activated, then it will follow *Adaptive Nightlight*'s settings to turn on/off the nightlight.
* Home Away Mode: The home away mode will randomly turn on/off outlet 1, and/or nightlight depending on if <mark style="color:red;">`outlet1Enabled`</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>


# Configure Device Configuration

\[TCP <--> InvisOutlet]

> 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;">`aqiColorRGBFeature`</mark>: Enable/disable InvisDeco's RGB indicator light to indicate AQI color code; 1 - On, 0 - Off.
      * <mark style="color:red;">`motionAwayFeature`</mark>: Enable/disable InvisDeco's Security Alert feature; 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>  and <mark style="color:red;">`occupancyNightlightFeature`</mark> if either one is enabled. If enabled, <mark style="color:red;">`adaptiveNightlightFeature`</mark>  and <mark style="color:red;">`occupancyNightlightFeature`</mark>  will be disabled when the user controls the nightlight on/off or brightness; 1 - On, 0 - Off.
    * <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" : 30,
          "capacitiveCtrl" : 1,
          "magicTouchCtrl" : 1,
          "aqiColorRGBFeature" : 1,
          "motionAwayFeature" : 0,
          "adaptiveNightlightFeature" : 0,
          "adaptiveMinBrightness" : 0,
          "adaptiveMaxBrightness" : 100,
          "occupancyNightlightFeature" : 0,
          "overrideAdaptiveOccupancyNightlightFeature" : 1,
          "homeAwayMode" : {
            "enabled" : 0,
            "outlet1Enabled" : 1,
            "nightlightEnabled" : 1,
            "minBrightness" : 0,
            "maxBrightness" : 100,
            "minOnDuration" : 0,
            "maxOnDuration" : 60,
            "minOffDuration" : 0,
            "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>

* Security Alert: If any motion is detected, all InvisDeco indicators and nightlight will flash at maximum brightness, until no motion is detected.
* 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.
* Occupancy Nightlight: The nightlight will automatically be turned on when occupancy is detected. <mark style="color:red;">`adaptiveNightlightFeature`</mark> and <mark style="color:red;">`occupancyNightlightFeature`</mark> can be activated at the same time. When <mark style="color:red;">`adaptiveNightlightFeature`</mark> is not activated, the nightlight will be turned on based on previously set brightness, when <mark style="color:red;">`adaptiveNightlightFeature`</mark> is activated, then it will follow *Adaptive Nightlight*'s settings to turn on/off the nightlight.
* Home Away Mode: The home away mode will randomly turn on/off outlet 1, and/or nightlight depending on if <mark style="color:red;">`outlet1Enabled`</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": "12A3520006E",
  "packetID": 713327,
  "PUBACK": 1
}
```

&#x20;


# Request Accessory Names

\[TCP -> InvisOutlet]

> Request and retrieve accessory names from 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>: 3

```json
{
  "packetID": 180072,
  "payload":
  {
    "callbackName": 3   
  }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 3
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * <mark style="color:red;">`accessory`</mark>: 1 - Outlet 1 (Top), 2 - Outlet 2 (Bottom), 3 - Nightlight (if InvisDeco is installed).
    * <mark style="color:red;">`name`</mark>: The corresponding names for the <mark style="color:red;">`accessory`</mark>.

```json
{
  "sn": "12A3520006E",
  "packetID": 180072,
  "PUBACK": 1,
  "payload": {
    "callbackName": 3,
    "callbackArgs": [
      {
        "accessory": 1,
        "name": "Outlet 1"
      },
      {
        "accessory": 2,
        "name": "Outlet 2"
      },
      {
        "accessory": 3,
        "name": "Nightlight"
      }
    ]
  }
}
```


# Configure Accessory Names

\[TCP <--> InvisOutlet]

> Configure and set accessory names for 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> : 4
  * <mark style="color:red;">`callbackArgs`</mark> :
    * <mark style="color:red;">`accessory`</mark>: 1 - Outlet 1 (Top), 2 - Outlet 2 (Bottom), 3 - Nightlight (if InvisDeco is installed).
    * <mark style="color:red;">`name`</mark>: The corresponding names for the <mark style="color:red;">`accessory`</mark>.

```json
{
  "packetID": 950302,
  "payload":
  {
    "callbackName": 4,  
    "callbackArgs":
    [
      {
        "accessory": 1,    
        "name": "Fan"
      },
      {
        "accessory": 2,    
        "name": "Charger"
      },
      {
        "accessory": 3,     
        "name": "Nightlight"
      }
    ]
  }
}
```

**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": "0003C44076",
  "packetID": 950302,
  "PUBACK": 1
}
```


# Accessory Controls

{% content-ref url="/pages/pfWfIYYqSEMh9SWNN5G2" %}
[Outlets](/invisoutlet-pro/accessory-controls/outlets)
{% endcontent-ref %}

{% content-ref url="/pages/XJ4ssL23seq4fa6UNZvN" %}
[Nightlight](/invisoutlet-pro/accessory-controls/nightlight)
{% endcontent-ref %}


# Outlets

\[TCP <--> InvisOutlet]

> Control InvisOutlet's outlet 1.

**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> : 10
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: 1 - Outlet 1 (Top).
    * `2`: 1 - On, 0 - Off.

```json
{
  "packetID": 684761,
  "payload": {
    "callbackName": 10,
    "callbackArgs": [
      1,
      1
    ]
  }
}
```

#### 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": "12A3520006E",
  "packetID": 684761,
  "PUBACK": 1
}
```


# Nightlight

\[TCP <--> InvisOutlet]

> Control InvisDeco Pro's nightlight on/off and its brightness.

**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> : 14
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: 1 - On, 0 - Off.
    * `2`: The nightlight brightness, ranging from 0 to 100.

```json
{
  "packetID": 164423,
  "payload":
  {
    "callbackName": 14,
    "callbackArgs": [1, 100]
  }
}
```

#### 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": "12A3520006E",
  "packetID": 164423,
  "PUBACK": 1
}
```


# Fetch Accessory Status

{% content-ref url="/pages/sZe6ig5jo7ZGXscJcSUx" %}
[Outlets](/invisoutlet-pro/fetch-accessory-status/outlets)
{% endcontent-ref %}

{% content-ref url="/pages/ZbeaMNPybKpJcrQt34bn" %}
[Nightlight](/invisoutlet-pro/fetch-accessory-status/nightlight)
{% endcontent-ref %}

{% content-ref url="/pages/KtXae3X9aB9gYZwHas51" %}
[Sensors](/invisoutlet-pro/fetch-accessory-status/sensors)
{% endcontent-ref %}


# Outlets

\[TCP -> InvisOutlet]

> Fetch InvisOutlet's latest outlets status.

**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>: 9

```json
{
  "packetID": 369953,
  "payload":
  {
    "callbackName": 9
  }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 9
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Whether the Outlet 1 power is on or off; 1 - On, 0 - Off.
    * `2` : Whether the Outlet 2 power is on or off; 1 - On, 0 - Off. *(this will always be 1)*

```json
{
  "sn": "12A3520006E",
  "packetID": 369953,
  "PUBACK": 1,
  "payload": {
    "callbackName": 9,
    "callbackArgs": [
      1,
      1
    ]
  }
}
```


# Nightlight

\[TCP -> InvisOutlet]

> Fetch InvisDeco's latest nightlight status.

**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>: 15

```json
{
  "packetID": 349027,
  "payload":
  {
    "callbackName": 15
  }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 15
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Whether the Nightlight power is on or off; 1 - On, 0 - Off.
    * `2` : The nightlight brightness; ranging from 0 to 100 percent.

```json
{
  "sn": "12A3520006E",
  "packetID": 349027,
  "PUBACK": 1,
  "payload": {
    "callbackName": 15,
    "callbackArgs": [
      1,
      10
    ]
  }
}
```


# Sensors

\[TCP -> InvisOutlet]

> Fetch InvisDeco's latest sensor readings.

**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>: 11

```json
{
  "packetID": 371939,
  "payload":
  {
    "callbackName": 11
  }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 11
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : The InvisDeco device type; reserved for internal use.
    * `2` :&#x20;
      * <mark style="color:red;">`temp_valid`</mark> : A flag indicating the validity of the temperature and humidity sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`aqi_valid`</mark> : A flag indicating the validity of the air quality sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`temp_celsius`</mark>: Temperature in Celsius.
      * <mark style="color:red;">`humidity`</mark>: Relative humidity in percentage.
      * <mark style="color:red;">`BME680_temp_celsius`</mark>: Temperature from the air quality sensor.
      * <mark style="color:red;">`BME680_humidity`</mark>: Humidity from the air quality sensor.
      * <mark style="color:red;">`AQI`</mark>: Air quality index level.
      * <mark style="color:red;">`AQI_accuracy`</mark> : Accuracy of the AQI measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`pressure`</mark>: Atmospheric pressure in Pascals (Pa).
      * <mark style="color:red;">`gas`</mark>: Gas sensor reading in Ohms.
      * <mark style="color:red;">`co2_equiv`</mark>: Equivalent CO2 concentration in parts per million (ppm).
      * <mark style="color:red;">`co2_peak_lvl`</mark>: Peak CO2 concentration in ppm.
      * <mark style="color:red;">`co2_accuracy`</mark>: Accuracy of the CO2 measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`bvoc_equiv`</mark>: Equivalent breathe volatile organic compounds (bVOC) concentration in ppm.
      * <mark style="color:red;">`bvoc_accuracy`</mark>: Accuracy of the bVOC measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`lux_valid`</mark>: A flag indicating the ambient brightness sensor validity of the sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`lux`</mark>: Ambient brightness level in LUX.
      * <mark style="color:red;">`occupancy_valid`</mark>: A flag indicating the occupancy sensor validity of the sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`occupancy_state`</mark>: The occupancy detected state; 0: no occupancy, 1: movement only, 2: stationary only, 3: stationary and movement, 4: calibration in progress, 5: calibration completed, 6: calibration failed.
      * <mark style="color:red;">`distance`</mark>: The occupancy detected distance in centimeter (cm) between the device and the human movement.
      * <mark style="color:red;">`movement_energy`</mark>: The energy level of the detected movement occupancy; 0 (lowest) - 100 (highest)
      * <mark style="color:red;">`stationary_energy`</mark>: The energy level of the detected stationary occupancy; 0 (lowest) - 100 (highest)

```json
{
  "sn": "12A3520006E",
  "packetID": 371939,
  "PUBACK": 1,
  "payload": {
    "callbackName": 11,
    "callbackArgs": [
      4,
      {
        "temp_valid": 1,
        "aqi_valid": 1,
        "temp_celsius": "22.44",
        "humidity": "71.50",
        "temphumidity_accuracy": 1,
        "BME680_temp_celsius": "30.79",
        "BME680_humidity": "38.55",
        "AQI": 64,
        "AQI_accuracy": 3,
        "pressure": 99813,
        "gas": 333637,
        "co2_equiv": 641,
        "bvoc_equiv": "0.68",
        "lux_valid": 1,
        "lux": "576.50",
        "occupancy_valid": 1,
        "occupancy_state": 2,
        "distance": 270,
        "movement_energy": 0,
        "stationary_energy": 60
      }
    ]
  }
}
```


# Synchronous Updates

The device will send synchronous updates when the TCP/WebSocket connection is established. This section describes all the synchronous updates that will be sent from InvisOutlet.

{% content-ref url="/pages/y66Gq5RoyzeWHZqHHs6q" %}
[Outlets](/invisoutlet-pro/synchronous-updates/outlets)
{% endcontent-ref %}

{% content-ref url="/pages/mJrnGO5NnF7nP2v83bCh" %}
[Nightlight](/invisoutlet-pro/synchronous-updates/nightlight)
{% endcontent-ref %}

{% content-ref url="/pages/bHMSowpNcugN4YqlWJbm" %}
[Sensors](/invisoutlet-pro/synchronous-updates/sensors)
{% endcontent-ref %}


# Outlets

\[InvisOutlet -> TCP]

> Updating InvisOutlet's latest outlets status.

#### Response

* <mark style="color:red;">`sn`</mark>: The serial number of the InvisOutlet.
* <mark style="color:red;">`packetID`</mark>: Represents the packet ID.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 9
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Whether the Outlet 1 power is on or off; 1 - On, 0 - Off.
    * `2` : Whether the Outlet 2 power is on or off; 1 - On, 0 - Off. *(this will always be 1)*

```json
{
  "sn": "12A3520006E",
  "packetID": 651322,
  "payload": {
    "callbackName": 9,
    "callbackArgs": [
      1,
      1
    ]
  }
}
```


# Nightlight

\[InvisOutlet -> TCP]

> Updating InvisDeco's latest nightlight status.

#### Response

* <mark style="color:red;">`sn`</mark>: The serial number of the InvisOutlet.
* <mark style="color:red;">`packetID`</mark>: Represents the packet ID.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 15
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Whether the Nightlight power is on or off; 1 - On, 0 - Off.
    * `2` : The nightlight brightness; ranging from 0 to 100 percent.

```json
{
  "sn": "12A3520006E",
  "packetID": 849635,
  "payload": {
    "callbackName": 15,
    "callbackArgs": [
      1,
      80
    ]
  }
}
```


# Sensors

\[InvisOutlet -> TCP]

> Updating InvisDeco's latest sensor readings.

#### Response

* <mark style="color:red;">`sn`</mark>: The serial number of the InvisOutlet.
* <mark style="color:red;">`packetID`</mark>: Represents the packet ID.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 11
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `0` : The InvisDeco device type.
    * `1` :&#x20;
      * <mark style="color:red;">`temp_valid`</mark> : A flag indicating the validity of the temperature and humidity sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`aqi_valid`</mark> : A flag indicating the validity of the air quality sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`temp_celsius`</mark>: Temperature in Celsius.
      * <mark style="color:red;">`humidity`</mark>: Relative humidity in percentage.
      * <mark style="color:red;">`BME680_temp_celsius`</mark>: Temperature from the air quality sensor.
      * <mark style="color:red;">`BME680_humidity`</mark>: Humidity from the air quality sensor.
      * <mark style="color:red;">`AQI`</mark>: Air quality index level.
      * <mark style="color:red;">`AQI_accuracy`</mark> : Accuracy of the AQI measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`pressure`</mark>: Atmospheric pressure in Pascals (Pa).
      * <mark style="color:red;">`gas`</mark>: Gas sensor reading in Ohms.
      * <mark style="color:red;">`co2_equiv`</mark>: Equivalent CO2 concentration in parts per million (ppm).
      * <mark style="color:red;">`co2_peak_lvl`</mark>: Peak CO2 concentration in ppm.
      * <mark style="color:red;">`co2_accuracy`</mark>: Accuracy of the CO2 measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`bvoc_equiv`</mark>: Equivalent breathe volatile organic compounds (bVOC) concentration in ppm.
      * <mark style="color:red;">`bvoc_accuracy`</mark>: Accuracy of the bVOC measurement; 3 - most accurate, 2 - average accuracy, 1 - least accuracy, 0 - calibration in process.
      * <mark style="color:red;">`lux_valid`</mark>: A flag indicating the ambient brightness sensor validity of the sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`lux`</mark>: Ambient brightness level in LUX.
      * <mark style="color:red;">`occupancy_valid`</mark>: A flag indicating the occupancy sensor validity of the sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`occupancy_state`</mark>: The occupancy detected state; 0: no occupancy, 1: movement only, 2: stationary only, 3: stationary and movement, 4: calibration in progress, 5: calibration success; 6: calibration failed.
      * <mark style="color:red;">`distance`</mark>: The occupancy detected distance in centimeter (cm) between the device and the human movement.
      * <mark style="color:red;">`movement_energy`</mark>: The energy level of the detected movement occupancy; 0 (lowest) - 100 (highest)
      * <mark style="color:red;">`stationary_energy`</mark>: The energy level of the detected stationary occupancy; 0 (lowest) - 100 (highest)

```json
{
  "sn": "12A3520006E",
  "packetID": 600204,
  "payload": {
    "callbackName": 11,
    "callbackArgs": [
      4,
      {
        "temp_valid": 1,
        "aqi_valid": 1,
        "temp_celsius": "23.85",
        "humidity": "67.26",
        "temphumidity_accuracy": 1,
        "BME680_temp_celsius": "31.91",
        "BME680_humidity": "36.65",
        "AQI": 58,
        "AQI_accuracy": 3,
        "pressure": 99814,
        "gas": 337712,
        "co2_equiv": 587,
        "bvoc_equiv": "0.60",
        "lux_valid": 1,
        "lux": "389.85",
        "occupancy_valid": 1,
        "occupancy_state": 3,
        "distance": 54,
        "movement_energy": 100,
        "stationary_energy": 100
      }
    ]
  }
}
```


# Sensors - Magic Touch

\[InvisOutlet -> TCP]

> Sending update when magic touch is triggered.

{% hint style="info" %}
This uses the same <mark style="color:red;">`callbackName`</mark> as [Sensors](/invisoutlet-pro/synchronous-updates/sensors).
{% endhint %}

#### Response

* <mark style="color:red;">`sn`</mark>: The serial number of the InvisOutlet.
* <mark style="color:red;">`packetID`</mark>: Represents the packet ID.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 11
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `0` : The InvisDeco device type.
    * `1` :&#x20;
      * <mark style="color:red;">`magic_touch_1`</mark> : A flag indicating if the first Magic Touch button is pressed with touch duration in milliseconds.
      * <mark style="color:red;">`magic_touch_2`</mark> : A flag indicating if the second Magic Touch button is pressed with touch duration in milliseconds.

```json
{
  "sn": "12A3520006E",
  "packetID": 849726,
  "payload": {
    "callbackName": 11,
    "callbackArgs": [
      4,
      {
        "magic_touch_1": 14770
      }
    ]
  }
}
```

{% hint style="info" %}
As the Magic Touch button will likely be triggered one at a time, the response payload will only contain either <mark style="color:red;">`magic_touch_1`</mark>  or <mark style="color:red;">`magic_touch_2`</mark> .
{% endhint %}


# OTA

{% content-ref url="/pages/j2gDUOAXXMl5Od5SItuE" %}
[Request Available Updates](/invisoutlet-pro/ota/request-available-updates)
{% endcontent-ref %}

{% content-ref url="/pages/j1ftedsvOZZBle1qL3KS" %}
[Perform OTA Update](/invisoutlet-pro/ota/perform-ota-update)
{% endcontent-ref %}

{% content-ref url="/pages/oibrRGZ0k3cRnjp6ThtG" %}
[OTA Download Progress (Synchronous)](/invisoutlet-pro/ota/ota-download-progress-synchronous)
{% endcontent-ref %}

{% content-ref url="/pages/aI6emsSQvbAq853Kj6Ux" %}
[OTA Result Update (Synchronous)](/invisoutlet-pro/ota/ota-result-update-synchronous)
{% endcontent-ref %}


# Request Available Updates

\[TCP <--> InvisOutlet]

> Check available firmware updates (Over-the-Air updates) for InvisOutlet and InvisDeco.

**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>: 20

```json
{
  "packetID": 221040,
  "payload":
  {
    "callbackName": 20
  }
}
```

**Response**

Succes&#x73;**:**

* <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.
  * <mark style="color:red;">`callbackName`</mark>: 20
    * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
      * <mark style="color:red;">`IM`</mark>:
        * <mark style="color:red;">`fw_rev`</mark>: The current running firmware version of the InvisOutlet.
        * <mark style="color:red;">`available_fw_rev`</mark>: The available firmware version for the InvisOutlet; if the available firmware revision matches the current firmware revision, indicating that there is no available updates.
      * <mark style="color:red;">`PM`</mark> :
        * <mark style="color:red;">`fw_rev`</mark>: The current running firmware version of the InvisDeco.
        * <mark style="color:red;">`available_fw_rev`</mark>: The available firmware version for the InvisDeco; if the available firmware revision matches the current firmware revision, indicating that there is no available updates.

```json
{
  "sn": "12A3520006E",
  "packetID": 221040,
  "PUBACK": 1,
  "payload": {
    "callbackName": 20,
    "callbackArgs": {
      "IM": {
        "fw_rev": "0.0.1",
        "available_fw_rev": "0.0.2"
      },
      "PM": {
        "fw_rev": "1.0.2",
        "available_fw_rev": "1.0.2"
      }
    }
  }
}
```

Fai&#x6C;**:**

* <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; 0 - Failed.

```json
{
  "sn": "12A3520006E",
  "packetID": 221040,
  "PUBACK": 0
}
```


# Perform OTA Update

\[TCP <--> InvisOutlet]

> Performing updates to the latest firmware for either InvisOutlet or InvisDeco.

**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>: 21
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * `0`: Specifies which device to update; 1 - InvisOutlet, 2 - InvisDeco.
    * `1`: Specifies which method to update InvisDeco; 0 - via Wi-Fi, 1 - via InvisOutlet

{% hint style="info" %}
If you are having trouble using the *via Wi-Fi* method to update InvisDeco, please try to update InvisDeco via the *via InvisOutlet* method.
{% endhint %}

```json
{
  "packetID": 414883,  
  "payload":
  {
    "callbackName": 21,  
    "callbackArgs": [1,0] 
  }
}
```

**Response (revB, synchronous)**

* <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;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 21
  * <mark style="color:red;">`callbackArgs`</mark>:
    * `0`: Specifies which device is performing the update; 1 - InvisOutlet, 2 - InvisDeco.
    * `1`: Specifies whether the OTA is performed successfully or not; 1 - OTA will continue to perform, 0 - Fail

```json
{
    "sn": "0003C44076",
    "packetID": 414883,
    "payload":
    {
        "callbackName": 21,
        "callbackArgs": [1,1]
    }
}
```

{% hint style="info" %}
The device will restart immediately to perform the OTA update.

In order to receive the response, you will need to reconnect the TCP connection again.
{% endhint %}

{% hint style="info" %}
The OTA update status will be updated via [OTA Download Progress (Synchronous)](/invisoutlet-pro/ota/ota-download-progress-synchronous) and [OTA Result Update (Synchronous)](/invisoutlet-pro/ota/ota-result-update-synchronous). Please note the <mark style="color:red;">`packetID`</mark> will be different then the requested <mark style="color:red;">`packetID`</mark>.
{% endhint %}


# OTA Download Progress (Synchronous)

\[InvisOutlet -> TCP/WebSocket]

> Updating device's OTA firmware download progress.

#### 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;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 22
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : 1 - InvisOutlet, 2 - InvisDeco, 3 - InvisOutlet (WWW partition)
    * `2` : The percentage of download progress; 0 - 100%

```json
{
    "sn": "0003D44076",
    "packetID": 301552,
    "payload": {
        "callbackName": 22,
        "callbackArgs": [
            1,
            90
        ]
    }
}
```


# OTA Result Update (Synchronous)

\[InvisOutlet -> TCP/WebSocket]

> Updating device's OTA firmware download progress.

#### 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;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 23
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : 1 - InvisOutlet, 2 - InvisDeco,  3 - InvisOutlet
    * `2` : Whether the OTA is performed successfully or not; 1 - Device will reboot immediately, 0 - Fail

```json
{
    "sn": "0003D44076",
    "packetID": 301552,
    "payload": {
        "callbackName": 23,
        "callbackArgs": [
            1,
            1
        ]
    }
}
```


# Device Management

{% content-ref url="/pages/qTppEdEOcG8sBHQvpGoU" %}
[InvisOutlet](/invisoutlet-pro/device-management/invisoutlet)
{% endcontent-ref %}

{% content-ref url="/pages/dWM4KlKkpgWV1El9g18k" %}
[InvisDeco](/invisoutlet-pro/device-management/invisdeco)
{% endcontent-ref %}


# InvisOutlet


# Restart InvisOutlet

\[TCP -> InvisOutlet]

> Perform a restart of the InvisOutlet device.
>
> *Note: This only reboots InvisOutlet itself, where double-clicking the button on the InvisOutlet will reboot both InvisOutlet and InvisDeco.*

**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>: 5

```json
{
  "packetID": 221051,
  "payload": {
    "callbackName": 5
  }
}
```

**Response**

No response will be sent. The InvisOutlet device will blink for 3 seconds and reboot.


# Reset InvisOutlet's Network Settings

\[TCP <--> InvisOutlet]

> Reset InvisOutlet's network settings.
>
> This will clear Matter commissioning but will not clear device customization settings.
>
> *Note: This is the same as pressing InvisOutlet's button for 5 seconds.*

**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>: 6

```json
{
  "packetID": 221052,
  "payload": {
    "callbackName": 6
  }
}
```

**Response**

No response will be sent. The InvisOutlet device will blink for 3 seconds and reboot.


# Factory Reset InvisOutlet

\[TCP <--> InvisOutlet]

> Reset InvisOutlet back to its factory default settings.
>
> This will clear Matter commissioning and clear device customization settings.
>
> *Note: This is the same as pressing InvisOutlet's button for 10 seconds.*

**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>: 7

```json
{
  "packetID": 221053,
  "payload": {
    "callbackName": 7
  }
}
```

**Response**

No response will be sent. The InvisOutlet device will blink for 3 seconds and reboot.


# Check MQTT Status

\[TCP <--> InvisOutlet]

> Check if the InvisOutlet's connection status to the MQTT broker.

**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>: 27
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * `0`: Specifies what MQTT commands to send; 0 - Check MQTT status, 1 - Clear Home Assistant Discovery Payload, 2 - Send Home Assistant Discovery Payload.

```json
{
  "packetID": 414883,  
  "payload":
  {
    "callbackName": 27,  
    "callbackArgs": [0] 
  }
}
```

**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 - InvisOutlet is connected to the MQTT broker, 0 - InvisOutlet is not connected to the MQTT broker (check broker IP address, username, password)

```json
{
  "sn": "12A3520006E",
  "packetID": 414883,
  "PUBACK": 1
}
```

{% hint style="info" %}
The MQTT configuration is set via [Configure Device Configuration](/invisoutlet-pro/information-and-preferences/configure-device-configuration).
{% endhint %}


# Home Assistant Discovery

\[TCP <--> InvisOutlet]

> Send or clear the InvisOutlet entites in Home Assistant dashboard by the Home Assistant Discovery Payload.

**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>: 27
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * 0: Specifies which MQTT command to run: 0 - Check MQTT status; 1 - Clear all Home Assistant discovery payloads, including the original outlet/PM entities and the additional accessory-preference entities; 2 - Send the original outlet and attached-PM discovery payloads; 3 - Send the additional accessory-preference discovery payloads and current retained states. \
      *Note: Argument 3 clears stale accessory-preference discovery entries, publishes only settings supported by the attached InvisDeco, and republishes their current retained states. It does not change accessory preferences or resend the original InvisOutlet or InvisDeco discovery entities. After argument 1, send argument 2 followed by argument 3 to restore both entity sets.*

```json
{
  "packetID": 414883,  
  "payload":
  {
    "callbackName": 27,  
    "callbackArgs": [3] 
  }
}
```

**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 - The discovery payload is sent, 0 - The discovery payload is not sent or MQTT broker isn't connected.

```json
{
  "sn": "12A3520006E",
  "packetID": 414883,
  "PUBACK": 1
}
```

{% hint style="info" %}
The MQTT configuration is set via [Configure Device Configuration](/invisoutlet-pro/information-and-preferences/configure-device-configuration). Make sure [MQTT is connected](/invisoutlet-pro/device-management/invisoutlet/check-mqtt-status) to the broker before sending/clearing the Home Assistant Discovery Payload.
{% endhint %}


# Matter Mode Switching

\[TCP <--> InvisOutlet]

> Read the device's current Matter network mode or request a transition between Matter-over-Wi-Fi and Matter-over-Thread.

### Callback <a href="#callback" id="callback"></a>

* <mark style="color:red;">`callbackName`</mark>: 32
* Availability: Read requests are available whenever the TCP service is running. Mode changes are accepted only in Matter-over-Wi-Fi or Wi-Fi service mode. TCP is unavailable while the device is operating in Matter-over-Thread mode.

<mark style="color:red;">`callbackArgs`</mark> determines the operation:

| <mark style="color:red;">`callbackArgs`</mark> | Operation                                           |
| ---------------------------------------------- | --------------------------------------------------- |
| Omitted                                        | Read the current Matter transport and runtime mode. |
| `[0]`                                          | Select Matter-over-Wi-Fi.                           |
| `[1]`                                          | Select Matter-over-Thread.                          |

{% hint style="warning" %}
Changing transport can erase the current Matter commissioning state.
{% endhint %}

### Read Current Mode <a href="#read-current-mode" id="read-current-mode"></a>

#### Request <a href="#request" id="request"></a>

* <mark style="color:red;">`packetID`</mark>: Any six-digit packet identifier without leading zeros.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 32

```json
{
  "packetID": 123456,
  "payload": 
  {
    "callbackName": 32
  }
}
```

#### Response <a href="#response" id="response"></a>

* <mark style="color:red;">`sn`</mark>: Device serial number.
* <mark style="color:red;">`packetID`</mark>: Matches the request packet ID.
* <mark style="color:red;">`PUBACK`</mark>: 1 when the mode was read successfully; otherwise 0.
  * <mark style="color:red;">`callbackName`</mark>: 32
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * <mark style="color:red;">`matter_transport`</mark>: Desired Matter transport.
    * <mark style="color:red;">`runtime_mode`</mark>: Current runtime mode.

```json
{
  "sn": "12A3520006E",
  "packetID": 123456,
  "PUBACK": 1,
  "payload": 
  {
    "callbackName": 32,
    "callbackArgs": 
    {
      "matter_transport": 1,
      "runtime_mode": 2
    }
  }
}
```

#### Matter Transport Values <a href="#matter-transport-values" id="matter-transport-values"></a>

| Value | Name               | Description                             |
| ----- | ------------------ | --------------------------------------- |
| `0`   | Matter-over-Wi-Fi  | The desired Matter transport is Wi-Fi.  |
| `1`   | Matter-over-Thread | The desired Matter transport is Thread. |

#### Runtime Mode Values <a href="#runtime-mode-values" id="runtime-mode-values"></a>

| Value | Name               | Description                                                                                    |
| ----- | ------------------ | ---------------------------------------------------------------------------------------------- |
| `0`   | Matter-over-Wi-Fi  | Matter is running over Wi-Fi. Wi-Fi services are available.                                    |
| `1`   | Matter-over-Thread | Matter is running over Thread. Wi-Fi and TCP services are disabled.                            |
| `2`   | Wi-Fi service      | Matter is stopped temporarily while Wi-Fi service, TCP, AWS IoT, and OTA access are available. |
| `3`   | OTA update         | The device is running the Wi-Fi OTA flow and Matter is stopped.                                |

{% hint style="info" %} <mark style="color:red;">`runtime_mode`</mark> is read-only. The firmware derives it from the selected transport, Wi-Fi service state, and OTA state.
{% endhint %}

### Select Matter-over-Wi-Fi <a href="#select-matter-over-wi-fi" id="select-matter-over-wi-fi"></a>

#### Request <a href="#request-1" id="request-1"></a>

Set <mark style="color:red;">`callbackArgs`</mark> to `[0]`:

```json
{
  "packetID": 123457,
  "payload": {
    "callbackName": 32,
    "callbackArgs": [0]
  }
}
```

#### Behavior <a href="#behavior" id="behavior"></a>

* From Matter-over-Wi-Fi: clears Matter pairing and saved Wi-Fi credentials, then reboots into Matter-over-Wi-Fi commissioning.
* From Wi-Fi service: clears the preserved Thread Matter state and saved Wi-Fi credentials, then reboots into Matter-over-Wi-Fi commissioning.
* From OTA mode: rejects the request.
* From Matter-over-Thread: the command cannot be sent because TCP is disabled.

### Select Matter-over-Thread <a href="#select-matter-over-thread" id="select-matter-over-thread"></a>

#### Request <a href="#request-2" id="request-2"></a>

Set <mark style="color:red;">`callbackArgs`</mark> to `[1]`:

```json
{
  "packetID": 123458,
  "payload": {
    "callbackName": 32,
    "callbackArgs": [1]
  }
}
```

#### Behavior <a href="#behavior-1" id="behavior-1"></a>

* From Matter-over-Wi-Fi: clears the current Matter pairing, preserves saved Wi-Fi credentials for future service or OTA use, and reboots into Thread commissioning.
* From Wi-Fi service: preserves the existing Thread fabric and operational dataset, and reboots back into Matter Thread.
* From OTA mode: rejects the request.
* From Matter-over-Thread: the command cannot be sent because TCP is disabled.

### Command Response <a href="#command-response" id="command-response"></a>

The device acknowledges a valid mode-change request before starting the transition:

```json
{
  "sn": "12A3520006E",
  "packetID": 123458,
  "PUBACK": 1
}
```

* <mark style="color:red;">`PUBACK`</mark>: 1 - The transition task was accepted and queued; 0 - The request was malformed, unsupported in the current runtime mode, or another transition is already pending.
* A TCP disconnection shortly after <mark style="color:red;">`PUBACK`</mark> = `1` is expected because the device reboots.
* Do not repeatedly resend the command after receiving <mark style="color:red;">`PUBACK`</mark> = `1`.

### Validation <a href="#validation" id="validation"></a>

For a mode-change request, <mark style="color:red;">`callbackArgs`</mark> must be an array containing exactly one numeric value:

* Valid: `[0]`, `[1]`
* Invalid: `[]`, `[0, 1]`, `[2]`, `["1"]`, `null`

Invalid requests return:

```json
{
  "sn": "12A3520006E",
  "packetID": 123459,
  "PUBACK": 0
}
```

### Recovering TCP Access From Matter-over-Thread <a href="#recovering-tcp-access-from-matter-thread" id="recovering-tcp-access-from-matter-thread"></a>

TCP is unavailable in Matter-over-Thread mode because Wi-Fi is disabled. Hold the device button for at least 30 seconds and release it to enter Wi-Fi service mode. After Wi-Fi reconnects, read callback `32` again. The expected response is:

```json
{
  "matter_transport": 1,
  "runtime_mode": 2
}
```

From Wi-Fi service mode:

* Send `[1]` to return to the preserved Matter Thread commissioning.
* Send `[0]` to erase the Thread Matter state and begin Matter-over-Wi-Fi commissioning.


# Matter Mode Switching (Button)

\[Button <--> InvisOutlet]

> Use the outlet's physical button to reset Matter, perform a full factory erase, or temporarily switch a Thread device between Matter-over-Thread and Wi-Fi service mode.

### Hold-Time Summary

The firmware measures the total hold time and selects one action when the button is released.

|         Release time | LED while holding                       | Action                                                                             |
| -------------------: | --------------------------------------- | ---------------------------------------------------------------------------------- |
|  Less than 5 seconds | Normal device indication                | No long-press reset or mode action.                                                |
|   5 to 9.999 seconds | Fast blink                              | Reset Matter and return to Matter-over-Wi-Fi commissioning.                        |
| 10 to 29.999 seconds | Slow pulse                              | Perform a full factory erase and return to the out-of-box Matter-over-Wi-Fi state. |
|  At least 30 seconds | Three rapid flashes followed by a pause | Toggle a Thread device between Matter-over-Thread and Wi-Fi service mode.          |

{% hint style="warning" %}
The action is determined when the button is released. Releasing between 10 and 30 seconds performs the full erase. Continue holding until the three-flash mode-switch pattern appears if the intended action is Wi-Fi service mode.
{% endhint %}

### LED Threshold Indicators

#### 5 Seconds: Fast Blink

At 5 seconds, the status LED starts blinking rapidly. Release before 10 seconds to reset Matter and return to Matter-over-Wi-Fi commissioning.

The blink uses approximately 200 ms on and 200 ms off intervals.

#### 10 Seconds: Slow Pulse

At 10 seconds, the status LED changes to a slow breathing pulse. Release before 30 seconds to run the full factory erase.

The LED fades up and down over approximately 1.5 seconds in each direction.

#### 30 Seconds: Mode-Switch Pattern

At 30 seconds, the status LED changes to a repeating mode-switch pattern:

* Three rapid flashes.
* Approximately 120 ms on and 120 ms off per flash.
* Approximately 700 ms pause before repeating.

Release while this pattern is active to enter or exit Wi-Fi service mode when the desired Matter transport is Thread.

### Button State Transitions

| Current runtime mode | Hold 5 to 9.999 seconds               | Hold 10 to 29.999 seconds                  | Hold at least 30 seconds              |
| -------------------- | ------------------------------------- | ------------------------------------------ | ------------------------------------- |
| Matter Wi-Fi         | Reset to Matter Wi-Fi commissioning   | Full erase to factory-default Matter Wi-Fi | Ignored for mode switching            |
| Matter Thread        | Reset to Matter Wi-Fi commissioning   | Full erase to factory-default Matter Wi-Fi | Enter Wi-Fi service mode              |
| Wi-Fi service        | Reset to Matter Wi-Fi commissioning   | Full erase to factory-default Matter Wi-Fi | Return to Matter Thread               |
| OTA update           | Uses the separate OTA button behavior | Uses the separate OTA button behavior      | Uses the separate OTA button behavior |

### Return An Uncommissioned Thread Device To Wi-Fi

Use this procedure when the device is running Matter-over-Thread but Thread commissioning has not completed:

1. Press and hold the device button.
2. Wait for the fast-blink indication at 5 seconds.
3. Release the button before the slow pulse begins at 10 seconds.
4. Wait for the device to reboot.
5. Commission the device using Matter-over-Wi-Fi.

This action sets the desired Matter transport to Wi-Fi, clears Matter commissioning state, clears saved Wi-Fi station credentials, and opens a clean Matter-over-Wi-Fi commissioning path.

### Temporarily Enable Wi-Fi For A Thread Device

Use Wi-Fi service mode when a Thread-commissioned device needs TCP app access, AWS IoT access, or OTA service without deleting its Thread pairing:

1. Press and hold the button while the device is in Matter Thread mode.
2. Continue holding through the 5-second fast blink and 10-second slow pulse.
3. At 30 seconds, wait for the three-flash mode-switch pattern.
4. Release the button.
5. The device persists Wi-Fi service mode and reboots.

After reboot:

* The desired Matter transport remains Thread.
* Matter and OpenThread do not start.
* Wi-Fi connects using previously saved station credentials.
* TCP, AWS IoT, OTA, and Wi-Fi service discovery can run.
* The Thread fabric and operational dataset remain stored.

{% hint style="info" %}
Wi-Fi service mode requires usable saved Wi-Fi credentials. If the device has no saved Wi-Fi credentials, use the 5-to-9.999-second reset to return directly to Matter-over-Wi-Fi commissioning.
{% endhint %}

### Return From Wi-Fi Service To Thread

To return to the preserved Matter-over-Thread network without recommissioning:

1. Press and hold the button while the device is in Wi-Fi service mode.
2. Continue holding until the three-flash pattern begins at 30 seconds.
3. Release the button.
4. The device clears only the Wi-Fi service flag and reboots into Matter Thread mode.

The Thread fabric and operational dataset are not erased.

### Permanently Return From Thread To Matter Wi-Fi

From either Matter Thread or Wi-Fi service mode:

1. Hold the button for at least 5 seconds.
2. Release it before 10 seconds.
3. The device resets Matter and reboots into Matter-over-Wi-Fi commissioning.

This is a reset, not a temporary service transition. Existing Thread commissioning is erased and must be recreated if the device later returns to Matter-over-Thread.

The same transition can be requested through TCP callback `32` with `callbackArgs: [0]` while TCP is available.

### Switch From Matter Wi-Fi To Thread

The 30-second button action does not switch a Matter-over-Wi-Fi device to Thread. If the desired Matter transport is Wi-Fi, the mode-switch action is ignored.

Switching from Matter Wi-Fi to Thread must be requested by the app through TCP callback `32`:

```json
{
  "packetID": 123456,
  "payload": {
    "callbackName": 32,
    "callbackArgs": [1]
  }
}
```

This intentionally clears the current Matter-over-Wi-Fi commissioning state and reboots into Matter-over-Thread commissioning.

### Data Preservation

| Action                            | Desired transport after reboot | Matter fabric and dataset | Saved Wi-Fi credentials | Product settings and preferences | AWS certificate and key |
| --------------------------------- | ------------------------------ | ------------------------- | ----------------------- | -------------------------------- | ----------------------- |
| Release at 5 to 9.999 seconds     | Wi-Fi                          | Erased                    | Erased                  | Preserved                        | Preserved               |
| Release at 10 to 29.999 seconds   | Wi-Fi                          | Erased                    | Erased                  | Erased                           | Erased                  |
| 30-second Thread to Wi-Fi service | Thread                         | Preserved                 | Preserved               | Preserved                        | Preserved               |
| 30-second Wi-Fi service to Thread | Thread                         | Preserved                 | Preserved               | Preserved                        | Preserved               |
| 30-second action in Matter Wi-Fi  | Wi-Fi                          | Unchanged                 | Unchanged               | Unchanged                        | Unchanged               |

### Full Factory Erase

Releasing the button from 10 seconds through 29.999 seconds runs the destructive full-reset path:

* Erases system product NVS.
* Erases the AWS certificate/key NVS partition.
* Erases Matter commissioning and network state.
* Returns the desired Matter transport to the factory default, Matter-over-Wi-Fi.

{% hint style="danger" %}
The full erase cannot preserve Thread pairing, AWS fleet-provisioned credentials, or accessory, PM, and OTA fields stored in the IM system NVS. PM-controller storage outside the IM is governed by the PM firmware's own reset behavior.
{% endhint %}

### Normal Click Behavior

Outside OTA update mode:

| Button input | Behavior                                                                                      |
| ------------ | --------------------------------------------------------------------------------------------- |
| Single click | Toggle the controllable outlet.                                                               |
| Double click | Request a PM restart, blink the status LED, wait approximately 3 seconds, and restart the IM. |

### OTA Update Button Behavior

OTA update mode installs a separate button handler. The normal 5-second, 10-second, and 30-second mode-switch ranges are not active in this runtime mode.

| Button input during OTA          | Behavior                                                                                 |
| -------------------------------- | ---------------------------------------------------------------------------------------- |
| Single click                     | Toggle the outlet and its status indication.                                             |
| Double click                     | Cancel the IM OTA request, show a slow blink, persist the cleared OTA state, and reboot. |
| Hold for approximately 5 seconds | Erase system NVS and restart.                                                            |

Mode changes should normally be performed after OTA exits.

### Quick Reference

| Goal                                                      | Button procedure                                           |
| --------------------------------------------------------- | ---------------------------------------------------------- |
| Reset to Matter-over-Wi-Fi pairing                        | Hold 5 seconds and release before 10 seconds.              |
| Completely erase the device                               | Hold 10 seconds and release before 30 seconds.             |
| Give a Thread device temporary Wi-Fi service access       | Hold at least 30 seconds and release.                      |
| Return from Wi-Fi service to the preserved Thread network | Hold at least 30 seconds and release.                      |
| Switch Matter Wi-Fi to Matter Thread                      | Not available by button; use TCP callback `32` with `[1]`. |


# InvisDeco


# Restart InvisDeco

\[TCP <--> InvisOutlet]

> Perform a restart of the InvisDeco 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>: 24

```json
{
  "packetID": 221054,
  "payload":
  {
    "callbackName": 24
  }
}
```

**Response**

The InvisDeco device will blink for 3 seconds and reboot.

* <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> : 1 - The request is received and will be processed.

```json
{
  "sn": "12A3520006E",
  "packetID": 221054,
  "PUBACK": 1
}
```

{% hint style="info" %}
If your occupancy sensor appears to be stuck, please try to remove the InvisDeco to perform a hard power reset. This API request does not restart the occupancy sensor itself.
{% endhint %}


# Reset InvisDeco

\[TCP <--> InvisOutlet]

> Perform a reset of the InvisDeco device.
>
> This will clear all air quality calibration data.

**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>: 25

```json
{
  "packetID": 221055,
  "payload":
  {
    "callbackName": 25
  }
}
```

**Response**

The InvisDeco device will blink for 3 seconds and reboot.

* <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> : 1 - The request is received and will be processed.

```json
{
  "sn": "12A3520006E",
  "packetID": 221055,
  "PUBACK": 1
}
```

{% hint style="info" %}
If your air quality index (and related) metrics are not accurate, or the InvisDeco has been switched from one place to another, please perform this action ([Reset InvisDeco](/invisoutlet-pro/device-management/invisdeco/reset-invisdeco)) to clear and start calibration from fresh.
{% endhint %}


# Occupancy Sensor Calibration

\[TCP <--> InvisOutlet]

> This request performs the background noise detection of the occupancy sensor.

{% hint style="info" %}
If you believe your occupancy sensor is not accurate for your area, please perform this API request.

Before you start, please make sure no one is in the area that InvisOutlet and InvisDeco are installed at. Once the request is sent, the occupancy sensor will start doing background noise detection in 10 seconds, and perform the calibration based on the time you provided in  the request.

*Note: We recommend the detection time to be at least 30 seconds and maximum 60 seconds.*
{% endhint %}

**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>: 26
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * `0`: Specifies the calibration duration, 30 seconds is recommended

```json
{
  "packetID": 221056,
  "payload":
  {
    "callbackName": 26,
    "callbackArgs": [30]
  }
}
```

**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> : 1 - The request is received and calibration will begin in 10 seconds. 0 - Timeout to request occupancy sensor to perform calibration. Please try to restart InvisDeco and try again.

```json
{
  "sn": "12A3520006E",
  "packetID": 221056,
  "PUBACK": 1
}
```

{% hint style="info" %}
The status of the occupancy calibration can be checked by the [Synchronous Updates - Sensors](/invisoutlet-pro/synchronous-updates/sensors) response, <mark style="color:red;">`occupancy_state`</mark> is 4/5/6.&#x20;
{% endhint %}


# Temperature and Relative Humidity Calibration

\[TCP <--> InvisOutlet]

> This request calibrates the temperature and relative humidity of the InvisDeco.

{% hint style="info" %}
If you believe your temperature and humidity sensor is not accurate for your area, please perform this API request.

Please make sure no appliances or adapters are plugged into the InvisOutlet for 30 minutes before the calibration.

*Note: This calibration cannot compensate heat generated from plugged-in devices into the receptacle of the InvisOutlet.*
{% endhint %}

**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>: 28
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * `0`: The actual temperature in the area in Celsius in millis. For example: 25ºC would be 25000.
    * `1`: The actual relative humidity in the area in percentage in millis. For example: 50% would be 50000.

```json
{
  "packetID": 221057,
  "payload":
  {
    "callbackName": 28,
    "callbackArgs": [25000, 50000]
  }
}
```

**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> : 1 - The request is received and calibration has been processed successfully. 0 - Timeout to request occupancy sensor to perform calibration. Please try to restart InvisDeco and try again.

```json
{
  "sn": "12A3520006E",
  "packetID": 221057,
  "PUBACK": 1
}
```

{% hint style="info" %}
In order to provide the most accurate AQI measurements, the InvisDeco will reset and restart in order to apply the updated temperature and humidity calibration.
{% endhint %}


# API Reference

{% content-ref url="/pages/hzdGrhYrRmPvzHYMATPG" %}
[Terminology](/invisoutlet-pro/api-reference/terminology)
{% endcontent-ref %}


# Terminology

`callbackName` is used to define the callback function, as follow:

* Request Device Configuration = 1
* Configure Device Configuration = 2
* Request Accessory Names = 3
* Configure Accessory Names = 4
* Restart InvisOutlet = 5
* Reset InvisOutlet's Network Settings = 6
* Reset InvisOutlet to Factory Defaults = 7
* Fetch Outlet Status = 9
* Outlet Control = 10
* Fetch Sensor Data = 11
* Request Device Information = 12
* Nightlight Control = 14
* Fetch Nightlight Status = 15
* Request Available Updates = 20
* Perform OTA Update = 21
* OTA Download Progress Update = 22
* OTA Result Update = 23
* Restart InvisDeco = 24
* Reset InvisDeco = 25
* Occupancy Sensor Calibration = 26


# Getting Started

Establishing Connections

{% hint style="info" %}
TCP connection can be established via Command Prompt or Terminal, depending on the operating system.
{% endhint %}

Establishing connection in Windows:

```sh
netcat {{aabbccddeeff.local}} 3333
```

Establishing connection in macOS or Linux:

```bash
nc {{aabbccddeeff.local}} 3333
```


# Information and Preferences

{% content-ref url="/pages/ieTvEue0FCtXNFRymvvZ" %}
[Get Device Information](/invisoutlet-aura/information-and-preferences/get-device-information)
{% endcontent-ref %}

{% content-ref url="/pages/kItBrBXlF486M6NVbRcf" %}
[Request Device Configuration](/invisoutlet-aura/information-and-preferences/request-device-configuration)
{% endcontent-ref %}

{% content-ref url="/pages/ipLtZ1QSzulxUwGRobeD" %}
[Configure Device Configuration](/invisoutlet-aura/information-and-preferences/configure-device-configuration)
{% endcontent-ref %}

{% content-ref url="/pages/5OTzW4iGQGjnNcRnJ6Gu" %}
[Request Accessory Names](/invisoutlet-aura/information-and-preferences/request-accessory-names)
{% endcontent-ref %}

{% content-ref url="/pages/tMiwXaO2sjKMfpUmalu2" %}
[Configure Accessory Names](/invisoutlet-aura/information-and-preferences/configure-accessory-names)
{% endcontent-ref %}


# Get Device Information

\[TCP/WebSocket -> InvisOutlet]

> Request and retrieve detailed device information for both InvisOutlet and InvisDeco.

**Request**

* <mark style="color:red;">`packetID`</mark>: A randomly generated six-digit number.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 12

```json
{
    "packetID": 373184,    
    "payload":
    {
        "callbackName": 12,  
    }
}
```

**Response**

* <mark style="color:red;">`sn`</mark>: The serial number of the device.
* <mark style="color:red;">`packetID`</mark>: A randomly generated six-digit number.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 12
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * <mark style="color:red;">`IM`</mark>:
      * <mark style="color:red;">`sn`</mark>: Serial number
      * <mark style="color:red;">`MAC`</mark>: MAC address
      * <mark style="color:red;">`device`</mark>: Name of the device role
      * <mark style="color:red;">`hw_rev`</mark>: Hardware version of the InvisOutlet
      * <mark style="color:red;">`fw_rev`</mark>: Firmware version of the InvisOutlet
    * <mark style="color:red;">`PM`</mark>:
      * <mark style="color:red;">`online`</mark>: The status of whether the InvisDeco is connected to InvisOutlet
      * <mark style="color:red;">`sn`</mark>: Serial number
      * <mark style="color:red;">`MAC`</mark>: MAC address
      * <mark style="color:red;">`device`</mark>: Name of the device role
      * <mark style="color:red;">`type`</mark>: Name of the device type
      * <mark style="color:red;">`hw_rev`</mark>: Hardware version of the InvisDeco
      * <mark style="color:red;">`fw_rev`</mark>: Firmware version of the InvisDeco

```json
{
    "sn": "11B29200071",
    "packetID": 373184,
    "PUBACK": 1,
    "payload": {
        "callbackName": 12,
        "callbackArgs": {
            "IM": {
                "sn": "11B29200071",
                "MAC": "30EDA08006A0",
                "device": "InvisOutlet",
                "hw_rev": "revB",
                "fw_rev": "0.0.1"
            },
            "PM": {
                "online": true,
                "sn": "21A22100035",
                "MAC": "D8BC3830CD38",
                "device": "InvisDeco",
                "type": "Aura",
                "hw_rev": "revA",
                "fw_rev": "0.0.2"
            }
        }
    }
}
```


# Request Device Configuration

\[TCP/WebSocket <--> InvisOutlet]

> Returns a list of configuration preferences of the device.

**Request**

* <mark style="color:red;">`packetID`</mark> : A random six-digit ID for this packet.
* <mark style="color:red;">`payload`</mark> :&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 1

```json
{
    "packetID": 819796,
    "payload":
    {
        "callbackName": 1
    }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 1
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * <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;">`aqiColorRGBFeature`</mark>: Enable/disable InvisDeco's RGB indicator light to indicator AQI color code; 1 - On, 0 - Off.
      * <mark style="color:red;">`motionAwayFeature`</mark>: Enable/disable InvisDeco's Security Alert feature; 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>: Enable this setting to override <mark style="color:red;">`adaptiveNightlightFeature`</mark>  and <mark style="color:red;">`occupancyNightlightFeature`</mark> if either one is enabled. If enabled, <mark style="color:red;">`adaptiveNightlightFeature`</mark>  and <mark style="color:red;">`occupancyNightlightFeature`</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
{
    "sn": "11B29200071",
    "packetID": 819796,
    "PUBACK": 1,
    "payload": {
        "callbackName": 1,
        "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
                },
                "internet": {
                    "ip": 2835523776,
                    "mainDNS": 16843009,
                    "backupDNS": 16777217
                }
            }
        }
    }
}
```

<details>

<summary>Special Features Description</summary>

* Security Alert: If any motion is detected, all InvisDeco indicators and nightlight will flash at maximum brightness, until no motion is detected.
* 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.
* Occupancy Nightlight: The nightlight will automatically be turned on when occupancy is detected. <mark style="color:red;">`adaptiveNightlightFeature`</mark> and <mark style="color:red;">`occupancyNightlightFeature`</mark> can be activated at the same time. When <mark style="color:red;">`adaptiveNightlightFeature`</mark> is not activated, the nightlight will be turned on based on previously set brightness, when <mark style="color:red;">`adaptiveNightlightFeature`</mark> is activated, then it will follow *Adaptive Nightlight*'s settings to turn on/off the nightlight.
* 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>


# Configure Device Configuration

\[TCP/WebSocket <--> InvisOutlet]

> 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;


# Request Accessory Names

\[TCP/WebSocket -> InvisOutlet]

> Request and retrieve accessory names from 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>: 3

```json
{
    "packetID": 180072,
    "payload":
    {
        "callbackName": 3   
    }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark>: 3
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * <mark style="color:red;">`accessory`</mark>: 1 - Outlet 1 (Top), 2 - Outlet 2 (Bottom), 3 - Nightlight (if InvisDeco is installed).
    * <mark style="color:red;">`name`</mark>: The corresponding names for the <mark style="color:red;">`accessory`</mark>.

```json
{
    "sn": "11B29200071",
    "packetID": 180072,
    "PUBACK": 1,
    "payload": {
        "callbackName": 3,
        "callbackArgs": {
            "payload": [
                {
                    "accessory": 1,
                    "name": "Outlet 1"
                },
                {
                    "accessory": 2,
                    "name": "Outlet 2"
                },
                {
                    "accessory": 3,
                    "name": "Nightlight"
                }
            ]
        }
    }
}
```


# Configure Accessory Names

\[TCP/WebSocket -> InvisOutlet]

> Configure and set accessory names for 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> : 4
  * <mark style="color:red;">`callbackArgs`</mark> :
    * <mark style="color:red;">`accessory`</mark>: 1 - Outlet 1 (Top), 2 - Outlet 2 (Bottom), 3 - Nightlight (if InvisDeco is installed).
    * <mark style="color:red;">`name`</mark>: The corresponding names for the <mark style="color:red;">`accessory`</mark>.

```json
{
    "packetID": 950302,
    "payload":
    {
        "callbackName": 4,  
        "callbackArgs":
        [
            {
                "accessory": 1,    
                "name": "Fan"
            },
            {
                "accessory": 2,    
                "name": "Charger"
            },
            {
                "accessory": 3,     
                "name": "Nightlight"
            }
        ]
    }
}
```

**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": 950302,
    "PUBACK": 1
}
```


# Accessory Controls

{% content-ref url="/pages/3YR8vxCvGPwpzkjbsybr" %}
[Outlets](/invisoutlet-aura/accessory-controls/outlets)
{% endcontent-ref %}

{% content-ref url="/pages/53UnU1D5bQmCM46cNNcX" %}
[Color Light - Static - HSV](/invisoutlet-aura/accessory-controls/color-light-static-hsv)
{% endcontent-ref %}

{% content-ref url="/pages/e8vEBEf5lwKXvDv3Gcc6" %}
[Color Light - Static - Temperature](/invisoutlet-aura/accessory-controls/color-light-static-temperature)
{% endcontent-ref %}


# Outlets

\[TCP/WebSocket <--> InvisOutlet]

> Control InvisOutlet's outlet 1 or outlet 2.

**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> : 10
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: 1 - Outlet 1 (Top), 2 - Outlet 2 (Bottom).
    * `2`: 1 - On, 0 - Off.

```json
{
    "packetID": 684761,
    "payload": {
        "callbackName": 10,
        "callbackArgs": [
            1,
            1
        ]
    }
}
```

#### 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": "0003C44076",
    "packetID": 684761,
    "PUBACK": 1
}
```


# Color Light - Static - HSV

\[TCP/WebSocket -> InvisOutlet]

> Control InvisDeco Aura's color lights on/off and color based on HSV.

**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> : 17
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: The color light selection; 5 - Nightlight, 7 - Indicator.
    * `2`: The effect selection; 1 - Static HSV, 2 - Static Temperature, 3 - Breathing, 4 - Strobing, 5 - Color Cycle, 6 - Rainbow, 7 - Starry Night.
    * `3`: The array that defines each LED's state and color; 9 arrays for nightlight, 7 arrays for indicator.
      * `1`: State of the LED; 1 - On, 0 - Off.
      * `2`: Brightness of the LED; 0-100.
      * `3`: Hue and saturation in an array.
        * `1`: Hue of the LED; 0-360.
        * `2`: Saturation of the LED; 0-100.

```json
{
    "packetID": 164423,
    "payload":
    {
        "callbackName": 17,
        "callbackArgs": [
            5,
            1,
            [
                [1, 100, [360, 100]],
                [1, 100, [360, 100]],
                [1, 100, [360, 100]],
                [1, 100, [360, 100]],
                [1, 100, [360, 100]],
                [1, 100, [360, 100]],
                [1, 100, [360, 100]],
                [1, 100, [360, 100]],
                [1, 100, [360, 100]]
            ]
        ]          
    }
}
```

#### 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": "0003C44076",
    "packetID": 164423,
    "PUBACK": 1
}
```


# Color Light - Static - Temperature

\[TCP/WebSocket -> InvisOutlet]

> Control InvisDeco Aura's color lights on/off and color based on temperature.

**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> : 17
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: The color light selection; 5 - Nightlight, 7 - Indicator.
    * `2`: The effect selection; 1 - Static HSV, 2 - Static Temperature, 3 - Breathing, 4 - Strobing, 5 - Color Cycle, 6 - Rainbow, 7 - Starry Night.
    * `3`: The array that defines each LED's state and color; 9 arrays for nightlight, 7 arrays for indicator.
      * `1`: State of the LED; 1 - On, 0 - Off.
      * `2`: Brightness of the LED; 0-100.
      * `3`: Temperature of the LED; 1000-40000.

```json
{
    "packetID": 164423,
    "payload":
    {
        "callbackName": 17,
        "callbackArgs": [
            5,
            2,
            [
                [1, 100, 4000],
                [1, 100, 4000],
                [1, 100, 4000],
                [1, 100, 4000],
                [1, 100, 4000],
                [1, 100, 4000],
                [1, 100, 4000],
                [1, 100, 4000],
                [1, 100, 4000]
            ]
        ]          
    }
}
```

#### 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": "0003C44076",
    "packetID": 164423,
    "PUBACK": 1
}
```


# Color Light - Breathing

\[TCP/WebSocket -> InvisOutlet]

> Control InvisDeco Aura's color lights with breathing effect based on HSV.

**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> : 17
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: The color light selection; 5 - Nightlight, 7 - Indicator.
    * `2`: The effect selection; 1 - Static HSV, 2 - Static Temperature, 3 - Breathing, 4 - Strobing, 5 - Color Cycle, 6 - Rainbow, 7 - Starry Night.
    * `3`: The array that defines the colors that will shift between breathing cycles; at least 1 color is required, max 9 colors.
      * `1`: State of the LED; 1 - On.
      * `2`: Brightness of the LED; 0-100.
      * `3`: Hue and saturation in an array.
        * `1`: Hue of the LED; 0-360.
        * `2`: Saturation of the LED; 0-100.
    * `4`: The speed of the breathing cycle; 0-7.
    * `5`: If the color will be randomly picked instead of the defined color array in `3` ; 1 - True, 0 - False. When *True*, the defined color array will be ignored.
    * `6`: The brightness of the light when color is randomly picked; 0-100.

```json
{
    "packetID": 164423,
    "payload":
    {
        "callbackName": 17,
        "callbackArgs": [
            5,
            3,
            [
                [1, 100, [0, 100]],
                [1, 100, [320, 100]],
                [1, 100, [280, 100]],
                [1, 100, [240, 100]],
                [1, 100, [200, 100]],
                [1, 100, [160, 100]],
                [1, 100, [120, 100]],
                [1, 100, [80, 100]],
                [1, 100, [40, 100]]
            ],
            0,
            0,
            50
        ]          
    }
}
```

#### 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": "0003C44076",
    "packetID": 164423,
    "PUBACK": 1
}
```


# Color Light - Strobing

\[TCP/WebSocket -> InvisOutlet]

> Control InvisDeco Aura's color lights with strobing effect based on HSV.

**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> : 17
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: The color light selection; 5 - Nightlight, 7 - Indicator.
    * `2`: The effect selection; 1 - Static HSV, 2 - Static Temperature, 3 - Breathing, 4 - Strobing, 5 - Color Cycle, 6 - Rainbow, 7 - Starry Night.
    * `3`: The array that defines the colors that will shift between strobing cycles; at least 1 color is required, max 9 colors.
      * `1`: State of the LED; 1 - On, 0 - Off.
      * `2`: Brightness of the LED; 0-100.
      * `3`: Hue and saturation in an array.
        * `1`: Hue of the LED; 0-360.
        * `2`: Saturation of the LED; 0-100.
    * `4`: The speed of the breathing cycle; 0-7.
    * `5`: If the color will be randomly picked instead of the defined color array in `3` ; 1 - True, 0 - False. When *True*, the defined color array will be ignored.
    * `6`: The brightness of the light when color is randomly picked; 0-100.

```json
{
    "packetID": 164423,
    "payload":
    {
        "callbackName": 17,
        "callbackArgs": [
            5,
            4,
            [
                [1, 100, [0, 100]],
                [1, 100, [320, 100]],
                [1, 100, [280, 100]],
                [1, 100, [240, 100]],
                [1, 100, [200, 100]],
                [1, 100, [160, 100]],
                [1, 100, [120, 100]],
                [1, 100, [80, 100]],
                [1, 100, [40, 100]]
            ],
            0,
            0,
            50
        ]          
    }
}
```

#### 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": "0003C44076",
    "packetID": 164423,
    "PUBACK": 1
}
```


# Color Light - Color Cycle

\[TCP/WebSocket -> InvisOutlet]

> Control InvisDeco Aura's color lights with color cycle effect based on HSV.

**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> : 17
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: The color light selection; 5 - Nightlight, 7 - Indicator.
    * `2`: The effect selection; 1 - Static HSV, 2 - Static Temperature, 3 - Breathing, 4 - Strobing, 5 - Color Cycle, 6 - Rainbow, 7 - Starry Night.
    * `3`: The array that defines the colors that will shift between color cycles; at least 2 color is required, max 9 colors.
      * `1`: State of the LED; 1 - On, 0 - Off.
      * `2`: Brightness of the LED; 0-100.
      * `3`: Hue and saturation in an array.
        * `1`: Hue of the LED; 0-360.
        * `2`: Saturation of the LED; 0-100.
    * `4`: The speed of the breathing cycle; 0-7.
    * `5`: If the color will be rainbow cycling instead of the defined color array in `3` ; 1 - True, 0 - False. When *True*, the defined color array will be ignored.
    * `6`: The brightness of the light when color is randomly picked; 0-100.

```json
{
    "packetID": 164423,
    "payload":
    {
        "callbackName": 17,
        "callbackArgs": [
            5,
            5,
            [
                [1, 100, [0, 100]],
                [1, 100, [320, 100]],
                [1, 100, [280, 100]],
                [1, 100, [240, 100]],
                [1, 100, [200, 100]],
                [1, 100, [160, 100]],
                [1, 100, [120, 100]],
                [1, 100, [80, 100]],
                [1, 100, [40, 100]]
            ],
            0,
            0,
            50
        ]          
    }
}
```

#### 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": "0003C44076",
    "packetID": 164423,
    "PUBACK": 1
}
```


# Color Light - Rainbow

\[TCP/WebSocket -> InvisOutlet]

> Control InvisDeco Aura's color lights with rainbow effect based on HSV.

**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> : 17
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: The color light selection; 5 - Nightlight, 7 - Indicator.
    * `2`: The effect selection; 1 - Static HSV, 2 - Static Temperature, 3 - Breathing, 4 - Strobing, 5 - Color Cycle, 6 - Rainbow, 7 - Starry Night.
    * `3`: The array that defines the colors that will shift between rainbow cycles; 7 colors are required for Indicator, 9 colors are required for Nightlight.
      * `1`: State of the LED; 1 - On, 0 - Off.
      * `2`: Brightness of the LED; 0-100.
      * `3`: Hue and saturation in an array.
        * `1`: Hue of the LED; 0-360.
        * `2`: Saturation of the LED; 0-100.
    * `4`: The speed of the breathing cycle; 0-7.
    * `5`: If the color will be rainbow cycling instead of the defined color array in `3` ; 1 - True, 0 - False. When *True*, the defined color array will be ignored.
    * `6`: The brightness of the light when color is randomly picked; 0-100.

```json
{
    "packetID": 164423,
    "payload":
    {
        "callbackName": 17,
        "callbackArgs": [
            5,
            6,
            [
                [1, 100, [0, 100]],
                [1, 100, [320, 100]],
                [1, 100, [280, 100]],
                [1, 100, [240, 100]],
                [1, 100, [200, 100]],
                [1, 100, [160, 100]],
                [1, 100, [120, 100]],
                [1, 100, [80, 100]],
                [1, 100, [40, 100]]
            ],
            0,
            1,
            50
        ]          
    }
}
```

#### 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": "0003C44076",
    "packetID": 164423,
    "PUBACK": 1
}
```


# Color Light - Starry Night

\[TCP/WebSocket -> InvisOutlet]

> Control InvisDeco Aura's color lights with starry night effect based on HSV.

**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> : 17
  * <mark style="color:red;">`callbackArgs`</mark> :
    * `1`: The color light selection; 5 - Nightlight, 7 - Indicator.
    * `2`: The effect selection; 1 - Static HSV, 2 - Static Temperature, 3 - Breathing, 4 - Strobing, 5 - Color Cycle, 6 - Rainbow, 7 - Starry Night.
    * `3`: The array that defines the colors that will shift between starry night cycles; 1st color is background color, 2nd color is the starry color.
      * `1`: State of the LED; 1 - On, 0 - Off.
      * `2`: Brightness of the LED; 0-100.
      * `3`: Hue and saturation in an array.
        * `1`: Hue of the LED; 0-360.
        * `2`: Saturation of the LED; 0-100.
    * `4`: The speed of the breathing cycle; 0-7.
    * `5`: If the background and starry color will be randomly picked instead of the defined color array in `3` ; 1 - True, 0 - False. When *True*, the defined color array will be ignored.
    * `6`: The brightness of the light when color is randomly picked; 0-100.

```json
{
    "packetID": 164423,
    "payload":
    {
        "callbackName": 17,
        "callbackArgs": [
            5,
            7,
            [
                [1, 100, [0, 0]],
                [1, 100, [320, 100]]
            ],
            0,
            0
        ]          
    }
}
```

#### 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": "0003C44076",
    "packetID": 164423,
    "PUBACK": 1
}
```


# Fetch Accessory Status

{% content-ref url="/pages/k4S0yk5mM5dlVdIHrUuO" %}
[Outlets](/invisoutlet-aura/fetch-accessory-status/outlets)
{% endcontent-ref %}

{% content-ref url="/pages/oEYOn7JhZDnostp05WTr" %}
[Color Light](/invisoutlet-aura/fetch-accessory-status/color-light)
{% endcontent-ref %}

{% content-ref url="/pages/OuNHUQQLs5U80NSesIG9" %}
[Sensors](/invisoutlet-aura/fetch-accessory-status/sensors)
{% endcontent-ref %}


# Outlets

\[TCP/WebSocket -> InvisOutlet]

> Fetch InvisOutlet's latest outlets status.

**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>: 9

```json
{
    "packetID": 369953,
    "payload":
    {
        "callbackName": 9
    }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 9
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Whether the Outlet 1 power is on or off; 1 - On, 0 - Off.
    * `2` : Whether the Outlet 2 power is on or off; 1 - On, 0 - Off.

```json
{
    "sn": "0003C44076",
    "packetID": 369953,
    "PUBACK": 1,
    "payload": {
        "callbackName": 9,
        "callbackArgs": [
            1,
            0
        ]
    }
}
```


# Color Light

\[TCP/WebSocket -> InvisOutlet]

> Fetch InvisDeco Aura's latest color lights statuses.

**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>: 18
  * <mark style="color:red;">`callbackArgs`</mark>:&#x20;
    * `1`: The color light selection; 5 - Nightlight, 7 -Indicator.

```json
{
    "packetID": 349027,
    "payload":
    {
        "callbackName": 18,
        "callbackArgs": [
            5
        ]
    }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 18
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : The color light selection; 5 - Nightlight, 7 - Indicator.
    * `2`: The color adjustment selection; 1 - HSV, 2 - Temperature.
    * `3`: The array that defines each LED's state and color; 9 arrays for nightlight, 7 arrays for indicator.
      * `1`: State of the LED; 1 - On, 0 - Off.
      * `2`: Brightness of the LED; 0-100.
      * `3`: Hue and saturation in an array.
        * `1`: Hue of the LED; 0-360.
        * `2`: Saturation of the LED; 0-100.
      * `4`: Temperature of the LED; 1000-40000.

{% hint style="info" %}
Note: Hue/Saturation or temperature value may not reflect the current status, depending on if the last control was based on hue/saturation or temperature, and can be known by index `2` (color adjustment selection).
{% endhint %}

```json
{
    "sn": "0003C44076",
    "packetID": 349027,
    "PUBACK": 1,
    "payload": {
        "callbackName": 18,
        "callbackArgs": [
            5,
            2,
            [
                [1, 100, [360, 100], 4000],
                [1, 100, [360, 100], 4000],
                [1, 100, [360, 100], 4000],
                [1, 100, [360, 100], 4000],
                [1, 100, [360, 100], 4000],
                [1, 100, [360, 100], 4000],
                [1, 100, [360, 100], 4000],
                [1, 100, [360, 100], 4000],
                [1, 100, [360, 100], 4000]
            ]
        ]
    }
}
```


# Sensors

\[TCP/WebSocket -> InvisOutlet]

> Fetch InvisDeco Aura's latest sensor readings.

**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>: 11

```json
{
    "packetID": 371939,
    "payload":
    {
        "callbackName": 11
    }
}
```

#### 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.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 11
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : The InvisDeco device type; reserved for internal use.
    * `2` :&#x20;
      * <mark style="color:red;">`lux_valid`</mark>: A flag indicating the ambient brightness sensor validity of the sensor; 1 - valid, 0 - invalid.
      * <mark style="color:red;">`lux`</mark>: Ambient brightness level in LUX.

```json
{
    "sn": "11B29200071",
    "packetID": 371939,
    "PUBACK": 1,
    "payload": {
        "callbackName": 11,
        "callbackArgs": [
            1,
            {
                "lux_valid": 1,
                "lux": "3489.80"
            }
        ]
    }
}
```


# Synchronous Updates

The device will send synchronous updates when the TCP/WebSocket connection is established. This section describes all the synchronous updates that will be sent from InvisOutlet.

{% content-ref url="/pages/qCVPacBE2bQQ6r59HQU1" %}
[Outlets](/invisoutlet-aura/synchronous-updates/outlets)
{% endcontent-ref %}

{% content-ref url="/pages/DZo5NnYphKhRckfiXpRp" %}
[Color Light](/invisoutlet-aura/synchronous-updates/color-light)
{% endcontent-ref %}

{% content-ref url="/pages/eAsmC4RSKSoxCwxshGpw" %}
[Sensors](/invisoutlet-aura/synchronous-updates/sensors)
{% endcontent-ref %}


# Outlets

\[InvisOutlet -> TCP/WebSocket]

> Updating InvisOutlet's latest outlets status.

#### Response

* <mark style="color:red;">`sn`</mark>: The serial number of the InvisOutlet.
* <mark style="color:red;">`packetID`</mark>: Represents the packet ID.
* <mark style="color:red;">`payload`</mark>:&#x20;
  * <mark style="color:red;">`callbackName`</mark> : 9
  * <mark style="color:red;">`callbackArgs`</mark> :&#x20;
    * `1` : Whether the Outlet 1 power is on or off; 1 - On, 0 - Off.
    * `2` : Whether the Outlet 2 power is on or off; 1 - On, 0 - Off.

```json
{
    "sn": 9,
    "packetID": 887880,
    "payload": {
        "callbackName": 9,
        "callbackArgs": [
            1,    
            0   
        ]
    }
}
```




---

[Next Page](/llms-full.txt/1)

