Zmod
A macro is a small program written in Klipper/Gcode language.
It can be called from:
- A GCODE file
- The Fluidd/Mainsail console (press the English letter
Cin Fluidd)
Note
The value in parentheses is the default value
CAMERA_ON¶
Enable alternative camera implementation. Parameters:
WIDTH— image width (default:640)HEIGHT— image height (default:480)FPS— frames per second (default:20)VIDEO— video device (default:video0)FS—1= enable frame size limiter for unstable cameras,0= disable (default:0)STREAMER- what streamer to use (auto, mjpg_streamer, ustreamer)FORMAT- Image format for ustreamer: YUYV, YVYU, UYVY, RGB565, RGB24, BGR24, MJPEG, JPEG; default: MJPEG
Disable the camera on the printer's screen before calling this macro.
To enable the camera, use CAMERA_ON VIDEO=video0 or CAMERA_ON VIDEO=video3 or CAMERA_ON VIDEO=video99.

If the camera does not work, check the logs in mod_data/log/cam/
RAM usage for stock cameras:
- 640x480: 2.9 MiB
- 1280x720: 7.8 MiB
- 1920x1080: 18.1 MiB
Many AliExpress/Ozon/Wildberries cameras always consume 18 MiB.
Note
Camera Off Waiting... - this message is displayed if the camera stream is not yet available. The camera starts after Klipper launches, during the global settings information display.
Camera Setup¶
Basic Parameters
| Parameter | Description | Default Value |
|---|---|---|
WIDTH |
Image width | 640 |
HEIGHT |
Image height | 480 |
FPS |
Frames per second | 20 |
VIDEO |
Camera device | video0 |
FS |
Fix problematic cameras (1 – yes, 0 – no) | 0 |
STREAMER |
Program for handling the camera stream | auto |
FORMAT |
Image format (for ustreamer only) | MJPEG |
What is a Streamer?
A streamer is a program that takes the image from the camera and displays it in a browser.
Two options are available:
- mjpg_streamer – a simple program, works only with MJPG cameras
- ustreamer – more powerful but uses more memory; supports various cameras
The STREAMER=auto parameter will automatically choose the suitable streamer.
Image Formats (for ustreamer only)
You can choose: YUYV, YVYU, UYVY, RGB565, RGB24, BGR24, MJPEG, JPEG.
The default is MJPEG.
Command Examples
Simple start of camera video0 via mjpg_streamer:
CAMERA_ON VIDEO=video0
Start camera video0 via ustreamer with custom settings:
CAMERA_ON VIDEO=video0 STREAMER=ustreamer FORMAT=YUYV WIDTH=640 HEIGHT=480
Where to View the Image?
Open in your browser: http://printer_ip_address:8080
There you can adjust brightness, contrast, and other settings.
Troubleshooting
Camera not detected? Run:
CAMERA_ON VIDEO=video99
Logs (error records) are located in the folder: log/cam/
CAMERA_OFF¶
Disable alternative camera implementation.
CAMERA_RESTART¶
Restart the alternative camera implementation.
REMOVE_ZMOD¶
Uninstall Z-Mod.
FULL:0= keep/opt/config/mod_data,1= delete/opt/config/mod_data(default:0)
The /opt/config/mod_data directory stores configurations for zmod, fluidd, moonraker, and mainsail.
It is not deleted by default, because people often call REMOVE_ZMOD by mistake.
Warning! Disable all plugins yourself and switch to the native Klipper.
SKIP_ZMOD¶
Reboot into the original system without starting Z-Mod. Disables Z-Mod, Moonraker, and Fluidd configurations.
Warning! Disable all plugins yourself and switch to the native Klipper.
Remaining active:
- Alternative camera
- SSH
TAR_CONFIG¶
Backup configuration files into an archive. Download the archive via: Configuration → mod_data → config.tar.gz
RESTORE_TAR_CONFIG¶
Restore configurations from the config.tar.gz archive.
Upload the archive to: Configuration → mod_data → config.tar.gz
ZFLASH¶
Update firmware via network using a USB drive.
- Insert the USB drive into the printer and power it on.
- If using without the native screen, ensure the USB is inserted before powering on.
- This macro checks for the latest release, downloads it to the USB, verifies the MD5 hash, and installs it after reboot.
STOP_ZMOD¶
Unload guppy, helix, rivet, moonraker, and fluidd/Mainsail from memory. The Telegram bot will also stop working.
Parameters:
- SCREEN (0 - do not unload, 1 - unload)
- MOONRAKER (0 - do not unload, 1 - unload)
- HTTP (0 - do not unload, 1 - unload)
Example:
STOP_ZMOD SCREEN=1 MOONRAKER=0 HTTP=0
If this line is added to the start code, GUPPY/HELIX/RIVET will be unloaded from memory after the print starts.
START_ZMOD¶
Re-enable guppy, helix, rivet, moonraker, and fluidd/Mainsail after STOP_ZMOD.
Parameters:
- SCREEN (0 - do not load, 1 - load)
- MOONRAKER (0 - do not load, 1 - load)
- HTTP (0 - do not load, 1 - load)
Example:
START_ZMOD SCREEN=1 MOONRAKER=0 HTTP=0
If this line is added to the end code, GUPPY/HELIX/RIVET will be launched after the print finishes.
ZSSH_ON¶
Enable SSH tunneling. Parameters:
SSH_SERVER— remote SSH server IP/hostnameSSH_PORT— SSH port (default:22)SSH_USER— remote server usernameVIDEO_PORT— remote server port for video streaming (default:8080)MOON_PORT— remote server port for Moonraker (default:7125)REMOTE_RUN— command to execute on the remote server (default:"NONE"). Example: Use the ff5m.sh script:./ff5m.sh bot1(located inmod/telegram/) to restart the Telegram bot.
Setup script (if not installed via one-command):
su - tbot # Switch to the bot service user
wget --cache=off -q -O ff5m.sh https://raw.githubusercontent.com/ghzserg/zmod_ff5m/refs/heads/main/telegram/ff5m.sh
chmod +x ff5m.sh
Example usage in Fluidd/Mainsail console:
ZSSH_ON SSH_SERVER=remote.server.ru SSH_PORT=22 SSH_USER=tbot VIDEO_PORT=8080 MOON_PORT=7125 REMOTE_RUN="./ff5m.sh bot1"
SSH starts 3 minutes after Klipper boots and automatically restarts at the beginning of prints (via START_PRINT macro).
ZSSH_OFF¶
Disable SSH client.
ZSSH_RESTART¶
Restart the SSH client.
ZSSH_RELOAD¶
Reload SSH client if not running.
This macro is triggered at the start of prints (via START_PRINT).
ZRESTORE¶
Resume printing after power loss or printer errors.
Requirements:
- Native screen must be disabled (native recovery conflicts with ZRESTORE).
- Printed filename must not start with a number.
ZLINK¶
Connect to the cloud zmod.link
- The cloud allows you to manage the printer via Fluidd or Mainsail from anywhere.
- Memory usage on the printer increases by 1 MB.
- Data is transmitted from the printer to the cloud using encryption.
- Access to the cloud from anywhere also uses encryption.
- The user only sees their own printers and cannot connect to others.
- Access to user printers is protected by login and password
How to get login and password:
- Connect to the bot @zmod_help_bot
- Enter the command
cloud- if you have registered before, it will tell you your login - To register a user with the name
test, enter:cloud register test - To reset the password, enter:
cloud reset_password - To remove the current user, enter:
cloud remove
If Telegram is not available:
- Open vk.com/zmod_official
- Send a message to the group
- Enter the command
cloud- if you have registered before, it will tell you your login - To register a user with the name
test, enter:cloud register test - To reset the password, enter:
cloud reset_password - To remove the current user, enter:
cloud remove
How to connect to the cloud zmod.link:
- Go to the website zmod.link and enter your login and password

- Click the "Add Printer" button

- Open the printer in a separate tab and in the printer console, enter the command
ZLINK

- Copy the key to the clipboard - it is highlighted in the screenshot
- Enter the printer name and the key you copied in the previous step
Example:
testprinterecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDxX5XzNDXg+sbTArdiOzFpMtHXzgAhfC2N2ogS4TUsQYV4AD6HfSFL3J4ISNZ2DgesZf35rfH1I/qI2ckQVGlE=

Click the "Add Printer" button
- Copy the command provided by the website and paste it into the printer console

In the example: zlink p=testprinter u=test m=10006 c=30006
Click the I have already pasted the string into the printer button
After this, the printer will be able to connect to the cloud.
To disable the connection, enter ZLINK_OFF
- Now you have the ability to connect to Fluidd or Mainsail via the internet

Just select the desired button.
PS: The camera may load later than the interface — this is normal.
PPS: If something is not working correctly, refresh the page with Ctrl + F5 and go to zmod.link

