epson_print_conf/README.md

605 lines
24 KiB
Markdown
Raw Normal View History

2023-07-24 08:37:10 -04:00
# epson_print_conf
2024-07-07 09:23:10 -04:00
2023-07-25 10:15:06 -04:00
Epson Printer Configuration tool via SNMP (TCP/IP)
2023-07-24 08:58:19 -04:00
2023-08-02 02:31:34 -04:00
## Features
2024-07-07 09:23:10 -04:00
2024-08-06 01:13:49 -04:00
- Interface Epson printers via SNMP (TCP/IP, with printers connected over Wi-Fi)
2023-08-03 18:15:38 -04:00
- Print the advanced status of the printer, with the possibility to restrict the query to specific information
- Other inspection features:
2023-08-02 02:31:34 -04:00
- Reset ink waste
2023-11-10 18:39:31 -05:00
- Change power off timer
2023-08-03 18:15:38 -04:00
- Other admin stuffs and debug options
2024-07-28 13:15:10 -04:00
- Read and write EEPROM addresses
- Dump a set of EEPROM addresses
2024-08-06 01:13:49 -04:00
- Both a GUI and a command line tool
2023-08-02 02:31:34 -04:00
- Python API interface
2024-08-06 01:13:49 -04:00
The GUI has an autodiscovery function which finds the printer IP addresses and their model names; it can be used to get the printer status, to set the "Power-off timer", to set the "TI Received Time" and to reset the ink waste counter.
2024-08-06 01:13:49 -04:00
The software provides a configurable printer dictionary, which can be easily extended. There is also a tool to import and convert an extensive Epson printer configuration DB.
2023-08-02 02:31:34 -04:00
2023-07-24 09:24:59 -04:00
## Installation
Install requirements using *requirements.txt*:
```bash
git clone https://github.com/Ircama/epson_print_conf
cd epson_print_conf
pip install -r requirements.txt
```
Alternatively, install requirements via command line:
2023-07-24 09:24:59 -04:00
```
git clone https://github.com/Ircama/epson_print_conf
2023-08-08 17:18:54 -04:00
pip3 install pyyaml
2023-08-03 18:09:11 -04:00
pip3 install pyasn1==0.4.8
pip3 install git+https://github.com/etingof/pysnmp.git
2024-07-27 10:36:43 -04:00
pip3 install tkcalendar
pip3 install pyperclip
2023-07-24 09:24:59 -04:00
cd epson_print_conf
```
2024-07-27 10:36:43 -04:00
With Python 12, also: `pip3 install pyasyncore`.
2023-08-03 18:09:11 -04:00
Notes (at the time of writing):
- [before pysnmp, install pyasn1 with version 0.4.8 and not 0.5](https://github.com/etingof/pysnmp/issues/440#issuecomment-1544341598)
- [pull pysnmp from the GitHub master branch, not from PyPI](https://stackoverflow.com/questions/54868134/snmp-reading-from-an-oid-with-three-libraries-gives-different-execution-times#comment96532761_54869361)
2023-08-04 03:47:53 -04:00
This program exploits [pysnmp](https://github.com/etingof/pysnmp), with related [documentation](https://pysnmp.readthedocs.io/).
It is tested with Ubuntu / Windows Subsystem for Linux, Windows.
2023-08-03 18:09:11 -04:00
2023-07-24 09:24:59 -04:00
## Usage
2023-07-24 08:58:19 -04:00
2024-08-06 20:04:04 -04:00
### Running the pre-built GUI executable code
The *epson_print_conf.zip* archive in the [Releases](releases) folder incudes the *epson_print_conf.exe* executable file; the ZIP archive is auto-generated by a [GitHub Action](.github/workflows/build.yml). *epson_print_conf.exe* is a Windows GUI that can be directly executed.
2024-07-28 21:29:30 -04:00
### Running the GUI with Python
2024-08-06 20:04:04 -04:00
Run *ui.py* as in this example:
```
python ui.py
```
2024-07-28 21:29:30 -04:00
GUI usage:
2023-07-24 08:58:19 -04:00
```
2024-07-28 21:29:30 -04:00
ui.py [-h] [-P PICKLE_FILE] [-O]
optional arguments:
-h, --help show this help message and exit
-P PICKLE_FILE, --pickle PICKLE_FILE
2024-07-29 19:18:02 -04:00
Load a pickle configuration archive saved by parse_devices.py
-O, --override Replace the default configuration with the one in the pickle file instead of merging (default
is to merge)
2024-07-28 21:29:30 -04:00
epson_print_conf GUI
```
### Using the command-line tool
```
2024-07-29 19:18:02 -04:00
epson_print_conf.py [-h] -m MODEL -a HOSTNAME [-p PORT] [-i] [-q QUERY_NAME] [--reset_waste_ink] [-d]
[--write-first-ti-received-time YEAR MONTH DAY] [--write-poweroff-timer MINUTES]
[--dry-run] [-R ADDRESS_SET] [-W ADDRESS_VALUE_SET] [-e FIRST_ADDRESS LAST_ADDRESS]
[--detect-key] [-S SEQUENCE_STRING] [-t TIMEOUT] [-r RETRIES] [-c CONFIG_FILE]
[--simdata SIMDATA_FILE] [-P PICKLE_FILE] [-O]
2023-07-24 08:58:19 -04:00
optional arguments:
-h, --help show this help message and exit
-m MODEL, --model MODEL
2023-08-06 11:24:30 -04:00
Printer model. Example: -m XP-205 (use ? to print all supported models)
2023-07-24 08:58:19 -04:00
-a HOSTNAME, --address HOSTNAME
2024-07-28 21:29:30 -04:00
Printer host name or IP address. (Example: -a 192.168.1.87)
2023-08-08 17:18:54 -04:00
-p PORT, --port PORT Printer port (default is 161)
2023-07-31 07:41:37 -04:00
-i, --info Print all available information and statistics (default option)
2023-08-08 17:18:54 -04:00
-q QUERY_NAME, --query QUERY_NAME
2023-08-06 11:24:30 -04:00
Print specific information. (Use ? to list all available queries)
2023-07-24 08:58:19 -04:00
--reset_waste_ink Reset all waste ink levels to 0
-d, --debug Print debug information
2023-08-06 11:34:30 -04:00
--write-first-ti-received-time YEAR MONTH DAY
Change the first TI received time
2023-11-10 18:39:31 -05:00
--write-poweroff-timer MINUTES
2023-11-11 04:28:09 -05:00
Update the poweroff timer. Use 0xffff or 65535 to disable it.
2023-08-08 17:18:54 -04:00
--dry-run Dry-run change operations
-R ADDRESS_SET, --read-eeprom ADDRESS_SET
2023-11-11 04:28:09 -05:00
Read the values of a list of printer EEPROM addreses. Format is: address [, ...]
2023-08-08 17:18:54 -04:00
-W ADDRESS_VALUE_SET, --write-eeprom ADDRESS_VALUE_SET
2024-07-28 21:29:30 -04:00
Write related values to a list of printer EEPROM addresses. Format is: address: value [, ...]
2023-08-08 17:18:54 -04:00
-e FIRST_ADDRESS LAST_ADDRESS, --eeprom-dump FIRST_ADDRESS LAST_ADDRESS
Dump EEPROM
--detect-key Detect the read_key via brute force
-S SEQUENCE_STRING, --write-sequence-to-string SEQUENCE_STRING
2023-07-31 07:41:37 -04:00
Convert write sequence of numbers to string.
2023-08-03 18:09:11 -04:00
-t TIMEOUT, --timeout TIMEOUT
SNMP GET timeout (floating point argument)
-r RETRIES, --retries RETRIES
SNMP GET retries (floating point argument)
2023-08-06 11:19:41 -04:00
-c CONFIG_FILE, --config CONFIG_FILE
2024-07-29 19:18:02 -04:00
read a configuration file including the full log dump of a previous operation with '-d' flag
(instead of accessing the printer via SNMP)
2023-08-08 17:18:54 -04:00
--simdata SIMDATA_FILE
write SNMP dictionary map to simdata file
2024-07-28 21:29:30 -04:00
-P PICKLE_FILE, --pickle PICKLE_FILE
2024-07-29 19:18:02 -04:00
Load a pickle configuration archive saved by parse_devices.py
-O, --override Replace the default configuration with the one in the pickle file instead of merging (default
is to merge)
2023-07-24 08:58:19 -04:00
2023-08-04 03:47:53 -04:00
Epson Printer Configuration via SNMP (TCP/IP)
2023-07-24 08:58:19 -04:00
```
2023-07-24 09:26:35 -04:00
Examples:
2023-07-24 08:58:19 -04:00
2023-11-10 18:39:31 -05:00
```bash
2023-08-08 20:14:15 -04:00
# Print the status information (-i is not needed):
2023-07-24 08:58:19 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -i
2023-07-31 07:41:37 -04:00
# Reset all waste ink levels to 0:
2023-07-24 08:58:19 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 --reset_waste_ink
2023-07-31 07:41:37 -04:00
# Change the first TI received time to 31 December 2016:
2023-07-25 05:49:47 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 --write-first-ti-received-time 2016 12 31
2023-07-24 08:58:19 -04:00
2023-11-10 18:39:31 -05:00
# Change the power off timer to 15 minutes:
python3 epson_print_conf.py -a 192.168.1.87 -m XP-205 --write-poweroff-timer 15
2023-07-31 07:41:37 -04:00
# Detect the read_key via brute force:
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 --detect-key
2023-07-25 05:49:47 -04:00
2023-07-31 07:41:37 -04:00
# Only print status information:
2023-07-25 05:49:47 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -q printer_status
2023-07-31 07:41:37 -04:00
# Only print SNMP 'MAC Address' name:
2023-07-25 05:49:47 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -q 'MAC Address'
2023-07-31 07:41:37 -04:00
# Only print SNMP 'Lang 5' name:
2023-07-25 05:49:47 -04:00
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -q 'Lang 5'
2023-07-31 07:41:37 -04:00
# Write value 1 to the EEPROM address 173 and value 0xDE to the EEPROM address 172:
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -W 173:1,172:0xde
# Read EEPROM address 173 and EEPROM address 172:
python3 epson_print_conf.py -m XP-205 -a 192.168.1.87 -R 173,172
2023-07-24 08:58:19 -04:00
```
2023-09-26 02:09:02 -04:00
Note: resetting the ink waste counter is just removing a warning; not replacing the tank will make the ink spill.
2024-07-29 15:03:03 -04:00
## Creating an executable for the GUI
2024-07-30 02:09:01 -04:00
Alternatively to running the GUI via `python ui.py`, it is possible to build an executable file via *pyinstaller*.
2024-07-29 15:03:03 -04:00
Install *pyinstaller* with `pip install pyinstaller`.
The *epson_print_conf.spec* file helps building the executable program. Run it with the following command.
```bash
pip install pyinstaller # if not yet installed
pyinstaller epson_print_conf.spec -- --default
```
Then run the *epson_print_conf.exe* file created in the *dist/* folder, which has the same options of `ui.py`.
An alternative way to create the executable file named *epson_print_conf.exe* from *ui.py* without using *epson_print_conf.spec* is the following:
```bash
pyinstaller --onefile ui.py --name epson_print_conf --hidden-import babel.numbers --windowed
```
2024-07-31 19:08:37 -04:00
A file named *gui.py* is also included (similar to *ui.py*), which automatically loads a previously created configuration file that has to be named *printer_conf.pickle*, merging it with the program configuration. (See below the *parse_devices.py* utility.) To build the executable program with this file instead of the default *ui.py*, run the following command:
2024-07-29 15:03:03 -04:00
```bash
pip install pyinstaller # if not yet installed
curl -o devices.xml https://codeberg.org/attachments/147f41a3-a6ea-45f6-8c2a-25bac4495a1d
python3 parse_devices.py -a 192.168.178.29 -s XP-205 -p printer_conf.pickle # use your default IP address and printer model as default settings for the GUI
pyinstaller epson_print_conf.spec
```
When the build operation is completed, you can run the *epson_print_conf.exe* file created in the *dist/* folder. This executable program does not have options, embeds the *printer_conf.pickle* file and starts with the default IP address and printer model defined in the build phase.
2024-08-06 20:04:04 -04:00
The executable file is automatically generated by a [GitHub Action](.github/workflows/build.yml). It is included in a ZIP file named *epson_print_conf.zip* and uploaded into the [Releases](releases) folder.
2024-07-07 09:21:39 -04:00
## Utilities and notes
### parse_devices.py
2024-07-31 19:08:37 -04:00
Within a [report](https://codeberg.org/atufi/reinkpy/issues/12#issue-716809) in repo https://codeberg.org/atufi/reinkpy there is an interesting [attachment](https://codeberg.org/attachments/147f41a3-a6ea-45f6-8c2a-25bac4495a1d) which includes an extensive XML database of Epson model features.
2024-07-28 21:29:30 -04:00
The program *parse_devices.py* transforms this XML DB into the dictionary that *epson_print_conf.py* can use.
2024-07-07 09:21:39 -04:00
Here is a simple procedure to download that DB and run *parse_devices.py* to search for the XP-205 model and produce the related PRINTER_CONFIG dictionary to the standard output:
```bash
curl -o devices.xml https://codeberg.org/attachments/147f41a3-a6ea-45f6-8c2a-25bac4495a1d
2024-07-07 18:14:54 -04:00
python3 parse_devices.py -i -m XP-205
```
2024-07-31 19:08:37 -04:00
After generating the related printer configuration, *epson_print_conf.py* shall be manually edited to copy/paste the output of *parse_devices.py* within its PRINTER_CONFIG dictionary. Alternatively, the program is able to create a *pickle* configuration file (check the `-p` lowercase option), which the other programs can load (with the `-P` uppercase option and in addition with the optional `-O` flag).
2024-07-28 13:17:22 -04:00
The `-m` option is optional and is used to filter the printer model in scope. If the produced output is not referred to the target model, use part of the model name as a filter (e.g., only the digits, like `parse_devices.py -i -m 315`) and select the appropriate model from the output.
2024-07-07 09:21:39 -04:00
Program usage:
```
2024-08-06 01:13:49 -04:00
parse_devices.py [-h] [-m PRINTER_MODEL] [-l LINE_LENGTH] [-i] [-d] [-t] [-v] [-f] [-e] [-c CONFIG_FILE] [-s DEFAULT_MODEL] [-a HOSTNAME] [-p PICKLE_FILE] [-I]
[-N] [-A] [-G] [-S] [-M]
2024-07-07 09:21:39 -04:00
optional arguments:
-h, --help show this help message and exit
-m PRINTER_MODEL, --model PRINTER_MODEL
Printer model. Example: -m XP-205
2024-07-07 18:14:54 -04:00
-l LINE_LENGTH, --line LINE_LENGTH
Set line length of the output (default: 120)
-i, --indent Indent output of 4 spaces
2024-07-07 09:21:39 -04:00
-d, --debug Print debug information
-t, --traverse Traverse the XML, dumping content related to the printer model
-v, --verbose Print verbose information
-f, --full Generate additional tags
-e, --errors Add last_printer_fatal_errors
-c CONFIG_FILE, --config CONFIG_FILE
use the XML configuration file to generate the configuration
2024-07-28 21:29:30 -04:00
-s DEFAULT_MODEL, --default_model DEFAULT_MODEL
Default printer model. Example: -s XP-205
-a HOSTNAME, --address HOSTNAME
Default printer host name or IP address. (Example: -a 192.168.1.87)
-p PICKLE_FILE, --pickle PICKLE_FILE
Save a pickle archive for subsequent load by ui.py and epson_print_conf.py
-I, --keep_invalid Do not remove printers without write_key or without read_key
-N, --keep_names Do not replace original names with converted names and add printers for all optional names
-A, --no_alias Do not add aliases for same printer with different names and remove aliased printers
2024-08-06 01:13:49 -04:00
-G, --no_aggregate_alias
Do not aggregate aliases of printers with same configuration
2024-07-28 21:29:30 -04:00
-S, --no_same_as Do not add "same-as" for similar printers with different names
2024-08-06 01:13:49 -04:00
-M, --no_maint_level Do not add "Maintenance required levelas" in "stats"
2024-07-28 13:17:22 -04:00
Generate printer configuration from devices.xml
2024-07-07 09:21:39 -04:00
```
2024-07-07 18:14:54 -04:00
The output is better formatted when also installing [black](https://pypi.org/project/black/).
2024-07-07 09:43:14 -04:00
### find_printers.py
*find_printers.py* can be executed via `python find_printers.py` and prints the list of the discovered printers to the standard output. It is internally used as a library by *ui.py*.
Output example:
```json
[{'ip': '192.168.178.29', 'hostname': 'EPSONDEFD03.fritz.box', 'name': 'EPSON XP-205 207 Series'}]
```
2024-07-07 09:21:39 -04:00
### Other utilities
2023-10-14 00:54:37 -04:00
```
2024-07-31 19:08:37 -04:00
from epson_print_conf import EpsonPrinter
2023-10-14 00:54:37 -04:00
import pprint
2024-07-31 19:08:37 -04:00
printer = EpsonPrinter()
2023-10-14 00:54:37 -04:00
# Decode write_key:
printer.reverse_caesar(bytes.fromhex("48 62 7B 62 6F 6A 62 2B")) # last 8 bytes
2024-01-17 19:44:00 -05:00
'Gazania*'
printer.reverse_caesar(b'Hpttzqjv')
'Gossypiu'
"".join(chr(b + 1) for b in b'Gossypiu')
'Hpttzqjv'
2023-10-14 00:54:37 -04:00
# Decode status:
pprint.pprint(printer.status_parser(bytes.fromhex("40 42 44 43 20 53 54 32 0D 0A ....")))
# Decode the level of ink waste
byte_sequence = "A4 2A"
divider = 62.06 # divider = ink_level / waste_percent
ink_level = int("".join(reversed(byte_sequence.split())), 16)
waste_percent = round(ink_level / divider, 2)
# Print the read key sequence in byte and hex formats:
2024-07-31 19:08:37 -04:00
printer = EpsonPrinter(model="ET-2700")
2023-10-14 00:54:37 -04:00
'.'.join(str(x) for x in printer.parm['read_key'])
" ".join('{0:02x}'.format(x) for x in printer.parm['read_key'])
# Print the write key sequence in byte and hex formats:
2024-07-31 19:08:37 -04:00
printer = EpsonPrinter(model="ET-2700")
2023-10-14 00:54:37 -04:00
printer.caesar(printer.parm['write_key'])
printer.caesar(printer.parm['write_key'], hex=True).upper()
# Print hex sequence of reading the value of EEPROM address 30 00:
" ".join('{0:02x}'.format(int(x)) for x in printer.eeprom_oid_read_address(oid=0x30).split(".")[15:]).upper()
# Print hex sequence of storing value 00 to EEPROM address 30 00:
" ".join('{0:02x}'.format(int(x)) for x in printer.eeprom_oid_write_address(oid=0x30, value=0x0).split(".")[15:]).upper()
# Print EEPROM write hex sequence of the raw ink waste reset:
for key, value in printer.parm["raw_waste_reset"].items():
" ".join('{0:02x}'.format(int(x)) for x in printer.eeprom_oid_write_address(oid=key, value=value).split(".")[15:]).upper()
```
2024-02-02 16:57:16 -05:00
Generic query of the status of the printer (regardless of the model):
```
2024-07-31 19:08:37 -04:00
from epson_print_conf import EpsonPrinter
2024-02-02 16:57:16 -05:00
import pprint
2024-07-31 19:08:37 -04:00
printer = EpsonPrinter(hostname="192.168.1.87")
2024-02-02 16:57:16 -05:00
pprint.pprint(printer.status_parser(printer.snmp_mib("1.3.6.1.4.1.1248.1.2.2.1.1.1.4.1")[1]))
```
2023-10-14 00:54:37 -04:00
### Byte sequences
Header:
```
1.3.6.1.4.1. [SNMP_OID_ENTERPRISE]
1248. [SNMP_EPSON]
2024-02-02 16:57:16 -05:00
2023-10-14 00:54:37 -04:00
1.2.2.44.1.1.2. [OID_PRV_CTRL]
1.
```
Full header sequence: `1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1.`
Read EEPROM (EPSON-CTRL), after the header:
```
124.124.7.0. [7C 7C 07 00]
<READ KEY (two bytes)>
65.190.160. [41 BE A0]
<LSB EEPROM ADDRESS (one byte)>.<MSB EEPROM ADDRESS (one byte)>
```
Example: `1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1.124.124.7.0.73.8.65.190.160.48.0`
Write EEPROM, after the header:
```
7C 7C 10 00 [124.124.16.0.]
<READ KEY (two bytes)>
42 BD 21 [66.189.33.]
<LSB EEPROM ADDRESS (one byte)>.<MSB EEPROM ADDRESS (one byte)>
<VALUE (one byte)>
<WRITE KEY (eight bytes)>
```
Example: `7C 7C 10 00 49 08 42 BD 21 30 00 1A 42 73 62 6F 75 6A 67 70`
2023-11-13 07:14:30 -05:00
Example of Read EEPROM (@BDC PS):
```
<01> @BDC PS <0d0a> EE:0032AC;
EE: = EEPROM Read
0032 = Memory address
AC = Value
```
2023-07-24 11:34:19 -04:00
## API Interface
2023-08-08 17:18:54 -04:00
### Specification
```python
2024-07-28 21:29:30 -04:00
EpsonPrinter(conf_dict, replace_conf, model, hostname, port, timeout, retries, dry_run)
2023-08-08 17:18:54 -04:00
```
2024-07-28 21:29:30 -04:00
- `conf_dict`: optional configuration file in place of the default PRINTER_CONFIG (optional, default to `{}`)
- `replace_conf`: (optional, default to False) set to True to replace PRINTER_CONFIG with `conf_dict` instead of merging it
2023-08-08 17:18:54 -04:00
- `model`: printer model
- `hostname`: IP address or network name of the printer
- `port`: SNMP port number (default is 161)
- `timeout`: printer connection timeout in seconds (float)
- `retries`: connection retries if error or timeout occurred
- `dry_run`: boolean (True if write dry-run mode is enabled)
### Exceptions
```
TimeoutError
ValueError
```
(And *pysnmp* exceptions.)
### Sample
2023-07-24 11:34:19 -04:00
```python
2024-07-31 19:08:37 -04:00
from epson_print_conf import EpsonPrinter
2023-08-06 05:06:46 -04:00
import logging
logging.basicConfig(level=logging.DEBUG, format="%(message)s") # if logging is needed
2024-07-31 19:08:37 -04:00
printer = EpsonPrinter(
2023-08-08 17:18:54 -04:00
model="XP-205", hostname="192.168.1.87")
2023-07-24 11:34:19 -04:00
2023-07-25 05:49:47 -04:00
if not printer.parm:
print("Unknown printer")
quit()
2023-07-25 08:28:28 -04:00
stats = printer.stats()
2023-07-24 11:34:19 -04:00
print("stats:", stats)
2023-08-03 18:09:11 -04:00
ret = printer.get_snmp_info()
2023-07-25 05:49:47 -04:00
print("get_snmp_info:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_serial_number()
2023-07-24 11:34:19 -04:00
print("get_serial_number:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_firmware_version()
2023-07-24 11:34:19 -04:00
print("get_firmware_version:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_printer_head_id()
2023-07-24 11:34:19 -04:00
print("get_printer_head_id:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_cartridges()
2023-07-24 11:34:19 -04:00
print("get_cartridges:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_printer_status()
2023-07-24 11:34:19 -04:00
print("get_printer_status:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_ink_replacement_counters()
2023-07-24 11:34:19 -04:00
print("get_ink_replacement_counters:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_waste_ink_levels()
2023-07-24 11:34:19 -04:00
print("get_waste_ink_levels:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_last_printer_fatal_errors()
2023-07-24 11:34:19 -04:00
print("get_last_printer_fatal_errors:", ret)
2023-08-03 18:09:11 -04:00
ret = printer.get_stats()
2023-07-24 11:34:19 -04:00
print("get_stats:", ret)
2023-08-03 18:09:11 -04:00
printer.reset_waste_ink_levels()
printer.brute_force_read_key()
printer.write_first_ti_received_time(2000, 1, 2)
2023-07-24 11:34:19 -04:00
```
2023-07-25 05:49:47 -04:00
## Output example
2023-08-02 02:38:27 -04:00
Example of advanced printer status with an XP-205 printer:
2023-07-25 05:49:47 -04:00
2023-11-10 15:23:51 -05:00
```python
2023-11-11 07:39:56 -05:00
{'cartridge_information': [{'data': '0D081F172A0D04004C',
2023-08-05 11:25:59 -04:00
'ink_color': [1811, 'Black'],
2023-11-10 15:23:51 -05:00
'ink_quantity': 76,
2023-08-05 11:05:09 -04:00
'production_month': 8,
'production_year': 2013},
2023-11-11 07:39:56 -05:00
{'data': '15031D06230D080093',
2023-08-05 11:25:59 -04:00
'ink_color': [1814, 'Yellow'],
2023-11-10 15:23:51 -05:00
'ink_quantity': 69,
2023-08-05 11:05:09 -04:00
'production_month': 3,
'production_year': 2021},
2023-11-11 07:39:56 -05:00
{'data': '150317111905020047',
2023-08-05 11:25:59 -04:00
'ink_color': [1813, 'Magenta'],
2023-11-10 15:23:51 -05:00
'ink_quantity': 49,
2023-08-05 11:05:09 -04:00
'production_month': 3,
'production_year': 2021},
2023-11-11 07:39:56 -05:00
{'data': '14091716080501001D',
2023-08-05 11:25:59 -04:00
'ink_color': [1812, 'Cyan'],
2023-11-10 15:23:51 -05:00
'ink_quantity': 29,
2023-08-05 11:05:09 -04:00
'production_month': 9,
'production_year': 2020}],
'cartridges': ['18XL', '18XL', '18XL', '18XL'],
2023-07-25 05:49:47 -04:00
'firmware_version': 'RF11I5 11 May 2018',
'ink_replacement_counters': {('Black', '1B', 1),
('Black', '1L', 19),
('Black', '1S', 2),
('Cyan', '1B', 1),
('Cyan', '1L', 8),
('Cyan', '1S', 1),
('Magenta', '1B', 1),
('Magenta', '1L', 6),
('Magenta', '1S', 1),
('Yellow', '1B', 1),
('Yellow', '1L', 10),
('Yellow', '1S', 1)},
'last_printer_fatal_errors': ['08', 'F1', 'F1', 'F1', 'F1', '10'],
2023-07-31 07:45:08 -04:00
'printer_head_id': '...',
2023-07-25 05:49:47 -04:00
'printer_status': {'cancel_code': 'No request',
2023-11-10 15:23:51 -05:00
'ink_level': [(1, 0, 'Black', 'Black', 76),
(5, 3, 'Yellow', 'Yellow', 69),
(4, 2, 'Magenta', 'Magenta', 49),
(3, 1, 'Cyan', 'Cyan', 29)],
2023-07-25 05:49:47 -04:00
'jobname': 'Not defined',
'loading_path': 'fixed',
'maintenance_box_1': 'not full (0)',
2023-08-05 11:05:09 -04:00
'maintenance_box_2': 'not full (0)',
'maintenance_box_reset_count_1': 0,
'maintenance_box_reset_count_2': 0,
2023-07-25 05:49:47 -04:00
'paper_path': 'Cut sheet (Rear)',
'ready': True,
'status': (4, 'Idle'),
'unknown': [('0x24', b'\x0f\x0f')]},
2023-07-31 07:45:08 -04:00
'serial_number': '...',
2023-07-25 05:49:47 -04:00
'snmp_info': {'Descr': 'EPSON Built-in 11b/g/n Print Server',
'EEPS2 firmware version': 'EEPS2 Hard Ver.1.00 Firm Ver.0.50',
'Emulation 1': 'unknown',
'Emulation 2': 'ESC/P2',
'Emulation 3': 'BDC',
'Emulation 4': 'other',
'Emulation 5': 'other',
2023-08-05 11:05:09 -04:00
'Epson Model': 'XP-205 207 Series',
2023-07-31 10:54:58 -04:00
'IP Address': '192.168.1.87',
2023-08-29 15:44:22 -04:00
'IPP_URL': 'http://192.168.1.87:631/Epson_IPP_Printer',
'IPP_URL_path': 'Epson_IPP_Printer',
2023-07-25 05:49:47 -04:00
'Lang 1': 'unknown',
'Lang 2': 'ESCPL2',
'Lang 3': 'BDC',
'Lang 4': 'D4',
'Lang 5': 'ESCPR1',
2023-08-29 15:44:22 -04:00
'MAC Addr': '...',
2023-07-31 07:45:08 -04:00
'MAC Address': '...',
2023-07-25 05:49:47 -04:00
'Model': 'EPSON XP-205 207 Series',
'Model short': 'XP-205 207 Series',
2023-11-10 15:23:51 -05:00
'Name': '...',
'Power Off Timer': '0.5 hours',
2023-07-25 05:49:47 -04:00
'Print input': 'Auto sheet feeder',
2023-08-08 11:35:34 -04:00
'Total printed pages': '0',
2023-11-10 15:23:51 -05:00
'UpTime': '00:02:08',
'WiFi': '...',
2023-08-03 18:09:11 -04:00
'device_id': 'MFG:EPSON;CMD:ESCPL2,BDC,D4,D4PX,ESCPR1;MDL:XP-205 '
'207 Series;CLS:PRINTER;DES:EPSON XP-205 207 '
2023-11-10 15:23:51 -05:00
'Series;CID:EpsonRGB;FID:FXN,DPN,WFA,ETN,AFN,DAN;RID:40;'},
2023-07-31 07:45:08 -04:00
'stats': {'First TI received time': '...',
2023-07-25 05:49:47 -04:00
'Ink replacement cleaning counter': 78,
2023-07-31 07:41:37 -04:00
'Maintenance required level of 1st waste ink counter': 94,
'Maintenance required level of 2nd waste ink counter': 94,
2023-07-25 05:49:47 -04:00
'Manual cleaning counter': 129,
'Timer cleaning counter': 4,
2023-11-10 15:23:51 -05:00
'Total print page counter': 11569,
'Total print pass counter': 514602,
2023-11-10 18:39:31 -05:00
'Total scan counter': 4973,
2023-11-11 04:37:03 -05:00
'Power off timer': 30},
2023-11-10 15:23:51 -05:00
'waste_ink_levels': {'borderless_waste': 4.72, 'main_waste': 90.8}}
2023-07-31 07:41:37 -04:00
```
2023-07-25 05:49:47 -04:00
2023-07-24 08:58:19 -04:00
## Resources
2023-08-03 18:09:11 -04:00
### snmpget (Linux)
2023-07-24 08:58:19 -04:00
Installation:
```
sudo apt-get install snmp
```
Usage:
```
# Read address 173.0
snmpget -v1 -d -c public 192.168.1.87 1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1.124.124.7.0.25.7.65.190.160.173.0
# Read address 172.0
snmpget -v1 -d -c public 192.168.1.87 1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1.124.124.7.0.25.7.65.190.160.172.0
# Write 25 to address 173.0
snmpget -v1 -d -c public 192.168.1.87 1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1.124.124.16.0.25.7.66.189.33.173.0.25.88.98.108.98.117.112.99.106
# Write 153 to address 172.0
snmpget -v1 -d -c public 192.168.1.87 1.3.6.1.4.1.1248.1.2.2.44.1.1.2.1.124.124.16.0.25.7.66.189.33.172.0.153.88.98.108.98.117.112.99.106
```
2023-08-02 02:38:27 -04:00
### References
2023-07-24 08:58:19 -04:00
2023-07-31 07:41:37 -04:00
epson-printer-snmp: https://github.com/Zedeldi/epson-printer-snmp (and https://github.com/Zedeldi/epson-printer-snmp/issues/1)
2023-07-24 08:58:19 -04:00
ReInkPy: https://codeberg.org/atufi/reinkpy/
ReInk: https://github.com/lion-simba/reink (especially https://github.com/lion-simba/reink/issues/1)
reink-net: https://github.com/gentu/reink-net
epson-l4160-ink-waste-resetter: https://github.com/nicootto/epson-l4160-ink-waste-resetter
2023-07-27 01:00:04 -04:00
epson-l3160-ink-waste-resetter: https://github.com/k3dt/epson-l3160-ink-waste-resetter
2023-07-24 11:41:55 -04:00
emanage x900: https://github.com/abrasive/x900-otsakupuhastajat/
2023-11-13 07:14:30 -05:00
### Other programs
2023-07-24 08:58:19 -04:00
2023-11-13 07:14:30 -05:00
- Epson One-Time Maintenance Ink Pad Reset Utility: https://epson.com/Support/wa00369
- Epson Maintenance Reset Utility: https://epson.com/epsonstorefront/orbeon/fr/us_regular_s03/us_ServiceInk_Pad_Reset/new
- Epson Ink Pads Reset Utility Terms and Conditions: https://epson.com/Support/wa00370
2023-07-25 10:15:06 -04:00
- Epson Adjustment Program (developed by EPSON)
2023-11-13 07:14:30 -05:00
- WIC-Reset: https://wic-reset.com / https://www.2manuals.com / https://resetters.com (Use at your risk)
- PrintHelp: https://printhelp.info/ (Use at your risk)
### Other resources
- https://codeberg.org/attachments/147f41a3-a6ea-45f6-8c2a-25bac4495a1d
- https://codeberg.org/atufi/reinkpy/src/branch/main/reinkpy/epson.toml
## Acknowledgments
Thanks to [sshsphere](https://github.com/sshsphere) for the GUI and other features.