{
  "id": "vn.agritrace.air-th-xy-md02",
  "version": "1.0.0",
  "vendor": "generic",
  "category": "field-sensor",
  "description": "RS485 Modbus air temperature and relative humidity transmitter (XY-MD02, SHT20 element), read from its input registers. Outdoors it needs a radiation shield. Onboarded by register map only, no driver code. The register map is the manual's (registerMapSource); the driver has not been tested on this hardware yet.",
  "driver": "modbus-register-map",
  "connectivity": ["modbus-rtu"],
  "produces": [
    {"capability": "air.temperature"},
    {"capability": "air.humidity"}
  ],
  "events": ["observe"],
  "requires": [],
  "mobility": "fixed",
  "registerMapSource": {
    "vendor": "not named in the manual (sold as XY-MD02)",
    "model": "XY-MD02 Modbus RTU RS485 SHT20 Temperature Humidity Transmitter",
    "document": "https://knowledgebase.grenton.com/hubfs/xy-md02-manual.pdf",
    "retrieved": "2026-10-15",
    "verified": true,
    "testedOnHardware": false,
    "notes": "Input registers, read with function 04: 0x0001 temperature (signed, the example reads 0x131 as 30.5 C and 0xFF33 as -20.5 C), 0x0002 humidity (the example reads 0x222 as 54.6 %RH). Address 1..247, default 1; 9600 baud. The manual gives a humidity range of 0-80 %RH and a temperature range of -40-60 C."
  },
  "defaults": {
    "pollIntervalSeconds": 600,
    "baudrate": 9600,
    "unit": 1,
    "registers": [
      {"address": 1, "function": 4, "type": "s16", "capability": "air.temperature", "scale": 0.1},
      {"address": 2, "function": 4, "type": "u16", "capability": "air.humidity", "scale": 0.1}
    ]
  }
}
