anycubic-lan
Talk to an Anycubic 3D printer in LAN Mode, directly on your network: no Anycubic account, no cloud.
A printer with LAN Mode switched on runs its own MQTT broker. This library performs the printer's handshake to get the broker credentials, connects, asks for state, parses the reports into typed objects, and sends the commands the printer accepts locally. It is fully async and has no cloud code and no bundled certificates or keys.
Tested on a Kobra S1 (firmware 2.7.2.7). Reports from a Kobra X (firmware 2.0.2.2) informed the parser.
Install
pip install anycubic-lan
Python 3.13 or later. Dependencies: aiohttp, paho-mqtt, cryptography.
Switch LAN Mode on at the printer first: Settings → Network → LAN Mode. While LAN Mode is on the printer is not connected to the Anycubic cloud.
Usage
import asyncio
import aiohttp
from anycubic_lan import AnycubicLanClient, AnycubicLanError, handshake
async def main() -> None:
async with aiohttp.ClientSession() as session:
info = await handshake(session, "192.168.1.50") # the printer's IP
print(info.model_name, info.device_id)
client = AnycubicLanClient(info)
client.add_state_listener(
lambda state: print(state.status, state.temperatures.nozzle, state.job)
)
# Fires on changes after connect(): False when lost, True when restored.
client.add_connection_listener(lambda up: print("restored" if up else "lost"))
await client.connect() # subscribes and sends every query
try:
for _ in range(4):
await asyncio.sleep(15)
await client.query_all() # the printer answers queries; poll them
await client.light_on()
except AnycubicLanError as err:
print("printer error:", err)
finally:
await client.disconnect()
asyncio.run(main())
handshake()raisesPrinterUnreachableError,LanModeDisabledError,UnsupportedPrinterError,RequestRejectedErrororInvalidResponseError(all subclasses ofAnycubicLanError).client.stateis an immutablePrinterStatemerged from every report: status, temperatures, fans, speed mode, firmware, the current job (progress, layers, times, task id), ACE boxes and slots, lights, head position, capability flags, camera URL and the last printer error code.- Commands:
pause(),resume(),stop()(for the current job),light_on(),light_off(),set_light_brightness(). - The broker credentials rotate when the printer restarts. They are held in memory only; if the connection does not come back, run the handshake again.
Supported printers
| Model | Model id | Status |
|---|---|---|
| Kobra S1 | 20025 | Tested (firmware 2.7.2.7, with ACE Pro) |
| Kobra X | 20030 | Parser informed by user logs (firmware 2.0.2.2) |
Other models that offer LAN Mode with the same handshake should work and are reported as "Anycubic printer (model <id>)". Older models (Kobra 2 and earlier) are detected and refused as unsupported.
Status
Version 0.1.0, alpha. The specification in docs/ comes first; the
implementation follows it. Questions to the specification team and their
answers are in docs/QUESTIONS.md. See
docs/CLEAN-ROOM.md for how this library was written
and by whom.
Development
pip install -e ".[test]" ruff mypy
ruff check . && ruff format --check .
mypy --strict src
pytest
Licence
MIT.
Metadata
Release files for anycubic-lan 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| anycubic_lan-0.1.3.tar.gz | 68.7 kB | With provenance | Details for anycubic_lan-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anycubic_lan-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for anycubic_lan-0.1.3-py3-none-any.whl |
Total release size: 98.7 kB
Release files / anycubic_lan-0.1.3.tar.gz
| Download URL | anycubic_lan-0.1.3.tar.gz |
|---|---|
| Size | 68.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec1e907ed945fc63e4113925631792523dec1bdf1bab1948233ee640ee792d44
|
|
BLAKE2b-256 checksum How to use checksums |
5f7438220e2f8ca45bf13dfe0fc61519649b7584bc462531883b82801e6e2b94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / anycubic_lan-0.1.3-py3-none-any.whl
| Download URL | anycubic_lan-0.1.3-py3-none-any.whl |
|---|---|
| Size | 30.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79a28ea9770b119b00492bdb037d3870207fb90a76401908e84597d2621f181e
|
|
BLAKE2b-256 checksum How to use checksums |
0c5ee120fab1c83b2fe9cde1af2a705dc5701d64cdf472e377c0a3a0b90ac716
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logSecurity for anycubic-lan 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for anycubic_lan-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.