Beispiel #1
0
def init_printer(vendorId, machineId, printId):
    printer = EpsonPrinter(vendorId, machineId, printId)
    printer.center()
    printer.bold_on()
    printer.set_print_speed(2)

    return printer
Beispiel #2
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the cartridge sensor."""
    host = config.get(CONF_HOST)
    from epsonprinter import EpsonPrinter
    """Set up the printer API."""
    api = EpsonPrinter(host)

    sensors = [
        EpsonPrinterCartridge(hass, api, condition)
        for condition in config[CONF_MONITORED_CONDITIONS]
    ]

    add_devices(sensors, True)
Beispiel #3
0
import sys

if __name__ == '__main__':

    parser = OptionParser()
    parser.add_option("-v",
                      "--idvendor",
                      action="store",
                      type="int",
                      dest="id_vendor",
                      help="The printer vendor id")
    parser.add_option("-p",
                      "--idProduct",
                      action="store",
                      type="int",
                      dest="id_product",
                      help="The printer product id")
    options, args = parser.parse_args()
    if not options.id_vendor or not options.id_product:
        parser.print_help()
    else:
        printer = EpsonPrinter(options.id_vendor, options.id_product)

        printer.print_text("Following is a bitmap")
        printer.linefeed()
        printer.print_image_from_file("horse-drawing.jpg")
        printer.linefeed()
        printer.print_text("Feeding paper 10 lines before cutting")
        printer.linefeed(5)
        printer.cut()
        sys.exit(1)