Skip to main content

How can we help?

MQTT Constants and Variables

You are here:
< All Topics

Overview

MQTT variables are used to hold data retrieved from MQTT brokers. Variables must exist in DataXchange and then be mapped to MQTT nodes within the broker. Availability and results of the variables will change based on the machine and the mappings chosen, so it cannot be guaranteed that each variable below will return the data stated or any data at all.

MQTT Source Variables

DataXchange is shipped with the following variables predefined:

Variable NameNotes
Alarm Code [MQTT.alarm_code]Returns the alarm code without the description More Information
Alarm Detail [MQTT.alarm_detail]Returns the alarm description
Alarm Status [MQTT.alarm_status]Returns whether or not the equipment is in an alarm
Capture MTC Alarms [MQTT.alarms]Used to capture all MQTT alarms including those that go off simultaneously
Availability
[MQTT.Availability]
Returns the Availability value.
Connect Time [MQTT.connect_time]Returns the time of the most recent connection to the MQTT Source
Connected Time [MQTT.connected_time]Returns the amount of time in seconds since a successful connection to the Source.
Controller Mode
[MQTT.controller_mode]
Return the identifier of the current controller mode.
Cycle Status [MQTT.cycle_status]Return the cycle status. ACTIVE = Cycling
Door State
[MQTT.door_state]
Returns whether the machine door is open or closed
Estop
[MQTT.estop]
Returns whether the machine is currently in an Emergency Stop
Feed Rate Override [MQTT.feedrate_override]Returns the override of the selected axis
Part Count [MQTT.part_count]Returns the value of the part counter on the control
Part Number [MQTT.part_number]{??}Returns a string from a comment within the NC program  More Information
Path Feed Rate
[MQTT.path_feedrate]
Returns the current feed rate of the controlled axis
Program Number [MQTT.program_number]Returns the active program number from the control
Spindle Load [MQTT.spindle_load]Returns the load of the selected spindle
Spindle Override [MQTT.spindle_override]Returns the override of the selected spindle
Spindle Speed [MQTT.spindle_speed]Returns the speed of the selected spindle
X Axis Feedrate
[MQTT.x_axis_feedrate]
Returns the speed of the selected spindle
Y Axis Feedrate [MQTT.y_axis_feedrate]Returns the speed of the selected spindle
Z Axis Feedrate [MQTT.z_axis_feedrate]Returns the speed of the selected spindle

The following variables hold the value for the previous poll from the Control.

Variable NameNotes
Alarm Status (Previous)Returns the previous value of Alarm Status
Alarm Detail (Previous)Returns the previous value of Alarm Detail
Alarm Status (Previous)Returns the previous value of Alarm Status
MQTT Alarms (Previous)Returns the previous value of Alarms
Availability (Previous)Returns the previous value of Availability
Connect Time (Previous)Returns the previous value of Connect Time
Connected Time (Previous)Returns the previous value of Connected Time
Controller Mode (Previous)Returns the previous value of Controller Mode
Cycle Status (Previous)Returns the previous value of Cycle Status
Door State (Previous)Returns the previous value of Door State
Estop (Previous)Returns the previous value of Estop
Feed Rate Override (Previous)Returns the previous value of Feed Rate Override
Part Count (Previous)Returns the previous value of Part Count
Part Number (Previous)Returns the previous value of Part Number
Path Feed Rate (Previous)Returns the previous value of Path Feed Rate
Program Number (Previous)Returns the previous value of Program Number
Spindle Load (Previous)Returns the previous value of Spindle Load
Spindle Override (Previous)Returns the previous value of Spindle Override
Spindle Speed (Previous)Returns the previous value of Spindle Speed
X Axis Feedrate (Previous)Returns the previous value of X Axis Feedrate
Y Axis Feedrate (Previous)Returns the previous value of Y Axis Feedrate
Z Axis Feedrate (Previous)Returns the previous value of Z Axis Feedrate

MQTT Constants

Constant NameSyntax
CYCLING[MQTT.CYCLING]

MQTT Custom Variables 

DataXchange has the ability to create custom variables for the MQTT source.  Use this feature to create a custom mapping to a data variable that the MQTT machine may not map to by default. The first step is to create the custom variable.

Creating MQTT Custom Variables

From the DataXchange tab, select Variable, then select the MQTT menu item.

Click Add to create a new variable. Enter a name, which will be used in expressions to refer to the variable. This field is alphanumeric and cannot contain spaces. The Display Name will be used to refer to this variable in most other places and can contain spaces and special characters.

Using MQTT Custom Variables

Once the variables have been defined they need to be mapped to MQTT data items.  The mapping is done at an individual equipment level since this may vary from equipment to equipment. To map a variable, select a machine from the Equipment List. Select Communication and modify the MQTT Source. Custom variables are then mapped like any other default variable. The custom variables are at the bottom of the list of variable mappings.

Once the variable is mapped it will return data in expressions. An expression variable will be added for each custom variable

Variable NameNotes
Custom Variable[MQTT.CustomVariableName]Returns the data from the custom mapping variable

Note: Replace “CustomVariableName” with the actual Name of the Custom Variable.

The following variables hold the value for the previous poll from the Control.

Variable NameSyntax
Custom Variable (Previous)[MQTT.prev_CustomVariableName]

Note: Replace “CustomVariableName” with the actual Name of the Custom Variable.

Table of Contents