Files
Fichero/fichero_printer/run.sh
Tobias Leuschner 14be205eb1
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled
feat: Add Fichero D11s thermal label printer support with REST API and CLI
- 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.
2026-03-07 11:52:11 +01:00

30 lines
941 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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}"