united-manufacturing-hub / benthos-umh

Apache License 2.0
31 stars 10 forks source link

s7_address returns nil #46

Closed Scarjit closed 5 months ago

Scarjit commented 5 months ago

Using this example benthos config:

data:
  benthos.yaml: |-
    input:
      s7comm:
        tcpDevice: '10.13.37.51' # IP address of the S7 PLC
        rack: 0                  # Rack number of the PLC. Defaults to 0
        slot: 1                  # Slot number of the PLC. Defaults to 1
        batchMaxSize: 480         # Maximum number of addresses per batch request. Defaults to 480
        timeout: 10             # Timeout in seconds for connections and requests. Default to 10
        disableCPUInfo: true # Set this to true to not fetch CPU information from the PLC. Should be used when you get the error 'Failed to get CPU information'
        addresses:               # List of addresses to read from
          #- "DB1.I0"
          #- "DB1.X2.0"
          - "DB1.X8.0"
    pipeline:
      processors:
        - bloblang: |
            root = {
               meta("s7_address"): this,
              "timestamp_ms": (timestamp_unix_nano() / 1000000).floor()
            }
    output:
      mqtt:
        urls: ["united-manufacturing-hub-mqtt:1883"]
        client_id: "f-flatcar.athena@umh.app"
        topic: 'umh/v1/cologne/test/_historian.${! meta("s7_address") }'

meta("s7_address") returns nil