Skip to content

Conversation

@zhongys-c8y
Copy link
Contributor

Added set_coil.py and set_register.py under tedge_modbus for writing values to modbus. One for register, one for coil. In the reader.py, added on_message function to subscribe to the tedge local MQTT topics of child devices' operations. The operation payload was based on the internal docs 'cloud fieldbus specification'. The c8y operation will be first mapper from c8y/devicecontrol/notifications topic to tedge local topics by using tedge custom operation template.

It was tested with the simulator in this project. It can successfully change the register and coil value.

@zhongys-c8y zhongys-c8y changed the title Add write operation handlers for coils and registers feat: Add write operation handlers for coils and registers Sep 30, 2025
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. Thanks for the nice contribution. We can extend the documentation for this feature in a new PR.

FYI: We created a new PR from #37 to clean up the history and reworked the fork's main branch.

@github-actions
Copy link

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
22 0 0 22 100 44.264329s

Passed Tests

Name ⏱️ Duration Suite
Device should support the operation c8y_ModbusConfiguration 0.170 s Device
Set values via c8y_ModbusConfiguration Operation 2.456 s Operation
Poll rate and transmit rate should be updated for the Device 0.270 s Operation
Poll rate and transmit rate should be updated on the Device 2.495 s Operation
Device should support the operation c8y_ModbusDevice 0.146 s Device
Device should support the operation c8y_SerialConfiguration 0.147 s Device
Set values via c8y_SerialConfiguration Operation 2.467 s Operation
Serial configuration should be updated for the Device 0.269 s Operation
Serial configuration should be updated on the Device 2.451 s Operation
Device should have installed software tedge-modbus-plugin 0.159 s Debian
Service should be active 2.458 s Debian
ReInstall Modbus Plugin 23.698 s Debian
Device should have the fragment c8y_ModbusConfiguration 0.294 s Device
ChildDevice TestCase1 should be created 0.281 s Device
ChildDevice TestCase1 should have the fragment c8y_ModbusDevice 0.706 s Device
Service tedge-modbus-plugin should be enabled 0.146 s Device
Device should set supported operations for writing to registers and coils 0.142 s Operations
Device should write to a registers 2.467 s Operations
Device should write to a coil 2.463 s Operations
ChildDevice TestCase1 should have a Test.Int16 Measurement 0.291 s Telemetry
ChildDevice TestCase1 should have a Test.Float32 Measurement 0.288 s Telemetry
ChildDevice TestCase1 should have Alarms of type TestAlarm on Coil Value 1 0.001 s Telemetry

@reubenmiller reubenmiller added this pull request to the merge queue Sep 30, 2025
Merged via the queue into thin-edge:main with commit cf33c8e Sep 30, 2025
5 checks passed
@zhongys-c8y zhongys-c8y deleted the feature-backup-write-operations branch September 30, 2025 08:43
zhongys-c8y added a commit to zhongys-c8y/modbus-plugin that referenced this pull request Sep 30, 2025
zhongys-c8y added a commit to zhongys-c8y/modbus-plugin that referenced this pull request Sep 30, 2025
…p-write-operations

Add readme for writing operations

Co-Authored-By: Reuben Miller <[email protected]>
zhongys-c8y added a commit to zhongys-c8y/modbus-plugin that referenced this pull request Sep 30, 2025
…-operations

Add readme for writing operations

Co-Authored-By: Reuben Miller <[email protected]>
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