AN-303 LoRaWAN Temperature & Humidity Sensor User Guide

Device Information: Model AN-303, devEui ffffff200000b703, gateway IP 192.168.31.205, Modbus Slave ID 9, BACnet Device ID 108

1 Protocol Overview

The AN-303 reports temperature, humidity, battery voltage, tamper status, and signal quality on Fport 210.

Payload format (Fport 210):

Byte Field Description
0 Reserved Always 0x00 (protocol version)
1 … N TLV pairs [Type(1 B)][Value(N B)] … repeating until end

Each Type byte determines the field name and the number of following value bytes:

Type Value Bytes Field Name Encoding Scale Unit Notes
0x01 1 model uint8 Model code = 0x03
0x10 2 temperature int16 BE ÷100 °C e.g. 0x09F6=2550 → 25.50 °C
0x12 2 humidity uint16 BE ÷10 %RH e.g. 0x023F=575 → 57.5 %RH
0x11 1 temperatureEvent uint8 0=normal 1=abnormal 2=high 3=low
0x13 1 humidityEvent uint8 0=normal 1=abnormal 2=high 3=low
0x77 1 tamperState uint8 0=normal 1=tampered
0x04 2 batteryVoltage uint16 BE ÷1000 V e.g. 0x0E1A=3610 → 3.610 V
0x05 1 batteryLowEvent uint8 0=normal 1=low-voltage event

JavaScript Decoder Example:

// AN-303 Temperature & Humidity Sensor — Fport 210 uplink decoder
function decodeUplink(bytes) {
  var i = 1, r = {};
  function u16(b,o){ return (b[o]<<8)|b[o+1]; }
  function i16(b,o){ var v=u16(b,o); return v>32767?v-65536:v; }
  while (i < bytes.length) {
    var t = bytes[i++];
    switch (t) {
      case 0x01: r.model            = bytes[i++]; break;
      case 0x04: r.batteryVoltage   = u16(bytes,i)/1000; i+=2; break; // V
      case 0x05: r.batteryLowEvent  = bytes[i++]; break;
      case 0x10: r.temperature      = i16(bytes,i)/100;  i+=2; break; // °C
      case 0x11: r.temperatureEvent = bytes[i++]; break; // 0=normal
      case 0x12: r.humidity         = u16(bytes,i)/10;   i+=2; break; // %RH
      case 0x13: r.humidityEvent    = bytes[i++]; break;
      case 0x77: r.tamperState      = bytes[i++]; break;
      default:   i++; break;
    }
  }
  return r;
}
// Example payload (hex): 00 01 03 10 09 F6 12 02 3F 77 00 04 0E 1A
// → { model:3, temperature:25.5, humidity:57.5, tamperState:0, batteryVoltage:3.610 }

Script download: LPP.zip

Compatibility note: LPP.js is developed and tested against ChirpStack v4.17.0. The ChirpStack JavaScript codec API may differ across versions — if you are running a different ChirpStack version, review and adjust the script as needed before deployment.
⚠️ The IP addresses (192.168.31.205 / 192.168.31.193), ChirpStack API token, Slave ID, BACnet Device ID, and devEui in the examples below are for demonstration only. Replace them with your actual gateway IP, ChirpStack API token, and device parameters.

2.1 ChirpStack MQTT Subscription

Subscribe to the MQTT topic to receive real-time uplink frames:

Application ID3ef9e6b9-ec54-4eda-86b8-a5fb46899f39 is the factory-default ChirpStack
application built into the gateway. Replace it with your actual application
ID if you have created a different one.

Gateway IP192.168.31.205 is the gateway WAN port IP shown as an
example. Replace it with your actual gateway IP address.

Device EUIffffff200000b703 is the EUI of the example device.
Replace it with the EUI shown in the gateway device list, or use +
as a wildcard to subscribe to all devices at once.
# Subscribe to one specific device
mosquitto_sub -h 192.168.31.205 -p 1883 \
  -u gateway -P mqtt88888888 \
  -t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff200000b703/event/up"

# Subscribe to ALL devices on ALL applications (wildcard)
mosquitto_sub -h 192.168.31.205 -p 1883 \
  -u gateway -P mqtt88888888 \
  -t "application/+/device/+/event/up"

Example uplink payload (JSON):

{
  "devEui": "ffffff200000b703",
  "fPort": 210,
  "object": {
    ...  (decoded LPP fields)
  }
}

2.2 IoT Hub HTTP API

Send a GET request to retrieve the latest device state:

curl -s "http://192.168.31.205:8070/api/getStatus?devEui=ffffff200000b703"
{
  "success": true,
  "result": {
    "temperature": 25.7,
    "humidity": 57.5,
    "batteryVoltage": 3.61,
    "batteryVoltageState": 0,
    "tamper": 1,
    "model": "AN-303"
  }
}

2.3 IoT Hub Modbus TCP — Python Script

Script download: modbus_tcp_read.py

Use modbus_tcp_read.py to poll all registers at once:

python3 modbus_tcp_read.py --ip 192.168.31.205 --port 502 \
    --slaveId 9 --sensorType AN-303
Target: 192.168.31.205:502 | Slave ID: 9 | Sensor: AN-303
================================================================================================================================================================
Attribute                | Addr   | FC  | Format     | Order        | Cnt | Scale    | Raw(Hex)            | Value              | Unit
----------------------------------------------------------------------------------------------------------------------------------------------------------------
online                   | 6      | 03  | Bit/Bool   | Big(ABCD)    | 1   | x1       | 0001                | true               | none
lastOnlineTime           | 7      | 03  | UnixTime   | Big(ABCD)    | 2   | x1       | 69CC CE71           | 1775029873         | second
temperature              | 9      | 03  | Int16(S)   | Big(ABCD)    | 1   | /100     | 0A0A                | 25.7               | celsius
temperatureState         | 10     | 03  | Int16      | Big(ABCD)    | 1   | x1       | 0000                | 0.0                | none
humidity                 | 11     | 03  | Int16(S)   | Big(ABCD)    | 1   | /100     | 1676                | 57.5               | percent
humidityState            | 12     | 03  | Int16      | Big(ABCD)    | 1   | x1       | 0000                | 0.0                | none
batteryVoltage           | 13     | 03  | Int16(S)   | Big(ABCD)    | 1   | /100     | 0169                | 3.61               | volt
batteryVoltageState      | 14     | 03  | Int16      | Big(ABCD)    | 1   | x1       | 0000                | 0.0                | none
tamper                   | 15     | 03  | Int16      | Big(ABCD)    | 1   | x1       | 0001                | 1.0                | none
model                    | 40     | 03  | String(24B) | ASCII        | 12  | x1       | 414E 2D33 3033 0000 ... | AN-303             | none
rssi                     | 52     | 03  | Int16      | Big(ABCD)    | 1   | x1       | FFC2                | -62.0              | none
snr                      | 53     | 03  | Int16      | Big(ABCD)    | 1   | x1       | 000E                | 14.0               | none

2.4 IoT Hub Modbus TCP — Modbus Poll

Tool download: Modbus Poll 9.5.0.1507.zip

  1. Open Modbus Poll, connect to 192.168.31.205:502, Slave ID 9
  2. Menu Setup → Read/Write Definition, set Function Code = FC03, Start Address = 6, Length = 48
  3. Click OK — values update in real-time

2.5 IoT Hub BACnet BIP — Python Script

Script download: bacnet_read.py

Use bacnet_read.py to read all BACnet objects:

python3 bacnet_read.py --ip 192.168.31.205 --port 47808 --id 108
Target: 192.168.31.205:47808 | BACnet ID: 108 | Scan: 10800-10899
------------------------------------------------------------
Type | Instance | Offset | Value                    | Object Name
------------------------------------------------------------
BI   | 10802    | 2      | active                   | ffffff200000b703.online
AI   | 10803    | 3      | 1775029888.00            | ffffff200000b703.lastOnlineTime
AI   | 10804    | 4      | 25.70                    | ffffff200000b703.temperature
AI   | 10805    | 5      | 0.00                     | ffffff200000b703.temperatureState
AI   | 10806    | 6      | 57.50                    | ffffff200000b703.humidity
AI   | 10807    | 7      | 0.00                     | ffffff200000b703.humidityState
AI   | 10808    | 8      | 3.61                     | ffffff200000b703.batteryVoltage
AI   | 10809    | 9      | 0.00                     | ffffff200000b703.batteryVoltageState
AI   | 10810    | 10     | 1.00                     | ffffff200000b703.tamper
CV   | 10814    | 14     | AN-303                   | ffffff200000b703.model
AI   | 10815    | 15     | -62.00                   | ffffff200000b703.rssi
AI   | 10816    | 16     | 14.00                    | ffffff200000b703.snr

2.6 IoT Hub BACnet BIP — YABE

Tool download: SetupYabe_v2.1.0.exe

  1. Open YABE, connect to 192.168.31.205:47808
  2. Expand Device 108 in the device tree
  3. Browse AI/BI/AV/BV/CV objects to view real-time values