TapHome

Shelly H&T

Packet Parser → MQTT
Submitted by
Last updated: 04. 2026
Shelly H&T

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: SettingsDevice Info
  • Via API: GET http://<device-ip>/settingsmqtt.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 Device ID of your Shelly H&T (e.g., 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.

On Gen1 Shelly devices, enabling MQTT disables Shelly Cloud — the two cannot coexist. Enable MQTT in the Shelly web UI under Internet & SecurityAdvanced - Developer Settings.

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 & SecurityAdvanced - 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/shellyht-# and verify the sensor publishes messages 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

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 (see HTTP connection guide if not done yet)
  • 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

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 & SecurityAdvanced — 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 SettingsMQTT
  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

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 SettingsDevice InfoDevice ID, or on the device label

Step 3 — Configure in TapHome

  1. In TapHome, add a new Packet Parser (MQTT) module
  2. IP Address: enter the MQTT broker IP (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

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

Temperature Sensor

Read humidity
# 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
# 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
# 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
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).

Sources