MTConnect.NET icon indicating copy to clipboard operation
MTConnect.NET copied to clipboard

MT-Connect-MQTT-Relay Example

Open ravirajpspl2023 opened this issue 1 year ago • 2 comments

installing MT-Connect-Mqtt-Relay Example in source code. this MT_Connect agent publish data on external Mqtt-broker so i not know the SHDR adaper is embedded with this agent , if yes then how to configure this or not then how or which is used for this agent

ravirajpspl2023 avatar Feb 09 '24 11:02 ravirajpspl2023

Yes the MTConnect-Mqtt-Relay Agent supports SHDR and can be configured in the agent.config.yaml file below:

# - Device Configuration -
devices: devices

# - SHDR Adapter Configuration -
# The Agent is able to receive data through a TCP port using the SHDR protocol
adapters:
- hostname: localhost
  port: 7878
  reconnectInterval: 1000

# - MQTT Configuration -

# The hostname of the MQTT broker to publish messages to
server: localhost

# The port number of the MQTT broker to publish messages to
port: 1883

Version 6

I will note that there is a new version (Version 6) that combines HTTP, MQTT, and SHDR in a single Agent. I recommend using this as the version 5.x applications will be deprecated. The version 6 agent also uses the new MQTT format.

Version 6 ReadMe: https://github.com/TrakHound/MTConnect.NET/tree/version-6.0/agent/MTConnect.NET-Agent

Version 6 Download: https://github.com/TrakHound/MTConnect.NET/releases/tag/untagged-1926fb8a6fc4ed4c6b60

Version 6 Configuratoin:

# - Device Configuration -
devices: devices

# - Processors -
processors:
- python: # - Add Python Processor
    directory: processors

# - Modules -
modules:
  
- http-server: # - Add HTTP Server module
    hostname: localhost
    port: 5000
    allowPut: true
    indentOutput: true
    documentFormat: xml
    responseCompression:
    - gzip
    - br
    files:
    - path: schemas
    location: schemas
    - path: styles
    location: styles
    - path: styles/favicon.ico
    location: favicon.ico

- mqtt-relay: # - Add MQTT Relay module
    server: localhost
    port: 1883
    currentInterval: 5000
    sampleInterval: 500

- shdr-adapter: # - Add SHDR Adapter module for Device = M12346 and Port = 7878
    deviceKey: M12346
    hostname: localhost
    port: 7878

- shdr-adapter: # - Add SHDR Adapter module for Device = OKUMA-Lathe and Port = 7879
    deviceKey: OKUMA-Lathe
    hostname: localhost
    port: 7879

- mqtt-adapter: # - Add MQTT Adapter module for Device = M12346 and Topic = cnc-01
    deviceKey: M12346
    server: localhost
    port: 1883
    topic: cnc-01


# The maximum number of Observations the agent can hold in its buffer
observationBufferSize: 150000

# The maximum number of assets the agent can hold in its buffer
assetBufferSize: 1000

# Sets whether the Agent buffers are durable and retain state after restart
durable: false

# Sets the default MTConnect version to output response documents for.
defaultVersion: 2.2

PatrickRitchie avatar Feb 09 '24 17:02 PatrickRitchie

Hi Patrick,

Thank you for your message! I really appreciate your quick response. i am use your adapter to connect with my fanuc cnc controller through a focas but not getting data how to configar adapter to connect my fanuc cnc and get basic data from cnc controller and display external MQTT broker

ravirajpspl2023 avatar Feb 14 '24 05:02 ravirajpspl2023