TapHome

Zhong Sheng (XY) Temperature, Humidity, Barometer

Modbus TCP
Submitted by
Last updated: 06. 2026
Zhong Sheng (XY) Temperature, Humidity, Barometer

The Zhong Sheng (XY) Temperature, Humidity, Barometer is a Chinese three-in-one RS-485 Modbus sensor that exposes ambient temperature, relative humidity and barometric pressure. It sits on the same OEM family as the well-known XY-MD02 temperature / humidity transmitter, extended with a BMP-class pressure chip — but with a non-standard register layout specific to this rebrand.

The TapHome template connects to the sensor over Modbus TCP via an Ethernet-to-RS-485 gateway, not directly. The gateway bridges TapHome Core (LAN) to the RS-485 bus where the sensor lives at a configurable Slave ID. Three readings are exposed — temperature, relative humidity and barometric pressure — each combined with a per-deployment calibration offset (CORTE, CORH, CORBAR).

Hardware connection

The sensor is a Modbus RTU device on RS-485. TapHome Core reaches it over the network through an Ethernet-to-RS-485 gateway (any standard Modbus TCP ↔ RTU gateway is suitable, e.g. USR-TCP232, Waveshare, or an equivalent DIN-rail converter).

1
2
3
4
┌─────────────┐            ┌───────────────────────┐            ┌──────────────────┐
│ TapHome Core│  Ethernet  │ Ethernet ↔ RS-485     │  RS-485    │ XY sensor        │
│             │ ─────────▶ │ gateway (TCP port 502)│ ─────────▶ │ (Slave ID 1)     │
└─────────────┘            └───────────────────────┘            └──────────────────┘
RS-485 wiring
RS-485 cable color coding on cold-pressed terminals

The sensor uses a cold-pressed-terminal cable with four wires following the convention of the Seeed S-THP-01A reference (identical pin-out to most XY-series sensors):

Wire colorFunction
RedV+ (power supply, 4.5–18 V DC)
BlackGND (power / signal ground)
YellowRS-485 A+
WhiteRS-485 B−

Connect A+ and B− to the matching terminals on the Ethernet-to-RS-485 gateway, and share GND between the sensor, its power supply and the gateway to avoid common-mode issues.

RS-485 wiring to an Ethernet-to-RS-485 gateway (DataLogger example)

Exact wire colors may differ slightly between OEM batches — always verify against the label on the cable before powering up. Reverse-wiring the power will not damage the sensor (it has reverse-power protection) but the sensor will simply not respond.

For bus runs longer than ~100 m, use twisted-pair cable for A+ / B− and add a 120 Ω termination resistor at the far end of the line. Keep all sensors on the same GND reference.

Enabling Modbus communication

No menu or DIP switches are involved — the sensor ships with Modbus RTU enabled out of the box. The integration is purely about wiring the RS-485 bus, configuring the gateway and providing two values during TapHome import.

RS-485 serial parameters (factory defaults)

The XY-series and the Seeed S-THP-01A reference both leave the factory with the same serial settings. The TapHome template assumes these defaults:

SettingValue
Baud rate9600 bps
Data bits8
ParityNone
Stop bits1
Slave address1

Baud rate and slave address are software-configurable via holding registers on the sensor itself (see the Seeed S-THP-01A user guide, registers 0x0200 / 0x0201, or the XY-MD02 datasheet). The TapHome template intentionally does not expose these registers — changing them from TapHome would break the active connection.

Gateway configuration

Configure the Ethernet-to-RS-485 gateway as a Modbus TCP slave (server) on TCP port 502 that proxies to the underlying RS-485 bus at 9600, 8-N-1. Assign it a static IP address (or a DHCP reservation) so it does not change after a power cycle.

If the gateway supports multiple slave mappings, keep this sensor at Slave ID 1 — it is simpler than rewriting the sensor’s address and matches the template default.

TapHome import parameters

When importing the template in TapHome, provide two values:

ParameterDefaultDescription
IP address192.168.1.0IP of the Ethernet-to-RS-485 gateway on the LAN
Slave ID1Modbus address of the sensor on the RS-485 bus
Module variables — calibration offsets

After import, three module-level variables are available in TapHome → Module Variables for per-deployment calibration. They are applied on top of every raw reading:

VariableDefaultUnitPurpose
CORTE0.5°CTemperature offset added to every raw temperature reading
CORH0.01%RHHumidity offset added to every raw humidity reading
CORBAR17hPaBarometric pressure offset added to every raw pressure reading

CORBAR = 17 is a site-specific altitude correction — it must be re-tuned for every deployment. Leaving it at the factory default will bias every pressure reading by +17 hPa relative to the true local atmospheric pressure. Start with CORBAR = 0 and tune against a known reference barometer at the installation altitude. CORTE and CORH should likewise be verified against a reference thermometer / hygrometer placed next to the sensor.

Device capabilities

The template exposes three read-only sensor devices, all reading holding registers via the gateway:

Temperature

Air temperature from the built-in SHT-family chip, read from H:0 (uInt16) and scaled by raw / 10 + CORTE. Reported in °C with 0.1 °C resolution and ±0.5 °C typical accuracy.

Relative humidity

Relative humidity from the same SHT-family chip, read from H:1 (uInt16) and scaled by raw × 0.001 + CORH. Reported in %RH.

The humidity scaling factor is suspect. A multiplier of ×0.001 implies the raw register would hold ≈ 100 000 at 100 %RH, which overflows a 16-bit register (max 65 535). The reference XY-MD02 uses /10 and the Seeed S-THP-01A uses /100. The most likely correct formula is raw / 10 — matching the XY-MD02 convention. Verify readings on real hardware before trusting them; if the reported humidity is clamped or wildly out of range, adjust the template or use a different XY variant.

Barometric pressure

Atmospheric pressure from the built-in BMP-class chip, read from H:4 as a 32-bit unsigned integer (spanning H:4H:5) and scaled by raw / 100 + CORBAR. Reported in hPa with 0.1 hPa resolution.

The device-level poll interval in the XML template is 1 000 ms for the barometer, which is far too aggressive — atmospheric pressure changes on the order of minutes, not seconds. After import, increase the barometer’s poll interval in TapHome → Device Variables to 15 000–30 000 ms to reduce bus load without losing any useful resolution. The module-level poll interval (30 000 ms) already used by temperature and humidity is a good starting point for the barometer too.

Register map summary

RegisterParameterData typeScale / offsetUnitPoll interval
H:0TemperatureuInt16/ 10 + CORTE (0.5)°C30 000 ms (module-level)
H:1HumidityuInt16× 0.001 + CORH (0.01) — verify%RH30 000 ms (module-level)
H:4H:5Barometric pressureuInt32/ 100 + CORBAR (17)hPa1 000 ms (too aggressive)

The raw uInt16 data type cannot natively represent negative values. On real XY-MD02 hardware, sub-zero temperatures arrive as two’s-complement signed integers. If the sensor is deployed in an environment that regularly falls below 0 °C, verify that negative temperatures are decoded correctly before relying on them.

Troubleshooting

No readings after import
  1. Ping the gateway IP from the same subnet as TapHome Core — if it does not respond, the issue is on the LAN / power side, not Modbus.
  2. Confirm the gateway is configured as a Modbus TCP server on port 502, not as a transparent TCP bridge.
  3. Verify the gateway’s RS-485 serial settings match 9600, 8-N-1 — a mismatch here silently produces timeouts with no readings.
  4. Check the sensor’s Slave ID matches the value entered during TapHome import (default 1). A second sensor on the same bus with the same address will collide.
  5. Inspect the RS-485 wiring: A+ to A+, B− to B−, shared GND between sensor, power supply and gateway.
Implausible humidity values

The XML template uses a × 0.001 humidity multiplier that is inconsistent with the XY-MD02 family (/10) and the Seeed S-THP-01A reference (/100). If humidity appears stuck near zero or never reaches plausible values, the raw register is likely using the XY-MD02 convention. Cross-check the raw register value with a Modbus debugging tool (e.g. qModbus) against a reference hygrometer; if raw values around 500 correspond to ~50 %RH, the formula should be /10 and the template needs to be corrected.

Pressure reading biased by ~17 hPa

The template default CORBAR = 17 is a legacy site-specific altitude correction. If pressure reads consistently ~17 hPa higher than a nearby reference barometer (e.g. a weather station), set CORBAR to 0 in TapHome → Module Variables and tune against the reference.

High bus load / communication errors

Increase the barometer poll interval from 1 000 ms to 15 000–30 000 ms in TapHome → Device Variables. A 1 Hz poll on a shared RS-485 bus leaves little bandwidth for other slaves and offers no benefit for a barometer.

Negative temperature shows as a huge positive number

The template reads temperature as uInt16. Real XY hardware returns negative temperatures as two’s-complement signed integers — a raw value of 0xFF33 (≈ 65 331) decoded as unsigned becomes ≈ 6 533.1 °C, but should be decoded as −20.5 °C. If the sensor is installed in an environment that can fall below 0 °C, verify the behaviour on real hardware and consider replacing the template with a signed Int16 variant before relying on sub-zero readings.

Available devices

Temperature, Humidity, Barometer Module
Custom Variables
CORBAR (numeric) = 17Barometric pressure offset in hPa added to every raw barometer reading — used as a site-specific altitude / reference-level correction
Adjust in TapHome → Module Variables after import. Start with 0 and tune against a known reference barometer at the installation altitude; +17 hPa is a legacy site-specific default and will bias pressure readings if left unchanged.
CORH (numeric) = 0.01Relative humidity offset in %RH added to every raw humidity reading — used to compensate per-sensor drift
Adjust in TapHome → Module Variables after import. Typical factory calibration is within ±3 %RH; tune against a reference hygrometer.
CORTE (numeric) = 0.5Temperature offset in °C added to every raw temperature reading — used to compensate per-sensor drift
Adjust in TapHome → Module Variables after import. Tune against a reference thermometer placed next to the sensor.
Barometric Pressure Variable Read-only

Atmospheric pressure from the built-in BMP-class chip in hPa, with the per-deployment CORBAR offset applied

Register: H:4 uInt32 Unit: hPa

Barometric Pressure

Read
MODBUSR(H, 4, uInt32)/100 + CORBAR
Temperature Variable Read-only

Ambient air temperature from the built-in SHT-family sensor in °C, with the per-deployment CORTE offset applied

Register: H:0 uInt16 Unit: °C

Temperature

Read
MODBUSR(H, 0, uInt16)/10 + CORTE
Relative Humidity Variable Read-only

Relative humidity from the built-in SHT-family sensor in %RH, with the per-deployment CORH offset applied

Register: H:1 uInt16 Unit: %RH

Relative Humidity

Read
MODBUSR(H, 1, uInt16)*0.001 + CORH
Connection: Modbus TCP • Slave ID: $[SlaveId]
Possible improvements (10)
  • H:2 Dew Point — INT16 /100, °C — commonly exposed by SHT-family chips alongside temperature and humidity; not read by the current TapHome template.
  • H:3 Atmospheric Pressure (INT16 variant) — INT16 /10, hPa — alternative lower-resolution pressure register present on sister devices; this template uses the 32-bit variant at H:4 instead.
  • H:4 (frost point) Frost Point — INT16 /100, °C — useful for condensation prevention; register overlap with this template's barometer variant means it would only be available on firmware variants without the packed 32-bit pressure register.
  • H:5 (vapor pressure) Vapor Pressure / Wet Bulb / Vapor Concentration — Reference devices expose vapor pressure (/10, hPa), vapor concentration (/10, g/m³) and related psychrometric values; not known to be available on this specific Zhong Sheng (XY) rebrand.
  • H:0x0020 Temperature Unit Selector — UINT16 RW, 0=°C / 1=°F — configuration register for switching display units; not typically needed when the template fixes °C.
  • H:0x0200 Slave Address (writable) — UINT16 RW, 0..255 — would allow changing the Modbus slave ID from TapHome; intentionally left out because mis-writing it would break the connection.
  • H:0x0201 Baud Rate (writable) — UINT16 RW, 0..5 mapping to standard baud rates — same rationale as slave address: unsafe to expose in a user-editable template.
  • H:0x1000 Temperature (IEEE Float variant) — 32-bit IEEE float temperature at offset 0x1000; this template reads the cheaper uInt16 ×0.1 variant at H:0 instead.
  • H:0x1002 Humidity (IEEE Float variant) — 32-bit IEEE float humidity at offset 0x1002; this template reads the uInt16 variant at H:1 instead — consider switching to float if the uInt16 scaling proves wrong on real hardware.
  • H:0x1006 Atmospheric Pressure (IEEE Float variant) — 32-bit IEEE float pressure at offset 0x1006; alternative to the packed uInt32 this template uses at H:4.

Sources

Found a problem with this device template?

Tell us what's wrong, what's missing, or how the template should behave. We rely on your feedback to keep the catalog accurate.

Verified by TapHome

Want to use this in your TapHome Core?

Open this template in the Customer Portal to apply it to one of your homes, or to draft a refinement and submit it back to the catalog.

Open in portal