diff --git a/README.md b/README.md index 0c4d666..06e87d3 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,14 @@ A range of features are offered for both end-users and developers, making it eas ## Key Features - __SNMP Interface__: Seamlessly connect and manage Epson printers using SNMP over TCP/IP, supporting Wi-Fi connections (not USB). + + Printers are queried via Simple Network Management Protocol (SNMP) with a set of Object Identifiers (OIDs) used by Epson printers. Some of them are also valid with other printer brands. SNMP is also used to manage the EEPROM and read/set specific Epson configuration. + - __Detailed Status Reporting__: Produce a comprehensive printer status report (with options to focus on specific details). - Epson printers produce a status response in a proprietary "new binary format" named @BDC ST2, including a binary data structure which is partially undocumented (such messages - start with `@BDC [SP] ST2 [CR] [LF]` ...). It is used to convey various aspects of the status of the printer, such as errors, paper status, ink and more. The element fields of this format may vary depending on the printer model. The *Epson Printer Configuration Tool* can decode all element fields found in the Epson Programming Manuals publicly available (a subset of fields used by the Epson printers). + Epson printers produce a status response in a proprietary "new binary format" named @BDC ST2, including a data structure which is partially undocumented (such messages + start with `@BDC [SP] ST2 [CR] [LF]` ...). It is used to convey various aspects of the status of the printer, such as errors, paper status, ink and more. The element fields of this format may vary depending on the printer model. The *Epson Printer Configuration Tool* can decode all element fields found in publicly available Epson Programming Manuals of various printer models (a relevant subset of fields used by the Epson printers). + - __Advanced Maintenance Functions__: - Reset the ink waste counter. @@ -23,6 +27,7 @@ A range of features are offered for both end-users and developers, making it eas - Access various administrative and debugging options. - Read and write to EEPROM addresses for advanced configurations. - Dump and analyze sets of EEPROM addresses. + - __User-Friendly Interfaces__: - __Graphical User Interface (GUI)__: Intuitive interface with an autodiscovery function that detects printer IP addresses and model names. - __Command Line Tool__: For users who prefer command-line interactions, providing the full set of features. @@ -433,8 +438,7 @@ import logging logging.basicConfig(level=logging.DEBUG, format="%(message)s") # if logging is needed -printer = EpsonPrinter( - model="XP-205", hostname="192.168.1.87") +printer = EpsonPrinter(model="XP-205", hostname="192.168.178.29") if not printer.parm: print("Unknown printer") @@ -464,6 +468,10 @@ print("get_last_printer_fatal_errors:", ret) ret = printer.get_stats() print("get_stats:", ret) +# Dump all printer parameters +from pprint import pprint +pprint(printer.parm) + printer.reset_waste_ink_levels() printer.brute_force_read_key() printer.write_first_ti_received_time(2000, 1, 2) diff --git a/epson_print_conf.py b/epson_print_conf.py index e08ffac..7c315a7 100644 --- a/epson_print_conf.py +++ b/epson_print_conf.py @@ -683,6 +683,23 @@ class EpsonPrinter: "Power Off Timer": f"{EEPROM_LINK}.111.116.2.0.1.1" } + MIB_INFO_ADVANCED = { + "Printer Status": f"{MIB_MGMT}.1.25.3.5.1.1", # hrPrinterStatus + "Printer Alerts": f"{MIB_MGMT}.1.43.18.1.1.8", # prtAlertDescription + "Printer Marker Supplies Level": f"{MIB_MGMT}.1.43.11.1.1.9", # prtMarkerSuppliesLevel + "Printer Marker Life Count": f"{MIB_MGMT}.1.43.11.1.1.6", # prtMarkerLifeCount + "Input Tray Status": f"{MIB_MGMT}.1.43.8.2.1.10", # prtInputStatus + "Output Tray Status": f"{MIB_MGMT}.1.43.9.2.1.10", # prtOutputStatus + "Printer Description": f"{MIB_MGMT}.1.25.3.2.1.3", # hrDeviceDescr + "Device Identification": f"{MIB_MGMT}.1.43.5.1.1.17", # prtGeneralSerialNumber + "Job Count": f"{MIB_MGMT}.1.43.10.2.1.4", # prtJobEntryJobCount + "Toner Level": f"{MIB_MGMT}.1.43.11.1.1.9.1", # prtMarkerSuppliesLevel + "Error Status": f"{MIB_MGMT}.1.43.16.5.1.2", # prtConsoleDisplayBufferText + "Power On Time": f"{MIB_MGMT}.1.25.3.2.1.5", # hrDeviceUptime + "Device Name": f"{MIB_MGMT}.1.1.5", # sysName + "Device Location": f"{MIB_MGMT}.1.1.6", # sysLocation + } + session: object model: str hostname: str @@ -1421,13 +1438,21 @@ class EpsonPrinter: data_set["unknown"].append((hex(ftype), item)) return data_set - def get_snmp_info(self, mib_name: str = None) -> str: + def get_snmp_info( + self, + mib_name: str = None, + advanced: bool = False + ) -> str: """Return general SNMP information of printer.""" sys_info = {} - if mib_name and mib_name in self.MIB_INFO.keys(): - snmp_info = {mib_name: self.MIB_INFO[mib_name]} + if advanced: + oids = {**self.MIB_INFO, **self.MIB_INFO_ADVANCED} else: - snmp_info = self.MIB_INFO + oids = self.MIB_INFO + if mib_name and mib_name in oids.keys(): + snmp_info = {mib_name: oids[mib_name]} + else: + snmp_info = oids for name, oid in snmp_info.items(): logging.debug( f"SNMP_DUMP {name}:\n"