Generic Modbus

This driver is intended to interact with any system that uses Modbus protocol.

Modbus is designed to write and read registers. A register is a value of 16 bits.

Each Modbus register has got assigned an address, so, to refer a register you must specify its address.

Resources

The only resource that exists is Modbus register (_MODBUS_REGISTER type). Its address is a whole number between 0 and 65536, and represents the actual register address.

The driver polls in order to update register values, so it will fire STATE_UPDATE event each time a register is updated indicating its value.

States

Each Modbus register has two values:

  • the register VALUE and
  • the ACTUAL_VALUE.

The ACTUAL_VALUE is optional, it is used or not depending on the Modbus server.

Commands

The only command you can run with a Modbus register is to write a new value to it. This action can be done using the command WRITE.

The WRITE command requires as an argument the new value.

Note that ACTUAL_VALUE is read-only and can not be written, so WRITE will just update VALUE.

Events

As quick as the register updates its value after the WRITTEN command runs, the WRITTEN event will be fired.