Back in the day when men were men and printers were only build to put ink to paper as effectively as possible, some amazingly robust and capable machine were build. The HP laser-jets of the 90's hold a special place in my heart as I came to know them well. Maintaining a small army of HP 5N printers which were by that time already 10 years old, I really liked these workhorse tanks. As per Unix philosophy, they did one thing but they did it very well indeed.

    The abuse my fleet endured in the factory I worked in was something else. Continues use in a harsh climate with powdery residue everywhere. A typical unit needed a clean about every 3 months after which it ran like new. This apposed to newer hardware that would simply give up the ghost after 2 month with no hope in hell of recovering.

    Of course the maintenance drill was more involved than simply shaking the cartridge. The unit had to be blown clean with an air hose and the mirror assembly had to be cleaned with wipes, but eventually I could do this in less than 15 minutes, which is less then a new office laser printer for every department every few months. The factory really was terribly dusty.. by design!

    So when it came to a home printing solution for al users and devices, I bought me a second hand HP 5N as cartridges are still available in extended versions. Nothing can beat the printing costs for B&W costing about 50 Euros for 10000 prints. TEN *&^&*@# THOUSAND!!! Seeing as 99% of the stuff we print is B&W, this made perfectly good sense.

    The only problem with this generation of printers is that they do not perform and connect like modern machine do. These are power hungry beasts even in standby mode and they do not play well with mobile printing protocols. For the later, of course there is CUPS and Avahi got you covered and of course all of you have a Raspberry Pi in your network for various tasks and if you do not? What are you thinking?

    But the power thing is a bit of a problem. At idle the thing probably pulls 1.21 Jiggawats and it is LOUD!!! So the current state of affairs that when we print a document, we walk upstairs to the office, turn on the printer and the document starts coming out after about 30 seconds. After the spooler is empty and printing has finished, we turn off the machine and go back to what we were doing. What I would like is for this 25 year old behemoth to have my pages ready when I choose to go and fetch said pages, so some auto power on function that is better than its idle mode.

    Introducing the TP Link HS100 grade-A Chinesium el cheapo "smart" plug. A 20 euro device that hooks up to your network and let you control a socket from a mobile device. It needs an app and an account in the cloud and all that jazz. But I do not want to control it from a bloody phone, nor do I want a cloud service to have any type of control over my outlets. I want my printer server to do that.

    Luckily this model "smart" plug has already been cracked wide open and a simple bash script can toggle it and get it's status without any added fuss. Here is the github for the script I used. hs100 bash script I did not upgrade the firmware due to the possibility that perhaps new firmware would brick this solution.

    The real trick here is to write a script that can accurately determine what is going on. Turning on the printer when a print job is active is simple enough, but to know how long to stay one or when to shut the printer off is going to be the technical part of this gig. At this moment I have the simplest version of the script running on the RPi. When lpstat returns a job, the printer will power on for 10 minutes.

    This works perfectly fine for any job 50 pages or less, but it could be a whole lot better. So on this page I'll like to discuss about various options to build a better more functional script and I'll share my code and experiences.