> For the complete documentation index, see [llms.txt](https://api.intecular.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.intecular.com/invisoutlet-aura/ota/perform-ota-update.md).

# Perform OTA Update

> 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 for InvisOutlet revA:**

* <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 - Update will be performed, 0 - Update failed to initialize (may due to the current device running firmware version is already up to date).

```json
{
    "sn": "11A18240076",
    "packetID": 414883,
    "PUBACK": 1
}
```

**Response for InvisOutlet revB:**

* <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 received.

```json
{
    "sn": "11A18240076",
    "packetID": 414883,
    "PUBACK": 1
}
```

{% hint style="info" %}
If you are performing OTA update for InvisOutlet, you will not receive the response, as the device will be restarted immediately. Please use below **Response for InvisOutlet revB, synchronous** to check the OTA status.
{% endhint %}

**Response for InvisOutlet 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": "11B27540076",
    "packetID": 414883,
    "payload":
    {
        "callbackName": 21,
        "callbackArgs": [1,1]
    }
}
```

{% hint style="info" %}
If you are on InvisOutlet hardware revB, the device will restart immediately to perform the OTA update when performing InvisOutlet or InvisDeco update (*via InvisOutlet*), the non-synchronous response is only sent for whether the command is successfully received or not.

In order to receive the synchronous response when performing InvisOutlet or InvisDeco update (*via InvisOutlet*), you will need to reconnect the TCP connection again right after the Request is sent.
{% endhint %}

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