Skip to content

Support Derived / Computed DeviceResource Values #687

Description

@AshishAvesta

🚀 Feature Request

Description

Please consider adding support for derived/computed deviceResources in device-modbus-go, driven by the device profile.

This would be a significant improvement for industrial automation scenarios where computed parameters are essential but not always exposed by Modbus devices.

I would like to request a new feature in device-modbus-go that allows defining derived/computed datapoints inside the device service.

Example use case: The Modbus device exposes two registers:

Register 104 → value A

Register 105 → value B

I want to define a third data point C, which is computed inside the device service (e.g., C = A + B or C = A * B), and then returned as a normal Reading in the Event.

This avoids the building a custom application service just to compute simple arithmetic values that belong at the device layer.

Describe the solution you'd like

Extend device profile schema with a new field, e.g.:

deviceResources:
  - name: c
    valueType: Float64
    readWrite: R
    derivedFrom:
      - a
      - b
    expression: "a + b"

Where:

derivedFrom lists input resources

expression defines the formula (basic arithmetic: +, -, *, /, possibly functions)

Describe alternatives you've considered

Allow derived resources to reference operations instead of raw registers, e.g.:

attributes:
  operation: "sum"
  operands: ["a", "b"]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions