# Device states

* Introduction
* Manual change of the device state
* Automated change of the device state
  * Automated arming
  * Automated disarming
* Events (uplink messages) relevant for device states

#### **Introduction**

If your SimpleHw device uses API 6, there are three possible states the device will be in:

1. **Disarmed** (not active and no messages will be sent in default settings)
2. **Arming** (state between disarmed and armed, time-limited, default is 15 seconds)
3. **Armed** (active and ready to monitor and send messages)

***

4\. ***Zone switching mode** (it’s only possible to manually switch the Sigfox RC zone, nothing else - this is the only device state that is not closely tied to the user mode and is implemented in the firmware in order for you to be able to change RC zones manually - more here:* [*https://ask.simplehw.eu/api-6-rc-switch*](https://ask.simplehw.eu/api-6-rc-switch)*)*

Device state depends on the **user mode** your device is in. A few modes do **NOT** require arming and are active **all the time** - namely [Blinker](https://simplehw.atlassian.net/wiki/spaces/DOC/pages/15400961/API+6+Standard+User+Modes#Blinker) and [Press me](https://simplehw.atlassian.net/wiki/spaces/DOC/pages/15400961/API+6+Standard+User+Modes#Press-me) and its WiFi enabled variants.\
Most API 6 devices are shipped in basic **Press me mode**, which means they do not require arming - with the exception of [SimplePack 4.0 Plus Magnetic Switch](https://simplehw.eu/shop/product/simplepack-4-0-plus-magnetic-switch-92#attr=634,624,641,645,621,627,628,643,632,633,635,636,639,640,644,620) (shipped in 0x0C Reed switch on/off) and [SimpleIndustry Legionella](https://simplehw.eu/shop/product/simpleindustry-legionella-pipe-probes-231?category=2#attr=916,915,914,913,919,920,918,924,925,928,922,923,921,927,912,950,1018) (shipped in 0x1D Legionella mode).

If you’re using any other mode than Blinker or any Press me version, your device will be disarmed by default. There are several ways to arm the device and these can be grouped into two major groups.

#### **Manual change of the device state**

**Cycle: Disarmed** → **Arming** → **Armed** → **Disarmed**

Manual arming means pressing the SimplePack or SimplePack Plus button or activating the SimpleLeak by placing it in water and removing it after a few seconds. This will start **arming** the device and after the *departure delay* timer countdown expires, the device will be **armed** and actively monitoring its environment.

This is closely described in the [*Basic Operations With SimpleHw Devices guide*](https://simplehw.atlassian.net/wiki/spaces/DOC/pages/8519899/API+6+Basic+Operations+With+SimpleHw+Devices).

**Disarming the device manually** will be the same as disarming the device any other way: device state will change (**armed → disarmed**). Manual disarm can be distinguished by the uplink event it generates.

***

#### **Automated change of the device state**

**Cycle: Disarmed → Armed → Disarmed**

You will skip the **arming** state when **automated arming and disarming** configuration is active (by default, it isn’t). There are two automated options for both arming and disarming:

**Automated arming**

| **Method** | **Triggered by** | **Additional information**                                                                                                                                   |
| ---------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Auto-arm   | Time             | <p>Value of downlink register <strong>0x10</strong> in SimpleTime.<br>Countdown starts when downlink is received.</p>                                        |
| Force-arm  | Downlink         | <p>Set <strong>bit 7</strong> of downlink register <strong>0x40</strong> to 1. Device state<br>changes from disarmed to armed when downlink is received.</p> |

**Automated disarming**

| **Method**      | **Triggered by**                                                                                                                        | **Additional information**                                                                                                                                                                |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Disarming alert | [*Alert 1, 2 or 3*](https://simplehw.atlassian.net/wiki/spaces/DOC/pages/15237121/API+6+Mode-Independent+Information+And+Events#Alerts) | <p>Set <strong>bit 5</strong> of downlink registers <strong>0x23</strong>, <strong>0x26</strong> and <strong>0x29</strong> to 1.<br>Device disarms when the respective alert is sent.</p> |
| Force-disarm    | Downlink                                                                                                                                | <p>Set <strong>bit 6</strong> of downlink register <strong>0x40</strong> to 1. Device state<br>changes from armed to disarmed when downlink is received.</p>                              |

***

#### **Events (uplink messages) relevant for device states**

There is a set of mode-independent events that inform you about device state changes. Here’s a table:

| **Hex** | **Event name**                    | **Device state change** | **Trigger**                                                                                 |
| ------- | --------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------- |
| 0x10    | Arming started                    | Disarmed **→** arming   | <p>SimplePack: button press (short is default)<br>SimpleLeak: water detection</p>           |
| 0x11    | Armed                             | Arming **→** armed      | Departure delay timer countdown expired                                                     |
| 0x12    | Autoarmed                         | Disarmed **→** armed    | Auto-arm timer countdown expired                                                            |
| 0x13    | Disarmed by event                 | Armed **→** disarmed    | Event set to disarm the device sent                                                         |
| 0x14    | <p>Disarmed<br>by interaction</p> | Armed **→** disarmed    | <p>SimplePack: button press (long is default)<br>SimpleLeak: turned upside down for 10s</p> |
| 0x17    | Force-armed                       | Disarmed **→** armed    | Force-arming downlink received                                                              |
| 0x18    | Force-disarmed                    | Armed **→** disarmed    | Force-disarming downlink received                                                           |
