Version
0.8.x_dev

Modbus sensor


Adding a modbus sensor is pretty easy. Follow developer guide in this section, copy eg sdm120.json to be your template (https://raw.githubusercontent.com/boneIO-eu/app_black/dev/boneio/sensor/modbus/sdm120.json)

Configuration variables:

  • model - model to show in Home Assistant.
  • registers_base - array of registers. You can read multiple registers at once, it’s more CPU friendly.
    • base - start index to read
    • length - how many registers to read
    • registers - array how to interpret data received from modbus device
VALUE_TYPES = {
    "U_WORD": {"f": "decode_16bit_uint", "byteorder": Endian.Big},
    "S_WORD": {"f": "decode_16bit_int", "byteorder": Endian.Big},
    "U_DWORD": {"f": "decode_32bit_uint", "byteorder": Endian.Big},
    "S_DWORD": {"f": "decode_32bit_int", "byteorder": Endian.Big},
    "U_DWORD_R": {"f": "decode_32bit_uint", "byteorder": Endian.Little},
    "S_DWORD_R": {"f": "decode_32bit_int", "byteorder": Endian.Little},
    "U_QWORD": {"f": "decode_64bit_uint", "byteorder": Endian.Big},
    "S_QWORD": {"f": "decode_64bit_int", "byteorder": Endian.Big},
    "U_QWORD_R": {"f": "decode_64bit_uint", "byteorder": Endian.Little},
    "FP32": {"f": "decode_32bit_float", "byteorder": Endian.Big},
    "FP32_R": {"f": "decode_32bit_float", "byteorder": Endian.Little},
}