Skip to content

Conversation

@zhongys-c8y
Copy link
Contributor

@zhongys-c8y zhongys-c8y commented Oct 27, 2025

Now the set_register and set_coil support two kinds of payload, one legacy c8y operation payload with full register info that saved by c8y cloud Fieldbus; one new simple operation payload that only includes registerid/coilid and value.

To be able to handle the new simple payload, the device identity will be extracted from the te topic. devices.toml now has 'name' field for register and coil to help locate the corresponding register or coil.

Now the plugin can also write float value to a register but only with the simple payload.

Added some tests into the tests/modbus_reader/operations.robot, it's working fine locally.

@github-actions
Copy link

github-actions bot commented Oct 27, 2025

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
24 0 0 24 100 44.271359999s

Passed Tests

Name ⏱️ Duration Suite
Device should support the operation c8y_ModbusConfiguration 0.109 s Device
Set values via c8y_ModbusConfiguration Operation 2.353 s Operation
Poll rate and transmit rate should be updated for the Device 0.200 s Operation
Poll rate and transmit rate should be updated on the Device 2.338 s Operation
Device should support the operation c8y_ModbusDevice 0.107 s Device
Device should support the operation c8y_SerialConfiguration 0.132 s Device
Set values via c8y_SerialConfiguration Operation 2.337 s Operation
Serial configuration should be updated for the Device 0.201 s Operation
Serial configuration should be updated on the Device 2.342 s Operation
Device should have installed software tedge-modbus-plugin 0.140 s Debian
Service should be active 2.346 s Debian
ReInstall Modbus Plugin 20.682 s Debian
Device should have the fragment c8y_ModbusConfiguration 0.215 s Device
ChildDevice TestCase1 should be created 0.209 s Device
ChildDevice TestCase1 should have the fragment c8y_ModbusDevice 0.520 s Device
Service tedge-modbus-plugin should be enabled 0.108 s Device
Device should set supported operations for writing to registers and coils 0.103 s Operations
Device should write to a register using explicit address format 2.351 s Operations
Device should write to a register referenced by name 2.356 s Operations
Device should write float value to register referenced by name 2.348 s Operations
Device should write to a coil 2.346 s Operations
ChildDevice TestCase1 should have a Test.Int16 Measurement 0.214 s Telemetry
ChildDevice TestCase1 should have a Test.Float32 Measurement 0.213 s Telemetry
ChildDevice TestCase1 should have Alarms of type TestAlarm on Coil Value 1 0.001 s Telemetry

@reubenmiller reubenmiller changed the title Support simple cmd payload without register info feat: support simple cmd payload without register info Oct 27, 2025
target_device = {
"protocol": "TCP",
"ip": ip,
"ip": ip_address or "127.0.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't directly related to your change (as you just moved the existing logic), but this line is redundant, as the ip_address will never be false because this block is anyway behind an if statement (e.g. if ip_address)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that's fine, we can leave it as is for now.

Copy link
Contributor

@reubenmiller reubenmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Nice extension, and great to see systems tests

Supports simple cmd payload without register info; made register address 6 and 7 writabl; fixed writing float issue; rename legacy with explicit
@reubenmiller reubenmiller added this pull request to the merge queue Oct 30, 2025
Merged via the queue into thin-edge:main with commit 55b8327 Oct 30, 2025
5 checks passed
@zhongys-c8y zhongys-c8y deleted the azure-payload branch October 30, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants