I have a Xerox WorkCentre 6027 printer, and I decided it’d be fun to be able to monitor it in Hass. I’d toyed with scraping its web interface and then decided SNMP would be simpler. I mean it’s the SIMPLE network monitoring protocol, right? Yah, so simple. Well, five hours and I don’t know how many restarts later, here it is, mostly: it’s properly reporting all four toner levels and the printer’s total page count. I’m going to update it tomorrow with such niceties as the printer’s current status.
and the result:
I believe that these SNMP OIDs should work with any color laser printer, though I’m not completely certain, and I’m equally (un)sure that the black values should work with any monochrome laser printer. I think. Maybe.
I dig it! I haven’t taken the plunge into the custom UI yet, nor Lovelace for that matter…gotta get off my duff already.
If you’re on a Linux system, you can do
sudo apt install snmp
and then
snmpbulkwalk -v 2c -c public 192.168.1.183
(replace that IP with your printer’s) and it’ll spew forth every OID that your printer supports. It’s a massive pile, but you could go to the printer’s control panel and get the page count and search through the spewage to find an OID that reports that value. That’s basically how I deciphered what mine was telling me. Replace the ‘iso’ at the beginning with 1 and you’re golden.
I just tested it by taking the printer offline and restarting Hass; it pretty much barfed all over the place and returned a bunch of “unknown” results and divide by zero errors in the log. So it’ll need a little tweaking and error handling before I’d consider it really ready for prime time. The good news is that once I brought the printer back up it did gracefully reconnect and start reporting good values. I’m thinking a ping sensor pointed at the printer and every sensor returns ‘offline’ instead of random junk if the ping shows it’s offline. Ideas?
Also, for some odd reason the printer only reports its status on one OID when it’s awake and on another OID when it’s in standby. Really weird. I’ll have to do some logic in a sensor to return an actual status based on those two OIDs rather than just directly displaying one. Different brands and probably different models most likely behave differently in this regard so I’m sure it’ll be a lot of trial and error.
Read this blog on the topic HP Printer In Error State 36, I am sure you will get your solution from this blog. I had also the similar issue and through this blog I have resolved my issue.
Solved the lifetime pagecount issue by an automation that triggers on page count change (ignoring unknown when printer is not reachable) pushing the new page count over to a dedicated MQTT topic with retain flag.The sensor displaying the the valid lifetime pagecount subscribes to this dedicated MQTT topic.
@Dan_Bowkley I know I’m bumping an old thread, but I just had to say this. I’m no stranger to IT and tech in general (and I’m proficient in YAML too!!), but I am pretty new to Home Assistant.
I haven’t bought any Z-Wave gear or anything, but I just happen to own a Xerox laser printer, so finding this thread made it a perfect test bed for integrating with HA. Fast forward to 2 days later, and I’ve already subscribed to HA Cloud and added more devices to my instance! And now I’m already using your instructions above to sniff the SNMP data on my HP printer too!
Your post here (as well as your repo on GitHub) was extremely helpful in getting me going with the basics of configuring HA, so thank you!!