Skip to main content

HJ212Master

Purpose

HJ212Master receives HJ 212 pollutant-monitoring reports and maps the CP data area to gateway variables. It is a passive receiver: the field device sends reports to the gateway.

Open the plugin

Open Development Configuration → Collection Configuration, create a device, and select HJ212Master under Collection Plugin.

Supported channels and data types

Channel typeCheck before configuration
UDPConfirm the local bind address, port, firewall rules, and packet source.
TCP clientConfirm the device IP, port, and network reachability from the gateway.
Serial portConfirm that the port is not in use and that baud rate, data bits, stop bits, and parity match the device.

Optional data types: Boolean, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float, Double, String, and Decimal.

Address rules

The variable address matches the HJ 212 message header:

ST=<system-code>;MN=<device-id>;CN=<command-code>
  • ST is the system code, MN is the device identifier, and CN is the command code from the incoming report.
  • Fill in the values from an actual field message. Do not leave example placeholders in a production variable.
  • When the header matches, the variable receives the message's CP data area. Use a read expression when a single pollutant field must be extracted from CP.
  • Field names are case-insensitive; use uppercase ST, MN, and CN with English semicolons for consistency.
  • The plugin receives active reports only. It does not support active reads or variable writes.

Functions

FunctionPurpose
Last activityShow the receive time of the latest valid HJ 212 message.
Variable tableCheck the matched address, current CP value, online state, collection time, and last error.
Message statisticsReview queued, dropped, and truncated message counts.
Message logReview HJ 212 reports received by the current session.

Device debug

Open Development Configuration → Collection Configuration, select the HJ212Master device, and open More Functions → Debug. The protocol panel uses reception monitoring to show incoming reports and variable mapping.

HJ212Master reception monitoring

Verify the configuration

  1. Copy ST, MN, and CN from a real test report and create a variable with the address format above.
  2. Make the same device send the command report again and confirm that a new record appears in reception monitoring.
  3. Confirm that the variable value is the report's CP data area, the collection time updates, and the last error is empty.
  4. Send a test report with a different MN or CN and confirm that it does not update the current variable.
  5. When a single pollutant value is required, configure a read expression and verify the extracted value and data type.

Troubleshooting

SymptomCheck
No new report in reception monitoringConfirm that the device is actively reporting. Check the channel, frame boundaries, and HJ 212 message validation.
Report arrives but the variable is unchangedCompare ST, MN, and CN with the received message character by character. Remove example placeholders.
The variable shows the full CP areaThis is the default mapping. Add a read expression to extract one pollutant field.
Data from multiple devices updates one variableInclude a distinguishing MN in the variable address and add CN when commands differ.
Serial device does not respondCheck port ownership, baud rate, data bits, stop bits, parity, and channel type.