feat: Add Fichero D11s thermal label printer support with REST API and CLI
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

- Implemented a new module for the Fichero D11s thermal label printer, including BLE and Classic Bluetooth interfaces.
- Created a REST API using FastAPI to manage printer status, info, and printing tasks (text and images).
- Developed a CLI for direct printer interaction, allowing users to print text and images, check status, and modify settings.
- Added image processing capabilities for converting text and images to the required format for printing.
- Introduced error handling for printer operations and connection management.
- Included a shell script for running the API server with configurable parameters.
- Added English translations for configuration options.
- Created a repository metadata file for project management.
This commit is contained in:
2026-03-07 11:52:11 +01:00
parent 43495714e6
commit 14be205eb1
13 changed files with 1318 additions and 1 deletions

29
fichero_printer/run.sh Normal file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -e
declare port
declare ble_address
declare transport
declare channel
port=$(bashio::config 'port')
transport=$(bashio::config 'transport')
channel=$(bashio::config 'channel')
# Pass connection settings to the Python module via environment variables.
# The module reads these at import time, so they must be exported before uvicorn
# imports fichero.api.
export FICHERO_TRANSPORT="${transport}"
export FICHERO_CHANNEL="${channel}"
ble_address=$(bashio::config 'ble_address')
if [ -n "${ble_address}" ]; then
export FICHERO_ADDR="${ble_address}"
bashio::log.info "Using fixed Bluetooth address: ${ble_address}"
else
bashio::log.info "No address configured will auto-scan for printer on first request."
fi
bashio::log.info "Starting Fichero Printer API on 0.0.0.0:${port} (transport: ${transport})..."
exec uvicorn fichero.api:app --host 0.0.0.0 --port "${port}"