---
title: "Shelly H\u0026T"
description: "Read temperature and humidity from Shelly H\u0026T Gen1 sensor via MQTT. Battery-powered Wi-Fi sensor with optional USB power for continuous reporting."
url: "https://taphome.com/en/compatibility/shelly-hm/"
language: en
lastmod: 2026-10-08
generator: hugo
ai:
  topics: ["mqtt","sensor","wifi","battery-powered","temperature","humidity"]
  questions: ["How to integrate Shelly H\u0026T with TapHome via MQTT?","What does the Shelly H\u0026T TapHome template measure?","How to find the Shelly H\u0026T MQTT Device ID?","Why is my Shelly H\u0026T not reporting data in TapHome?","Can the Shelly H\u0026T report continuously without battery sleep?","How does TapHome handle the Shelly H\u0026T humidity value conversion?"]
---

# Shelly H&T

Communication: Packet Parser → MQTT

- [Shelly H&T Product Page](https://www.shelly.com/en/products/shop/shelly-humidity-temperature)

> Network address
> 
> With the MQTT broker built into TapHome, it is one broker reached from two places. The template runs directly in the TapHome Core, so in TapHome the broker address is `127.0.0.1` (this computer). The device runs elsewhere in the network, so in the device enter the IP address of the TapHome Core and give the Core an IP reservation in the router — if the Core’s address changes, the device can no longer reach the broker.
> 
> [Network Preparation](https://taphome.com/en/docs/setup/network-preparation/)

## Integration guide

The Shelly H&T is a battery-powered (CR123A) Wi-Fi temperature and humidity sensor from the Shelly Gen1 product line. TapHome communicates with the device over MQTT — the recommended protocol for battery-operated Shelly sensors, since the device sleeps between readings and publishes data only on wake-up.

The template creates a single Temperature Sensor device with a Humidity service attribute, tracking both ambient temperature and relative humidity from one Shelly H&T unit.

## Configuration

### Device ID

The Shelly H&T uses an MQTT Device ID in the format `shellyht-<MAC6>`, where `<MAC6>` is the last 6 characters of the MAC address in lowercase hex (e.g., `shellyht-112233`).

The Device ID can be found:

- On the device label (MAC address)
- In the Shelly web UI: **Settings** → **Device Info**
- Via API: `GET http://<device-ip>/settings` → `mqtt.id` field

### Template setup

After importing the template in TapHome:

1. Open the **Shelly H&T MQTT** module
2. Set the **MQTT Broker IP** and **Port** (default `1883`)
3. Set the `deviceId` custom variable to the hex part of the Device ID only (e.g., `112233` for `shellyht-112233` — the last 6 hex characters of the MAC address)

The module subscribes to `shellies/#` and the listener script filters messages by the configured Device ID.

> [!WARNING]
> On Gen1 Shelly devices, enabling MQTT disables Shelly Cloud — the two cannot coexist. Enable MQTT in the Shelly web UI under **Internet & Security** → **Advanced - Developer Settings**.

> [!TIP]
> The default sleep period is 60 seconds. For more frequent updates, an optional USB adapter is available — when externally powered, sleep mode is disabled and the sensor reports continuously.

## Device capabilities

### Temperature and humidity monitoring

The template provides a single **Temperature Sensor** device that reads ambient temperature from the `shellies/shellyht-{deviceId}/sensor/temperature` MQTT topic. Values are published as float in degrees Celsius.

A **Humidity** service attribute reads relative humidity from `shellies/shellyht-{deviceId}/sensor/humidity`. The MQTT payload is published as 0–100% but the template converts this to a 0–1 range internally (e.g., MQTT value `45.2` is stored as `0.452` in TapHome).

Both readings update whenever the sensor wakes up from sleep mode — by default every 60 seconds, or continuously when USB-powered.

### Additional capabilities

The Shelly H&T also publishes battery level (0–100%, CR123A), an online/offline status via MQTT Last Will and Testament, and a device announcement message with model, MAC, IP and firmware version (firmware >=1.6.0). These capabilities can be added in a future template update.

## Troubleshooting

### Sensor not reporting data

1. Verify the Shelly H&T is connected to Wi-Fi and MQTT is enabled in the device settings (**Internet & Security** → **Advanced - Developer Settings**)
2. Check that the MQTT broker address and port are correct in both the Shelly web UI and TapHome module settings
3. Confirm the `deviceId` custom variable matches the Device ID exactly (last 6 hex chars of MAC, e.g., `112233`)
4. Use an MQTT client (e.g., MQTT Explorer) to subscribe to `shellies/#` and verify the sensor publishes messages under `shellies/shellyht-<deviceId>/` on wake-up

### Humidity reading appears wrong

The template divides the MQTT humidity value by 100 — a humidity of 45.2% is stored as 0.452 in TapHome. This is expected behavior, as TapHome uses a 0–1 range for humidity values. The TapHome UI displays the value correctly as a percentage.

### Battery draining quickly

1. The Shelly H&T is designed for up to 18 months of battery life with the default 60-second sleep period
2. Frequent Wi-Fi reconnections (weak signal, channel hopping) increase power consumption significantly
3. Ensure strong Wi-Fi signal at the sensor location — the device has approximately 30 m indoor range

> [!WARNING]
> Gen1 Shelly devices do **not** support MQTT over TLS. Communication between the sensor and the MQTT broker is unencrypted (plain MQTT, port 1883). Ensure the MQTT broker is on a trusted local network.

## How to install in TapHome

### Prerequisites

- Shelly device connected to Wi-Fi (2.4 GHz), e.g. through the Shelly app or the device's own access point
- MQTT broker running on your local network (e.g., Mosquitto, Home Assistant, or TapHome built-in broker)
- TapHome CCU on the same network as the broker

> [!WARNING]
> On **Gen1** devices, enabling MQTT **disables Shelly Cloud**. Both cannot run simultaneously. On Gen2/Plus devices this limitation does not apply.

### Step 1 — Enable MQTT on the Shelly device

#### Gen1 devices (Shelly 1, 1PM, 2.5, EM, 3EM, Plug S, RGBW2, Dimmer, TRV…)

1. Open the Shelly web UI: `http://<device-ip>/`
2. Navigate to **Internet & Security** → **Advanced — MQTT**
3. Enable **MQTT**
4. Set **MQTT Server**: `<broker-ip>:<port>` (e.g., `192.168.1.10:1883`)
5. Optionally set **MQTT User** and **MQTT Password** if your broker requires authentication
6. Click **Save** — the device will reboot and connect to the broker

#### Gen2 / Plus devices (Shelly Plus 1, Plus 1PM, Plus 2PM, Plus Plug S, Plus H&T, Pro 3EM…)

1. Open the Shelly web UI: `http://<device-ip>/`
2. Navigate to **Settings** → **MQTT**
3. Enable **MQTT**
4. Set **Server**: `<broker-ip>:<port>` (e.g., `192.168.1.10:1883`)
5. The **Client ID** is pre-filled with the device ID (e.g., `shellyplus1pm-AABBCCDDEE`) — leave as-is unless you have a specific reason to change it
6. Click **Save** and reboot the device

With the TapHome built-in broker, `<broker-ip>` is the IP address of the TapHome Core. Give the Core an IP reservation in the router, otherwise the device loses the broker when the router changes the address → [Network Preparation](https://taphome.com/en/docs/setup/network-preparation/).

> [!TIP]
> To verify MQTT is working, use an MQTT client (e.g., MQTT Explorer) and subscribe to `shellies/#` (Gen1) or `<device-id>/#` (Gen2). You should see status messages from the device.

### Step 2 — Find the Device ID / MQTT Client ID

Some templates require a **Device ID** or **MQTT Client ID** parameter. This is the unique identifier used in MQTT topics.

- **Gen1:** found on the label as MAC address (e.g., `AABBCCDDEE`). Device ID = `shelly<model>-<mac>`, e.g., `shelly1pm-AABBCCDDEE`
- **Gen2/Plus:** found in the Shelly web UI under **Settings** → **Device Info** → **Device ID**, or on the device label

### Step 3 — Configure in TapHome

1. In TapHome, add a new **Packet Parser (MQTT)** module
2. **IP Address:** `127.0.0.1` for the TapHome built-in broker (the control unit connects to itself, the address never changes); for an external broker its IP address (e.g., `192.168.1.10`)
3. **Port:** `1883` (default; use `8883` for TLS)
4. **Device ID / MQTT Client ID:** enter the value from Step 2 (if required by the template)
5. Import the template — TapHome will subscribe to the device topics automatically

## Available devices 1

These devices appear in TapHome after import.

Shelly H&T MQTT Module

Custom Variables

|                     |                                                                                   |
|---------------------|-----------------------------------------------------------------------------------|
| `deviceId` (string) | MQTT Device ID of the Shelly H&T — last 6 hex chars of MAC address (e.g., 112233) |

Temperature Sensor Temperature Sensor Read-only

Ambient temperature and humidity — reads °C from MQTT, humidity converted from 0–100% to 0–1 range

float Unit: °C

Read humidity

```taphome
# Simple HTTP Request:
# VAR response := SENDHTTPREQUEST("/example/getValue");
# IF response.IsSuccess
#  VAR content := response.Content;
#  VAR responseHeaders := response.Headers;
#  RETURN(PARSEXML(content, "//element1/value1"));
# ELSE
#  ADDERROR(response.StatusCode + " (" + response.ReasonPhrase + ")");
#  RETURN(NaN);
# END
Hu := listenHum;
# Set Http request method, body and headers
# VAR response := SENDHTTPREQUEST("/example/getValue", "GET", "some data", "header1:value1", "header2:value2", ...);
# OR
# VAR request := HTTPREQUEST("/example/getValue", "POST", "some data");
# request.headers := { "header1:value1", "header2:value2", ...};
# request.method := "GET";
# request.data := null;
# VAR response := SENDHTTPREQUEST(request);
#
#
# Send TCP, UDP data:
# VAR data1 := BYTECOLLECTION("0a bb ea df 01");
# SENDDATA(data1);
# VAR data2 := "{\"name\":\"John\", \"age\":32}";
# SENDDATA(data2);
# VAR data3 := TOBYTES("{\"name\":\"John\", \"age\":32}", "iso-8859-1");
# SENDDATA(data3);
# Process received TCP or UDP data and set device values in the Listener script
#
#
# Download data from FTP:
# FTPDOWNLOAD("filePath");
```

Read temperature

```taphome
# Simple HTTP Request:
# VAR response := SENDHTTPREQUEST("/example/getValue");
# IF response.IsSuccess
#  VAR content := response.Content;
#  VAR responseHeaders := response.Headers;
#  RETURN(PARSEXML(content, "//element1/value1"));
# ELSE
#  ADDERROR(response.StatusCode + " (" + response.ReasonPhrase + ")");
#  RETURN(NaN);
# END
te := listenTemp;
# Set Http request method, body and headers
# VAR response := SENDHTTPREQUEST("/example/getValue", "GET", "some data", "header1:value1", "header2:value2", ...);
# OR
# VAR request := HTTPREQUEST("/example/getValue", "POST", "some data");
# request.headers := { "header1:value1", "header2:value2", ...};
# request.method := "GET";
# request.data := null;
# VAR response := SENDHTTPREQUEST(request);
#
#
# Send TCP, UDP data:
# VAR data1 := BYTECOLLECTION("0a bb ea df 01");
# SENDDATA(data1);
# VAR data2 := "{\"name\":\"John\", \"age\":32}";
# SENDDATA(data2);
# VAR data3 := TOBYTES("{\"name\":\"John\", \"age\":32}", "iso-8859-1");
# SENDDATA(data3);
# Process received TCP or UDP data and set device values in the Listener script
#
#
# Download data from FTP:
# FTPDOWNLOAD("filePath");
```

Listener

```taphome
# Parse received bytes:
IF(RECEIVEDMSG.TOPIC = "shellies/shellyht-"+ deviceId +"/sensor/temperature")
 listenTemp := todouble(TOSTRING(RECEIVEDMSG.PAYLOAD));
END
IF(RECEIVEDMSG.TOPIC = "shellies/shellyht-"+ deviceId +"/sensor/humidity")
 listenHum := todouble(TOSTRING(RECEIVEDMSG.PAYLOAD))/100;
END
```

**Connection:** Packet Parser → MQTT • Hostname: `shellyht-{MAC}.local`

Possible improvements (3)

- Battery Level — Battery percentage (0–100%, CR123A). Available via MQTT but not parsed in template listener script.
- Connection Status — LWT topic — true on connect, false on disconnect. Could detect offline sensor.
- Device Announcement — JSON payload with device model, MAC, IP, firmware version. Published on connect (FW ≥1.6.0).

## Import parameters

Enter these values when you import the XML.

| Asked in the app       | Default        |
|------------------------|----------------|
| Mqtt Broker IP address | `192.168.0.1`  |
| Mqtt Broker port       | `1883`         |
| Device ID              | `yourDeviceId` |

## Sources

- Shelly Gen1 API Reference
  
  [shelly-api-docs.shelly.cloud](https://shelly-api-docs.shelly.cloud/gen1/) 2026-03-12
- Home Assistant Shelly Integration
  
  [www.home-assistant.io](https://www.home-assistant.io/integrations/shelly/) 2026-03-12
- Shelly H&T — Device-Specific API
  
  [shelly-api-docs.shelly.cloud](https://shelly-api-docs.shelly.cloud/gen1/#shelly-h-amp-t) 2026-03-31
- Shelly H&T — Knowledge Base
  
  [kb.shelly.cloud](https://kb.shelly.cloud/knowledge-base/shelly-h-t) 2026-03-31

## Related Documentation

- [MQTT Integration](https://taphome.com/en/compatibility/mqtt-guide/)
- [Packet Parser (HTTP, TCP, UDP, FTP, MQTT)](https://taphome.com/en/docs/integration/packet-parser/)
- [Packet parser functions](https://taphome.com/en/docs/script/packet-parser/)
- [Parsing functions](https://taphome.com/en/docs/script/parsing-functions/)
- [MQTT Broker](https://taphome.com/en/docs/integration/packet-parser/mqtt-broker/)
- [Listener scripts](https://taphome.com/en/docs/script/listener-scripts/)

