HOWTO: Displaying printer's toner and drum life in AT

Max R 4 years ago in Things & Capabilities 0

Hi All, wanted to share an idea I've kicked around for a bit and figured out to implement to success this weekend. Family's  been making heavy use of the printer as of recently and I figured it would be cool to be able to a) keep an eye on the toner and drum life of my Brother laserprinter and b) be alerted once either reached a given threshold.

For this project I am using Webcore to do the handywork behind the scenes.

My printer is a Brother HL-L2395DW wifi printer, and it happens to provide a website with all the details I'm interested in. This model's website can be reached at http://your-printers-address/general/information.html. Per default it is not password protected.

Image 4825

Specifically I am interested in the page count, the drum unit and toner percentages as marked in yellow above.

Working backwards, the AT tile type which currently seems to make most sense for displaying a percentage, is a Humidity sensor. Fortunately SmartThings comes with a DTH for a Simulated Thermostat, which just happens to include a simulated humidity sensor. I created two virtual thermostats in the ST IDE and created tiles for them in my Office AT panel:

Image 4826

Note1: while I could probably rig up a DTH for a simulated energy meter or a simulated lux meter for displaying the page count, I chose to hold off from creating a tile for it now, as we still can't customize or remove the lower part of the AT tiles (looking over the rim of my glasses at you, Terry :B-) . It would look rather silly showing a tile with my pagecount, displaying watts or lux below) for now I'm just storing the pagecount value until I find something interesting to do with it.

Note2. When you create simulated devices in the IDE, you should go to the ST app and add (+) new devices, before trying to make them available to AT and Webcore.

As mentioned it's a Wecore piston which drives the tile updates once a day using a timer. The piston uses a simple webcall to pull the status page above. Unfortunately the result does not translate to Json, so I had to get real creative with indexof(), mid() and similar string operators to yank the numbers out and convert them to integers. 

In addition I have a threshold of 10% defined so if either drum or toner hits that limit a message will be pushed to my phone. Additionally if there's anyone detected by the office motion sensor, a VLCthing speech synth will speak the same message out in the room.

Here's a green screenshot of how I put v1 togother:

Image 4827