Rehearse with a simulated machine
A 3D printer on the lineStep 7 of 7Unloaded, or a decision for a person
The printer is at the office. The engineer is not.
A simulated printer on the compose network speaks the same MQTT and FTPS as the real one, so the whole route runs, and fails on cue, with no printer.
The situation
Testing a line against real hardware means being next to the hardware, and making it fail on purpose means pulling a spool. A simulated machine should look the same on the network, so nothing else changes, and fail on request. Here the bambu-sim profile runs one.
The setup
Point .env at the simulated printer:
BAMBU_SITE_ID=site-1BAMBU_LINE_ID=print-1BAMBU_PRINTERS=p1s-01BAMBU_P1S_01_SERIAL=01P00A000000001BAMBU_P1S_01_HOST=bambu-simBAMBU_P1S_01_CODE=12345678BAMBU_P1S_01_ENABLED=true# A print on the simulated printer takes this many secondsBAMBU_SIM_PRINT_SEC=60Start the stack with the profile:
docker compose -f docker-compose.yml -f docker-compose.nats.yml -f docker-compose.machines.yml \ -f docker-compose.bambu.yml --profile bambu-sim up -d --builddocker compose exec long-tail npm run bambu:printbambu-sim serves implicit FTPS on 990 and plays the printer. Its Mosquitto broker shares the same address, on 8883 for bblp and the access code, with a certificate issued to the serial. machine-site reads its CA and renders its bridge, as for a printer. A print takes BAMBU_SIM_PRINT_SEC, 60 by default.
On the floor
Drills on port 8092 play what someone at the printer would do:
curl localhost:8092/ # the printer's state and the files on its storagecurl -X POST localhost:8092/runout # the spool runs out mid-printcurl -X POST localhost:8092/resume # filament loaded, resumed at the printercurl -X POST localhost:8092/occupy # a print started elsewhere takes the printercurl -X POST localhost:8092/vacate # the printer is idle againcurl -X POST localhost:8092/hold -d '{"percent":50}' # progress stops at 50% until releasecurl -X POST localhost:8092/releaserunout raises the servicing alarm and pauses the print escalation. resume clears both. occupy makes the next print a refused one, decided on print-servicing.
The guarantee
The codec, the bridge, the gateway and the route run unchanged against the simulated printer. Only .env names a different host. See Machines.
Related patterns
The physical world
Broken messages become escalations
Step 8 of 12 · A factory line over MQTT
Under a strict codec a message that breaks the contract is confirmed, never acted on, and shown to an operator as an escalation.
The physical world
Offline, quiet and alarm escalations
Step 12 of 12 · A factory line over MQTT
A stopping alarm, a dropped machine and a silent one each become an escalation for the line operator, resolved when the machine recovers.
The physical world
A machine is a resolver
Step 1 of 12 · A factory line over MQTT
A workflow parks an escalation and waits; a machine resolves it over MQTT exactly as a person would from the dashboard.
