Metadata-Version: 2.4
Name: phomemo-m03as-lib
Version: 0.1.0
Summary: Python library for controlling Phomemo M03AS / YinXianSen thermal printers via USB or BLE
Project-URL: Homepage, https://github.com/Maggie1234/phomemo-m03as-lib
Project-URL: Repository, https://github.com/Maggie1234/phomemo-m03as-lib
Author: YinXianSen
License: MIT
Keywords: ble,m03as,phomemo,printer,thermal,usb
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Requires-Python: >=3.9
Requires-Dist: numpy>=1.24.0
Requires-Dist: pillow>=10.0.0
Requires-Dist: pyserial>=3.5
Provides-Extra: ble
Requires-Dist: bleak>=0.21.0; extra == 'ble'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# 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

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

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

## Quick Start

```python
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](https://github.com/transcriptionstream/phomymo) open-source project.
