# Button press event counters

## Get press event counter

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

These commands return the counter value for button press events. Each counter tracks a specific type of press: single, double, or triple. The counter increments every time the corresponding press event occurs. The values are stored in long-term (EEPROM) memory, ensuring they persist after a device restart.

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

{% tabs %}
{% tab title="GET single press event counter" %}

<table data-header-hidden><thead><tr><th width="136.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>B1 – Command code</td><td>B1 – Command code</td></tr><tr><td>1</td><td> </td><td>Single press event counter, bits [23:16].</td></tr><tr><td>2</td><td></td><td>Single press event counter, bits [15:8].</td></tr><tr><td>3</td><td></td><td>Single press event counter, bits [7:0].</td></tr></tbody></table>

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

**Example command response:** 0xB10001AA – The number of single press events is 426.
{% endtab %}

{% tab title="GET double press event counter" %}

<table data-header-hidden><thead><tr><th width="136.99999999999997"></th><th width="188"></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>B2 – Command code</td><td>B2 – Command code</td></tr><tr><td>1</td><td> </td><td>Double press event counter, bits [23:16].</td></tr><tr><td>2</td><td></td><td>Double press event counter, bits [15:8].</td></tr><tr><td>3</td><td></td><td>Double press event counter, bits [7:0].</td></tr></tbody></table>

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

**Example command response:** 0xB20001BB – The number of double press events is 443.
{% endtab %}

{% tab title="GET triple press event counter" %}

<table data-header-hidden><thead><tr><th width="136.99999999999997"></th><th width="189"></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>B3 – Command code</td><td>B3 – Command code</td></tr><tr><td>1</td><td> </td><td>Triple press event counter, bits [23:16].</td></tr><tr><td>2</td><td></td><td>Triple press event counter, bits [15:8].</td></tr><tr><td>3</td><td></td><td>Triple press event counter, bits [7:0].</td></tr></tbody></table>

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

**Example command response:** 0xB30001CC – The number of triple press events is 443.
{% endtab %}
{% endtabs %}

## Clear press event counter

{% hint style="info" %}
This command is available for devices with firmware version ≥ 1.3.
{% endhint %}

Clears the press event counter for the specified press type (1 - single, 2 - double, or 3 - triple). This command allows the system to clear the accumulated press event count stored in long-term (EEPROM) memory, ensuring that the counter resets to zero for the selected press type.

<table><thead><tr><th width="182"></th><th width="111"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Bit index</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>-</td><td>20 – The command code.</td></tr><tr><td>1</td><td>-</td><td>XX - Clear (1 - single, 2 - double, or 3 - triple) press event counter.</td></tr></tbody></table>

**Example downlink**: 0x2001 – Clear the single press event counter.


---

# 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-multipurpose-button-lorawan/mclimate-button-lorawan-device-communication-protocol/button-press-event-counters.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.
