mirror of
https://github.com/Ircama/epson_print_conf.git
synced 2024-10-18 01:00:36 -04:00
Refinements
This commit is contained in:
parent
bc512c9c88
commit
c3fd25c223
2 changed files with 77 additions and 13 deletions
27
README.md
27
README.md
|
@ -152,7 +152,27 @@ TimeoutError
|
|||
Example of advanced printer status with an XP-205 printer:
|
||||
|
||||
```
|
||||
{'cartridges': ['18XL', '18XL', '18XL', '18XL'],
|
||||
{'cartridge_information': [{'id': '0D081F172A0D04004C',
|
||||
'ink_color': 'Black',
|
||||
'ink_quantity': 89,
|
||||
'production_month': 8,
|
||||
'production_year': 2013},
|
||||
{'id': '15031D06230D080093',
|
||||
'ink_color': 'Yellow',
|
||||
'ink_quantity': 77,
|
||||
'production_month': 3,
|
||||
'production_year': 2021},
|
||||
{'id': '150317111905020047',
|
||||
'ink_color': 'Magenta',
|
||||
'ink_quantity': 59,
|
||||
'production_month': 3,
|
||||
'production_year': 2021},
|
||||
{'id': '14091716080501001D',
|
||||
'ink_color': 'Cyan',
|
||||
'ink_quantity': 40,
|
||||
'production_month': 9,
|
||||
'production_year': 2020}],
|
||||
'cartridges': ['18XL', '18XL', '18XL', '18XL'],
|
||||
'firmware_version': 'RF11I5 11 May 2018',
|
||||
'ink_replacement_counters': {('Black', '1B', 1),
|
||||
('Black', '1L', 19),
|
||||
|
@ -175,8 +195,10 @@ Example of advanced printer status with an XP-205 printer:
|
|||
(3, 1, 'Cyan', 'Cyan', 40)],
|
||||
'jobname': 'Not defined',
|
||||
'loading_path': 'fixed',
|
||||
'maintenance_box_0': 'not full (0)',
|
||||
'maintenance_box_1': 'not full (0)',
|
||||
'maintenance_box_2': 'not full (0)',
|
||||
'maintenance_box_reset_count_1': 0,
|
||||
'maintenance_box_reset_count_2': 0,
|
||||
'paper_path': 'Cut sheet (Rear)',
|
||||
'ready': True,
|
||||
'replace_cartridge': '00000001',
|
||||
|
@ -190,6 +212,7 @@ Example of advanced printer status with an XP-205 printer:
|
|||
'Emulation 3': 'BDC',
|
||||
'Emulation 4': 'other',
|
||||
'Emulation 5': 'other',
|
||||
'Epson Model': 'XP-205 207 Series',
|
||||
'IP Address': '192.168.1.87',
|
||||
'Lang 1': 'unknown',
|
||||
'Lang 2': 'ESCPL2',
|
||||
|
|
|
@ -277,6 +277,7 @@ class EpsonPrinter:
|
|||
|
||||
snmp_info = {
|
||||
"Model": "1.3.6.1.2.1.25.3.2.1.3.1",
|
||||
"Epson Model": "1.3.6.1.4.1.1248.1.2.2.1.1.1.2.1",
|
||||
"Model short": "1.3.6.1.4.1.1248.1.1.3.1.3.8.0",
|
||||
"EEPS2 firmware version": "1.3.6.1.2.1.2.2.1.2.1",
|
||||
"Descr": "1.3.6.1.2.1.1.1.0",
|
||||
|
@ -316,6 +317,15 @@ class EpsonPrinter:
|
|||
hostname: str
|
||||
parm: dict
|
||||
|
||||
ink_color_ids = { # Ink color
|
||||
0x00: 'Black',
|
||||
0x01: 'Cyan',
|
||||
0x02: 'Magenta',
|
||||
0x03: 'Yellow',
|
||||
0x04: 'Light Cyan',
|
||||
0x05: 'Light Magenta',
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
printer_model:
|
||||
|
@ -570,15 +580,6 @@ class EpsonPrinter:
|
|||
0x11: 'Green',
|
||||
}
|
||||
|
||||
ink_color_ids = { # Ink color
|
||||
0x00: 'Black',
|
||||
0x01: 'Cyan',
|
||||
0x02: 'Magenta',
|
||||
0x03: 'Yellow',
|
||||
0x04: 'Light Cyan',
|
||||
0x05: 'Light Magenta',
|
||||
}
|
||||
|
||||
status_ids = {
|
||||
0x00: 'Error',
|
||||
0x01: 'Self Printing',
|
||||
|
@ -728,8 +729,8 @@ class EpsonPrinter:
|
|||
else:
|
||||
name = "0x%X" % colour
|
||||
|
||||
if ink_color in ink_color_ids:
|
||||
ink_name = ink_color_ids[ink_color]
|
||||
if ink_color in self.ink_color_ids:
|
||||
ink_name = self.ink_color_ids[ink_color]
|
||||
else:
|
||||
ink_name = "0x%X" % ink_color
|
||||
|
||||
|
@ -1041,6 +1042,46 @@ class EpsonPrinter:
|
|||
label="last_printer_fatal_errors"
|
||||
)
|
||||
|
||||
def ink_color(self, number):
|
||||
if number - 1811 in self.ink_color_ids:
|
||||
return self.ink_color_ids[number - 1811]
|
||||
else:
|
||||
return number
|
||||
|
||||
def get_cartridge_information(self) -> str:
|
||||
"""Return list of cartridge properties."""
|
||||
response = []
|
||||
for i in range(1, 9):
|
||||
mib = f"{self.eeprom_link}.105.105.2.0.1." + str(i)
|
||||
cartridge = self.snmp_mib(mib)
|
||||
if cartridge.find(b'ii:NA;') > 0 or cartridge.find(
|
||||
b'BDC PS\r\n') < 0:
|
||||
break
|
||||
if self.debug:
|
||||
print(
|
||||
f"Cartridge {i}:\n"
|
||||
f" MIB: {mib}"
|
||||
)
|
||||
if self.debug:
|
||||
print(f" RESPONSE: {repr(cartridge)}")
|
||||
response.append(cartridge[10:-2].decode().split(';'))
|
||||
cartridges = [
|
||||
{i[0]: i[1] for i in map(lambda x: x.split(':'), j)}
|
||||
for j in response
|
||||
]
|
||||
return [
|
||||
{
|
||||
"ink_color": self.ink_color(int(i['IC1'], 16)),
|
||||
"ink_quantity": int(i['IQT'], 16),
|
||||
#"viq": int(i['VIQ'], 16),
|
||||
#"uiq": int(i['UIQ'], 16),
|
||||
"production_year": int(i['PDY'], 16) + (
|
||||
1900 if int(i['PDY'], 16) > 80 else 2000),
|
||||
"production_month": int(i['PDM'], 16),
|
||||
"id": i['SID']
|
||||
} for i in cartridges
|
||||
]
|
||||
|
||||
def dump_eeprom(self, start: int = 0, end: int = 0xFF):
|
||||
"""
|
||||
Dump EEPROM data from start to end (less significant byte).
|
||||
|
|
Loading…
Reference in a new issue