RegisterDef#

pydantic model RegisterDef[source]#

Bases: BaseModel

Definition of a Modbus register.

Note

  • Swap options control byte ordering for multi-byte values: - byte_swap: swap bytes within each 16-bit word - word_swap: swap 16-bit words (for 32-bit and 64-bit types) - long_swap: swap 32-bit longs (for 64-bit types only)

  • All swap options default to False (big-endian / network byte order).

  • scale is not allowed for coils and discrete inputs.

field name: str [Required]#

Unique name/alias for this register

field description: str | None = None#
field starting_address: int [Required]#
Constraints:
  • ge = 0

  • le = 65535

field register_type: RegisterType = 'holding'#
field data_type: DataType = 'uint16'#
field byte_swap: bool = False#
field word_swap: bool = False#
field long_swap: bool = False#
field scale: ScaleType | None = None#
field bitmap: list[BitDef] | None = None#
field poll: bool = True#
field write_min: float | int | None = None#
field write_max: float | int | None = None#
field write_value_map: dict[str, int | float] | None = None#
field read_group: str | None = None#