Duet integration with NodeRed (Home Automation / Print Farms)
-
Sharing this in case anyone is interested in integrating their Duet based printer with other systems via NodeRed. Here is an overview of NodeRed in case you are not familiar. Basically it's a cross-platform flow-based programming interface used to integrate disparate systems and hardware and is heavily used in DIY home automation systems. It's based on javascript and has very low overhead, so it runs well on a raspberry pi.
For example, you could use NodeRed to send text, email or push notifications on the printer's status, print time remaining or printer faults on your phone or computer. NodeRed is extremely flexible and also includes a web-based dashboard interface that can be used to display the received info without requiring any other software.
In my case, NodeRed queries the Duet, parses the received JSON message and transmits it via MQTT to my home automation system (HomeSeer). HomeSeer then presents the printer status on tablets throughout my house. This could be easily expanded to several dozen or hundred printers to provide an overview of an entire print farm.
This flow screenshot below provides a basic overview of how I'm integrating NodeRed with a Duet. At this point, I am only using NodeRed to provide printer status. NodeRed does not control the printer, although it could very easily.
-
I'll use this second message to post flows that can be imported into NodeRed.
This flow will create the NodeRed nodes in the screenshot above. It pings the Duet and only queries the rr_status page if the Duet responds. The response is then parsed, several of the values (such as homed) are translated into human-readable text (such as yes) then transmitted to the MQTT broker.
NodeRed Duet MQTT Flow.txt -
Thanks for sharing!
I have an application that this might solve. I've been playing with Python to try and achieve it but this certainly looks like it would be much simpler and I didn't even know it existed. Will get to playing with it immediately! -
Thank you so much for this.
Took some getting used to it, but it works very well! Now I just need to figure out how to format the email I made it send.