mkswifi
Asyncio client for 3D printers fitted with a Makerbase MKS WIFI module (MKS Robin boards). Pure standard library, fully typed, built to back a Home Assistant integration.
Known to work with the Wanhao D12 (firmware TFT24). Other MKS Robin printers that
use the same module (Two Trees, Flying Bear, ...) should work too.
Install
pip install mkswifi
Python 3.12 or newer, no dependencies.
Usage
import asyncio
from mkswifi import MksWifiClient, MksWifiConnectionError
async def main() -> None:
client = MksWifiClient("192.168.1.42") # port 8080, timeout 5 s by default
try:
status = await client.get_status()
except MksWifiConnectionError as err:
print(f"printer unreachable: {err}")
return
print(status.state, status.nozzle, status.bed, status.file_name, status.elapsed)
print(await client.get_firmware()) # "TFT24"
asyncio.run(main())
Each call opens a connection, sends its queries, reads the replies and closes. The module
accepts very few clients at once (a slicer such as Cura's MKS plugin may already hold
one), so nothing stays connected. MksWifiConnectionError is raised when the printer
cannot be reached or sends nothing before the timeout; when only some replies arrive, the
missing fields of PrinterStatus are None.
Only read-only queries are ever sent.
Protocol
Raw TCP on port 8080, one G-code per line ending in \r\n. Each command is answered with
ok and a reply line, in any order; the printer also sends temperature lines on its own.
| Command | Reply | Field(s) |
|---|---|---|
M105 |
T:200 /200 B:59 /60 T0:200 /200 T1:200 /0 @:0 B@:0 |
nozzles, nozzle, bed |
M997 |
M997 IDLE / M997 PRINTING / M997 PAUSE |
state |
M27 |
M27 0 |
progress (percent) |
M994 |
M994 1:/stacked.gcode;2013404224 |
file_name, file_size |
M992 |
M992 00:18:28 |
elapsed |
M115 |
FIRMWARE_NAME:TFT24 |
get_firmware() |
Caveats
- Progress is always 0 on the Wanhao D12's
TFT24firmware, even mid-print:M27is answered but never updated. Usestateandelapsedinstead. - The file size from
M994can be nonsense (2 GB for a small file); it is passed on as is. - Single-nozzle printers may still report a
T1with a target of 0; nozzles are exposed as reported, andstatus.nozzleis nozzle 0.
License
MIT
Metadata
Release files for mkswifi 0.1.0
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 |
|---|---|---|---|---|
| mkswifi-0.1.0.tar.gz | 11.0 kB | With provenance | Details for mkswifi-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkswifi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mkswifi-0.1.0-py3-none-any.whl |
Total release size: 19.3 kB
Release files / mkswifi-0.1.0.tar.gz
| Download URL | mkswifi-0.1.0.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca0f212fb5c718256fc7722ea7906d23edb0da39b23e5a635b767cda8edd6e68
|
|
BLAKE2b-256 checksum How to use checksums |
35c7836ab8ed6f48ade8206ae7cde8dbb5a6678f551a250fe00655e308477f03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 16, 2026.
Transparency logRelease files / mkswifi-0.1.0-py3-none-any.whl
| Download URL | mkswifi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
012d0323f5d022cba2a180e107bcfea1eed5c2636f67329515e9a40eb326fa6d
|
|
BLAKE2b-256 checksum How to use checksums |
8961f413fbce9823b9217db5a4aa4b3178f45b4640fcee9e3752d4e60aebc7d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 16, 2026.
Transparency logSecurity for mkswifi 0.1.0
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 mkswifi-0.1.0.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 16, 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.