MQTT-PUBLISHER(1) | LinuxCNC Documentation | MQTT-PUBLISHER(1) |
mqtt-publisher - send HAL pin data to MQTT broker periodically
loadusr -W mqtt-publisher [options] keys=pin1[,pin2...]
mqtt-publisher is a user space 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.
keys=pin1[,pin2,...]
--dryrun
--mqtt-broker=FQDN
--mqtt-port=PORTNUMBER
--mqtt-user=USERNAME
--mqtt-password=PASSWORD
--mqtt-prefix=PREFIX
mqtt-publisher
mqtt-publisher.enable bit input
mqtt-publisher.period u32 input
mqtt-publisher.lastpublish u32 output
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.
Component and documentation created by Petter Reinholdtsen, as part of the LinuxCNC project.
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.
02/10/2023 | LinuxCNC |