> 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-c-pro/device-management/invisoutlet/matter-mode-switching-button.md).

# 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]`. |
