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

**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" %}
If you are on InvisOutlet hardware revB, 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.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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.intecular.com/invisoutlet-pro/ota/perform-ota-update.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
