Skip to content
/ pqdiag Public

Scripts for running and scheduling print quality diagnostics reports on HP printers, for Windows, MacOS and Linux

License

Notifications You must be signed in to change notification settings

Vegz78/pqdiag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pqdiag

Scripts for running and scheduling the embedded print quality diagnostics report printout (PQ Diagnostics) on HP printers, away from the printer and outside of HP's official apps. For Windows, MacOS and Linux.

An ink saving alternative to periodically power cycling the printer or running the ink intensive cleaning programs, to prevent the print head nozzles clogging or drying up.

The big question is how often the job should run optimally? Please share your experiences under the issues section.

(At least these scripts work on my HP OfficeJet Pro 8710 / 8715 series printer from Windows, MacOS and Linux devices. Appreciate feedbacks in the issues section on whether the scripts work or not for other HP printers!)

pqdiagnostics

Table of Contents:

Prerequisites
Installation
Usage
Scheduling
Support (or lack thereof)
History and Attributions

Prerequisites

  • A device running Windows, MacOS or Linux, preferably always on or able to wake up periodically to run the script
  • curl (comes preinstalled on the above OSes, also on W10 and above)
  • A scheduling service, like Windows Task Scheduler or cron on MacOS and Linux (the scripts can of course also be executed manually on demand)

Installation

  1. Clone or download this repo from a release, or just the raw script file that you need
  2. Take note of the scripts' download location/path or copy it to somewhere accessible in your PATH system environment variables
  3. On MacOS and Linux, make the bash script executable, e.g.: sudo chmod 755 ./pqdiag.sh

Usage

MacOS and Linux

From inside the folder where pqdiag.sh is located, run the script like this:
./pqdiag.sh 192.168.0.10
, where _192.168.0.10 must be substituted with the actual IP address of your HP printer.

Windows

From inside the folder where pqdiag.bat is located, run the script like this:
pqdiag.bat 192.168.0.10
, where _192.168.0.10 must be substituted with the actual IP address of your HP printer.

Scheduling

MacOS and Linux

Using cron:

  1. sudo crontab -e
  2. Add whichever of these cron entries suits you the best to the and of the file and substitue /path/to/pqdiag.sh with the actual folder location and 192.168.0.10 with the HP printer's actual IP address:
    (or exeriment with your own here: https://crontab.guru)
    1. Wednesdays at 07:00 biweekly (odd week numbers as shown in Norwegian calendars):
      0 7 * * Wed expr \( `date +\%s` + 302400 \) / 604800 \% 2 >/dev/null || /path/to/pqdiag.sh 192.168.0.10
    2. Wednesdays at 07:00 biweekly (even week numbers as shown in Norwegian calendars):
      0 7 * * Wed expr `date +\%s` / 604800 \% 2 >/dev/null || /path/to/pqdiag.sh 192.168.0.10
    3. Wednesdays at 07:00 weekly:
      0 7 * * Wed /path/to/pqdiag.sh 192.168.0.10
  3. Save and close the crontab file

Windows

https://learn.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page

Support (or lack thereof)

Since everything works as planned already for me and I have spent some time writing this README.md with everything there is to know, this repository will not regularly be visited and updated, and it will NOT be user supported.

However, I have some interest in making this a general and available tool for HP printer users with similar needs, so I will visit now and then and maybe fix some errors or help make it work for other printers than the HP OfficeJet Pro 8710 / 8715.

Please post such feedbacks in the issues section and/or contribute with concrete pull requests.

History and Attributions

Having grown tired of dried and clogged up printhead nozzles on my HP OfficeJet Pro 8715 printer, and unsatisfied with the tremendous waste of ink from periodically running the printhead cleaning program or scheduling weekly power cycles in the printer's EWS (embedded web server), I set out on a small journey to see if there was some way to schedule the printer's ink-efficient internal print quality diagnostic report to run often enough from my always-on SBC (Rasperry Pi) or NAS servers to prevent clogging through prolonged periods of little printing.

The journey initially led me to luksfuks' Epson nozzle-check script on Reddit, which convinced me to use the printer's own embedded print quality report, since it activates every nozzle while still using a fairly miniscule amount of ink, with no need to install drivers or anything in addition to tools already provided by most vanilla OS installations.

Then, I stumbled across Jonathan Yang's article on Medium about doing just this from an ESP32-DevKit, which revealed to me the magic XML that needed to be sent to an HP printer to achieve this, which also probably was possible to replicate in an http POST command with curl, that comes preinstalled on most Windows (starting with W10), MacOS and Linux installations.

Lastly, capturing the http package in question from the HP Utility using Wireshark, comparing the captured package to Yang's above mentioned article and similar XML code in the hp-pqdiag tool in the Fossies opensource HPLIP (HP Linux Imaging and Printing) repository, studying a bit curl and cron, relearning somewhat bat and bash scripting and regex, and playing a little around, it finally resulted in this repo, which I hope will keep my printer operating smoothly going forward by running the scripts biweekly or weekly, and that I also hope others might benefit from...

Additional thanks to:

About

Scripts for running and scheduling print quality diagnostics reports on HP printers, for Windows, MacOS and Linux

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published