Skip to main content

Python library for controlling Phomemo M03AS / YinXianSen thermal printers via USB or BLE

Project description

phomemo-m03as-lib

Python library for controlling Phomemo M03AS / YinXianSen 300 DPI thermal printers via USB or Bluetooth.

Features

  • USB serial connection (recommended, stable)
  • Bluetooth BLE connection (optional)
  • Auto-detect: tries USB first, falls back to BLE
  • Print text (Chinese/English, auto word-wrap)
  • Print images (Floyd-Steinberg dithering + gamma correction)
  • Supports 15mm / 53mm / 80mm paper widths

Install

# USB only (recommended for Home Assistant)
pip install phomemo-m03as-lib

# With Bluetooth support
pip install "phomemo-m03as-lib[ble]"

Quick Start

import asyncio
from phomemo import M03ASPrinter

async def main():
    # Auto-detect: USB first, fallback to BLE
    printer = M03ASPrinter(
        target="auto",
        paper="80mm",
        ble_address="9D:86:57:63:34:DD",  # fallback BLE address
    )
    async with printer:
        await printer.print_text("Hello, 印先森!")
        await printer.print_image("photo.jpg")

asyncio.run(main())

Protocol

Uses M04 ESC/POS extended protocol (300 DPI), reverse-engineered from the phomymo open-source project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phomemo_m03as_lib-0.1.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phomemo_m03as_lib-0.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file phomemo_m03as_lib-0.1.0.tar.gz.

File metadata

  • Download URL: phomemo_m03as_lib-0.1.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for phomemo_m03as_lib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7f50cf0adf110cdc6e9abce6ef1cd57b6410a2293377991d6197c05c3fc353fb
MD5 fcf8109db62360f2ccd7dfa04fa09275
BLAKE2b-256 ff4d498c8ab7ba3da1f92aa091e0fd24d7caee18a66e0c0c2509c019a09fc1a4

See more details on using hashes here.

File details

Details for the file phomemo_m03as_lib-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for phomemo_m03as_lib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b104466949270ddc484ad0737c74e057383d04ea3f7c5e3adf786e271ee9b8e0
MD5 cb38c784cab1b8c9d28269a113c88134
BLAKE2b-256 dfdd5f76c15f0fa1e6dc9e9c47d0363b6fbd83ef8b6e9ddca5103691a2315b80

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page