# Relay state 16ADS

## Relay state change

This command sets/gets the state of the relay, effectively powering/depowering the appliance it is controlling.

{% hint style="info" %}
By default, the last state of the relay is saved in the device's memory.

For more details, see the command described below.
{% endhint %}

{% tabs %}
{% tab title="SET" %}

<table data-header-hidden><thead><tr><th width="146"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Hex value – Meaning</strong></td></tr><tr><td>0</td><td>C1 – The command code.</td></tr><tr><td>1</td><td><p>00 – OFF;</p><p>01 – ON. </p></td></tr></tbody></table>

**Example downlink:** 0xC101 – Turn on the relay.
{% endtab %}

{% tab title="GET" %}

<table data-header-hidden><thead><tr><th width="143.99999999999997"></th><th width="193"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Sent request</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>B1 – Command code</td><td>B1 – Command code</td></tr><tr><td>1</td><td> </td><td>00 - The relay is off;<br>01 - The relay is on;</td></tr></tbody></table>

**Example downlink sent by the server:** 0xB1;

**Example command response:** 0xB101 – The relay is ON.
{% endtab %}
{% endtabs %}

## Relay state change reason

{% hint style="info" %}
These commands are available for devices with firmware version ≥ 1.1.
{% endhint %}

Reason for changing the relay state.

<table><thead><tr><th width="153">Byte index</th><th>Received response</th></tr></thead><tbody><tr><td>0</td><td>54 – Command code</td></tr><tr><td>1</td><td>00 - Restart the device;<br>01 - Manual (by button) relay switching;<br>02 - Overheating protection;<br>06 - Radio command: Relay state change;<br>07 - Radio commands: Relay timer in milliseconds and seconds.</td></tr></tbody></table>

## Relay state after return of power supply

You can set/get the relay state after return of power supply with the following command set.

{% tabs %}
{% tab title="SET" %}

#### You can set the relay state after return of power supply with the command:

<table data-header-hidden><thead><tr><th width="138"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Hex value – Meaning</strong></td></tr><tr><td>0</td><td>5E – The command code.</td></tr><tr><td>1</td><td>00: Last state. <strong>Default value.</strong><br>01: ON - after return of power supply.<br>02: OFF - after return of power supply.</td></tr></tbody></table>

**Example command**: 0x5E02 – Sets the relay state to be off after return of power supply.
{% endtab %}

{% tab title="GET" %}

#### Get the relay state after return of power supply.

<table data-header-hidden><thead><tr><th width="143.99999999999997"></th><th width="190"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Sent request</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>5F – Command code.</td><td>5F – Command code.</td></tr><tr><td>1</td><td> </td><td>00: Last state.<br>01: ON - after return of power supply.<br>02: OFF - after return of power supply.</td></tr></tbody></table>

**Example command:** 0x5F;

**Example response:** 0x5F02 – The relay state is set to be off after return of power supply.
{% endtab %}
{% endtabs %}

## Relay timer in milliseconds

{% hint style="info" %}
These commands are available for devices with firmware version ≥ 1.1.
{% endhint %}

The command is used to configure the state of a relay (ON or OFF) for a specified duration in milliseconds.&#x20;

{% hint style="danger" %}
After the timer expires, the relay automatically returns to its previous state.

The relay timer is deactivated when setting the relay state with command [C1](/mclimate-lorawan-devices/devices/mclimate-16a-switch-and-power-meter-lorawan-16aspm/mclimate-16aspm-device-communication-protocol/relay-state-16aspm.md#set), manually (via the button) or by triggering any of the [protections](/mclimate-lorawan-devices/devices/mclimate-16a-switch-and-power-meter-lorawan-16aspm/mclimate-16aspm-device-communication-protocol/protections.md).
{% endhint %}

{% tabs %}
{% tab title="SET" %}

<table data-header-hidden><thead><tr><th width="146"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Hex value – Meaning</strong></td></tr><tr><td>0</td><td>55 – The command code.</td></tr><tr><td>1</td><td><p>00 – OFF;</p><p>01 – ON.</p></td></tr><tr><td>2</td><td>XX - Timer, bits [15:8];</td></tr><tr><td>3</td><td>XX - Timer bits [7:0]: Relay timer duration (in milliseconds).</td></tr></tbody></table>

**Example downlink:** 0x550001F4 – Turn off the relay for 500 milliseconds.
{% endtab %}

{% tab title="GET" %}

<table data-header-hidden><thead><tr><th width="126.99999999999997"></th><th width="186"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Sent request</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>56 – Command code</td><td>56 – Command code</td></tr><tr><td>1</td><td> </td><td>00 - The relay is off;<br>01 - The relay is on;</td></tr><tr><td>2</td><td></td><td>XX - Timer, bits [15:8]; </td></tr><tr><td>3</td><td></td><td>XX - Timer bits [7:0]: Remaining time of the relay timer (in milliseconds).</td></tr></tbody></table>

**Example downlink sent by the server:** 0x56;

**Example command response:** 0x560000FF – The relay state is off and 255 milliseconds remains to return to the previous relay state.
{% endtab %}
{% endtabs %}

Adjustable range is 50…65 535 milliseconds (1ms. resolution).

## Relay timer in seconds

{% hint style="info" %}
These commands are available for devices with firmware version ≥ 1.1.
{% endhint %}

The command is used to configure the state of a relay (ON or OFF) for a specified duration in seconds.&#x20;

{% hint style="danger" %}
After the timer expires, the relay automatically returns to its previous state.

The relay timer is deactivated when setting the relay state with command [C1](/mclimate-lorawan-devices/devices/mclimate-16a-switch-and-power-meter-lorawan-16aspm/mclimate-16aspm-device-communication-protocol/relay-state-16aspm.md#set), manually (via the button) or by triggering any of the [protections](/mclimate-lorawan-devices/devices/mclimate-16a-switch-and-power-meter-lorawan-16aspm/mclimate-16aspm-device-communication-protocol/protections.md).
{% endhint %}

{% tabs %}
{% tab title="SET" %}

<table data-header-hidden><thead><tr><th width="146"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Hex value – Meaning</strong></td></tr><tr><td>0</td><td>57 – The command code.</td></tr><tr><td>1</td><td><p>00 – OFF;</p><p>01 – ON.</p></td></tr><tr><td>2</td><td>XX - Timer, bits [15:8];</td></tr><tr><td>3</td><td>XX - Timer bits [7:0]: Relay timer duration (in seconds).</td></tr></tbody></table>

**Example downlink:** 0x57000003 – Turn off the relay for 3 seconds.
{% endtab %}

{% tab title="GET" %}

<table data-header-hidden><thead><tr><th width="143.99999999999997"></th><th width="193"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Sent request</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>58 – Command code</td><td>58 – Command code</td></tr><tr><td>1</td><td> </td><td>00 - The relay is off;<br>01 - The relay is on;</td></tr><tr><td>2</td><td></td><td>XX - Timer, bits [15:8]; </td></tr><tr><td>3</td><td></td><td>XX - Timer bits [7:0]: Remaining time of the relay timer (in seconds).</td></tr></tbody></table>

**Example downlink sent by the server:** 0x58;

**Example command response:** 0x58000001 –The relay state is off and 1 second remains to return to the previous relay state.
{% endtab %}
{% endtabs %}

Adjustable range is 1…65 535 seconds (1sec. resolution).

## Relay state after overheating protection recovery

You can set/get the relay state after overheating protection recovery with the following command set.

{% tabs %}
{% tab title="SET" %}

#### You can set the relay state after overheating protection recovery with the command:

<table data-header-hidden><thead><tr><th width="138"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Hex value – Meaning</strong></td></tr><tr><td>0</td><td>59 – The command code.</td></tr><tr><td>1</td><td>00: Last state. <strong>Default value.</strong><br>01: OFF - after overheating protection recovery.</td></tr></tbody></table>

**Example command**: 0x5901 – Sets the relay state to be off after overheating protection recovery.
{% endtab %}

{% tab title="GET" %}

#### Get the relay state after overheating protection recovery.

<table data-header-hidden><thead><tr><th width="130.99999999999997"></th><th width="192"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Sent request</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>5A – Command code.</td><td>5A – Command code.</td></tr><tr><td>1</td><td> </td><td>00: Last state.<br>01: OFF - after overheating protection recovery.</td></tr></tbody></table>

**Example command:** 0x5A;

**Example response:** 0x5A01 – The relay state is set to be off after overheating protection recovery.
{% endtab %}
{% endtabs %}

## Manual relay state change

This command lets the Application Server know that the relay state has been manually (physically - via a button on the device) changed.

The command is sent together with the keepalive of the device. The keepalive data in the example below is omitted for clarity.

<table><thead><tr><th width="146">Byte index</th><th>Received response</th></tr></thead><tbody><tr><td>0</td><td>5D – Command code</td></tr><tr><td>1</td><td>XX - Relay state.</td></tr></tbody></table>

**Example uplink**: 0x5D01;

The relay state has been manually changed to 01 (Relay state is ON).


---

# 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://docs.mclimate.eu/mclimate-lorawan-devices/devices/mclimate-16a-dry-switch-16ads/mclimate-16ads-device-communication-protocol/relay-state-16ads.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.
