ES12248

Driver for the ES12248 Modbus RTU temperature and humidity sensor.

Provides a thin Modbus RTU client wrapper around the ES12248 industrial temperature and humidity transmitter. The driver opens a serial connection to the sensor’s RS-485 interface, reads scaled integer measurements from holding registers, and exposes them as floating-point physical values.

Temperature is read from holding register 0 and humidity from holding register 1. Both registers contain value * 100 as a 16-bit integer, so the driver divides by 100.0 to recover degrees Celsius and relative humidity in percent. Each register read is retried up to three times with a short back-off, and the last successfully decoded value is cached so callers can fall back to it if a parse error occurs.

Hardware:
  • Interface: Modbus RTU over RS-485 (UART)

  • Default port: /dev/ttyAMA2

  • Default baud rate: 9600

  • Default slave ID: 1

  • Registers: 0 = temperature (x100), 1 = humidity (x100)

Example

>>> from drivers.ES12248.ES12248 import ES12248
>>> sensor = ES12248()
>>> sensor.initialize(port="/dev/ttyAMA2", baud=9600, slave_id=1)
>>> temperature = sensor.get_temperature()
>>> humidity = sensor.get_humidity()
>>> sensor.close()

Note

Requires pymodbus (ModbusSerialClient) for Modbus RTU framing and utils.oizom_logger.OizomLogger for structured logging. Although the project hosts a common base in SensorBase.SensorBase.GenericSensor, this driver is currently a standalone class and does not inherit from it; the public method names (initialize, get_temperature, get_humidity, close) follow the same convention so it can be used interchangeably wherever that interface is expected.

Attributes

Classes

ES12248

Modbus RTU driver for the ES12248 temperature and humidity sensor.

Module Contents

ES12248.basic_logger
ES12248.context_logger
ES12248.sensor