Skip to content

Add Modbus function 16 word order regression coverage#2134

Open
ilyar wants to merge 2 commits into
thingsboard:masterfrom
ever-guild:fix/modbus-function16-word-order
Open

Add Modbus function 16 word order regression coverage#2134
ilyar wants to merge 2 commits into
thingsboard:masterfrom
ever-guild:fix/modbus-function16-word-order

Conversation

@ilyar

@ilyar ilyar commented May 25, 2026

Copy link
Copy Markdown

Summary

Adds regression coverage for Modbus RPC writes using function code 16 with multi-register values.

The tests verify that wordOrder is preserved when values are encoded for device RPC writes:

  • 32int with BIG word order writes [0x1234, 0x5678]
  • 32int with LITTLE word order writes [0x5678, 0x1234]
  • 32float with BIG word order writes [0x4145, 0x70A4]
  • 32float with LITTLE word order writes [0x70A4, 0x4145]

The routing-level test also uses the issue-shaped setValue configuration with functionCode: 16, objectsCount: 2, and address: 4.

This covers the behavior reported in #1275 without changing runtime logic. Current master already produces the expected register order for this path, so the PR documents and protects the behavior with focused unit tests.

Validation

  • .venv/bin/python -m pytest tests/unit/connectors/modbus/test_device_server_side_rpc.py - 11 passed
  • .venv/bin/python -m pytest tests/unit/connectors/modbus - 34 passed

@CLAassistant

CLAassistant commented May 25, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the bug label May 25, 2026
@ilyar ilyar marked this pull request as ready for review May 25, 2026 16:34
@ilyar ilyar marked this pull request as draft May 25, 2026 16:35
@ilyar ilyar marked this pull request as ready for review May 25, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Multiple registers write (function 16) uses wrong endianness convention

3 participants