mqtt-publisher(1)
| MQTT-PUBLISHER(1) | LinuxCNC Documentation | MQTT-PUBLISHER(1) |
NAME
mqtt-publisher - send HAL pin data to MQTT broker periodically
SYNOPSIS
loadusr -W mqtt-publisher [options] keys=pin1[,pin2...]
DESCRIPTION
mqtt-publisher is a non-realtime program that reads HAL values periodically and passes the values to a MQTT broker.
When specifying the MQTT settings in the INI file, this is the recommended setup:
HAL file:
loadusr -W mqtt-publisher [MQTT]DRYRUN --mqtt-broker=[MQTT]BROKER \
--mqtt-user=[MQTT]USERNAME --mqtt-password=[MQTT]PASSWORD keys=halui.estop.is-activated
INI file:
[MQTT] DRYRUN = --dryrun BROKER = broker.local USERNAME = username PASSWORD = password
This component need the Paho python library installed to function. On debian this is available from the python3-paho-mqtt package.
OPTIONS
keys=pin1[,pin2,...]
--dryrun
--mqtt-broker=FQDN
--mqtt-port=PORTNUMBER
--mqtt-user=USERNAME
--mqtt-password=PASSWORD
--mqtt-prefix=PREFIX
FUNCTIONS
mqtt-publisher
PINS
mqtt-publisher.enable bit input
mqtt-publisher.period u32 input
mqtt-publisher.lastpublish u32 output
EXAMPLES
Any set of HAL pins and signals can be published. This setup might be a useful starting point:
loadusr -W mqtt-publisher [MQTT]DRYRUN --mqtt-broker=[MQTT]BROKER
--mqtt-user=[MQTT]USERNAME --mqtt-password=[MQTT]PASSWORD
keys=halui.axis.a.pos-feedback,halui.axis.b.pos-feedback,
halui.axis.c.pos-feedback,halui.axis.u.pos-feedback,
halui.axis.v.pos-feedback,halui.axis.w.pos-feedback,
halui.axis.x.pos-feedback,halui.axis.y.pos-feedback,
halui.axis.z.pos-feedback,halui.estop.is-activated,
halui.joint.0.is-homed,halui.joint.1.is-homed,halui.joint.2.is-homed,
halui.joint.3.is-homed,halui.joint.4.is-homed,halui.joint.5.is-homed,
halui.joint.6.is-homed,halui.joint.7.is-homed,halui.joint.8.is-homed,
halui.machine.is-on,halui.max-velocity.value,halui.mode.is-auto,
halui.mode.is-manual,halui.mode.is-mdi,halui.mode.is-teleop,
halui.program.is-running'
Note, the list of keys can not include space after comma. The lines are only broken here to avoid too long lines in the documentation.
SEE ALSO
hal(3hal)
AUTHOR
Component and documentation created by Petter Reinholdtsen, as part of the LinuxCNC project.
COPYRIGHT
Copyright © 2023 Petter Reinholdtsen. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
| 04/26/2024 | LinuxCNC |
