HP OfficeJet Printer Binding

When I’ve been testing new builds of my Binding I just drop it into the add-ons folder, overwriting the last version of the binding and then restart the openHAB Docker instance. Usually works well for me.

In your case if it shows stale Binding information then it’s probably an issue with the Cache needing to be cleared or needing to manually edit the jsondb (I don’t know if this is due to my Binding or openHAB, seems to possibly be a openHAB problem). The forums seem to have a few solutions that can be tried but in these cases I can’t really offer much support.

Okay all, more updates:

  • Added auto-discovery support
    The Binding should now auto-discover the HP Printers that are listed, including unsupported OfficeJets. If your device was auto-detected then it uses this as part of the method for Offline/Online detection which may still need some testing.
  • A few more fixes that @vzorglub reported.

Link available on original post, enjoy!

Would you be able to add a channel, please?
Total number of prints?
The reason for it is that I have the HP Ink subscription and I like to monitor how many prints I have done this month so that I don’t go over the quota. Thanks

That’s next on my list, total prints and total bw/colour prints along with reboot, though Ill prioritise the total print count since it seems important.

Does this total print count reset every month or do they calculate based on last months value minus this months value?

No it’s a total print count
I can do the monthly bit with persistence

Hi there!
Thank you very much for your binding, which I’d like to support!

I have an HP Color LaserJet MFP M277dw - some remarks to my first experiences:

  1. The “Unsupported …” variant didn’t work for me: the (manually) created thing never went online.
  2. However, I had sucess making it a fake “HP OfficeJet Pro 8600”: I was able to link items to the status and the ink level channels successfully, but there were problems with the reboot channel (couldn’t be added via PaperUI):
    2019-01-10 01:06:07.405 [WARN ] [rest.core.internal.item.ItemResource] - Received HTTP PUT request at ‘items/HPOfficeJetPro8600_Control_Reboot’ with an invalid item type ‘Boolean’.

I’m attaching my 2 XML files and hope very much that you can incorporate them:

ProductUsageDyn[1].xml (12.0 KB)
ProductStatusDyn[1].xml (4.0 KB)

Looking foward to your next update!

Thanks again! Stephen

1 Like

I think the reboot button is not yet supported.

What is the minimum OH version this is compatible with?

@heilbron Good to know that the LaserJet supports this, I will take a look at your files over the weekend and compare them to everyone elses to see what data is exposed. As mark said, that channel doesn’t yet work, although technically the code is in there all ready to go but I haven’t been able to figure out why it won’t add the channel when clicking in openHAB… however your log files warning message has just given me an idea on what I might need to do in code to “acknowledge” the channel being added.

@KidSquid Honestly, I don’t know what minimum version it would work with, I’ve only been building against the 2.5.0 snapshot repository and I have openHAB 2.4 here running in a Docker container that I’ve been testing it against, but I assume it should work with 2.3 as well… if others here in this forum have tested it on anything older than version 2.4 can you let us know please?

It worked for me on 2.3

1 Like

@Cossey

I’m still running on 2.3 as I’m watching/hoping the HUE emulation issues will get fixed.

Tried install and received some dependency errors:

Yes I am on 2.5 latest snapshot and it works just fine

Hi @Cossey,

Thank you for the binding! Like others I have solved this via the HTTP binding, but a native binding is always nicer! I have downloaded the latest version to test, but it does not work for my printer:

HP OfficeJet 4650 All-in-One Printer series

This printer only supports the color and the black channel.
Here are my item definitions:

Number Inklevel_Color "Info CMY [%s]" {http="<[http://192.168.0.22/DevMgmt/ConsumableConfigDyn.xml:30000:XPATH(/*[name()='ccdyn:ConsumableConfigDyn']/*[name()='ccdyn:ConsumableInfo'][1]/*[name()='dd:ConsumablePercentageLevelRemaining']/text())]"}
Number Inklevel_Black "Info K [%s]" {http="<[http://192.168.0.22/DevMgmt/ConsumableConfigDyn.xml:30000:XPATH(/*[name()='ccdyn:ConsumableConfigDyn']/*[name()='ccdyn:ConsumableInfo'][2]/*[name()='dd:ConsumablePercentageLevelRemaining']/text())]"}

String Printer_Status "Printer State [%s]" {http="<[http://192.168.0.22/DevMgmt/ProductStatusDyn.xml:1800000:XPATH(/*[name()='psdyn:ProductStatusDyn']/*[name()='psdyn:Status'][2]/*[name()='pscat:StatusCategory']/text())]"}

ConsumableConfigDyn.xml (7.1 KB)
ProductUsageDyn.xml (28.6 KB)

It would be great if you could add that printer as well!

I also tried to use the " Unsupported HP OfficeJet Pro Series" by adding it manually, but the latest binding seems to have an issue with that one. When saving I get the following error message and the thing is uninitialized:

2019-01-10 21:13:24.952 [WARN ] [ore.thing.internal.ThingRegistryImpl] - Cannot create thing. No binding found that supports creating a thing of type 'hpprinter:officejetpro'.

I also cannot just delete the thing after that, I have to force removal.
Maybe you can look into that as well

Yes that happens with downloaded jar bindings in my experience but I may be wrong

Hmm interesting, this printer has its ink data in that separate xml file. I’ll look into adding support for that.

Thanks!

Ha, interesting - I did not even notice that the xml filename was different to what you added to the description.
Thank you!

@Chrishab I noticed that you’ve included both a ConsumableConfigDyn.xml and ProductUsageDyn.xml file which both contain Ink Level information, although they are both have different ink level values.

Level ProductUsageDyn ConsumableConfigDyn
Colour 72 70
Black 67 70

It seems like maybe ConsumableConfigDyn.xml only has roundabout values vs ProductUsageDyn.xml which has the actual level. Are you aware of this?

Small issue:
When starting the ink level are initialised to 0:

2019-01-12 10:02:54.739 [vent.ItemStateChangedEvent] - Printer_BlackRemaining changed from NULL to 0.0 %
2019-01-12 10:02:54.754 [vent.ItemStateChangedEvent] - Printer_ColorRemaining changed from NULL to 0.0 %

They should be set at UNDEF

Thanks

Hi @Cossey,

Interesting! I always used the rounded values.
Meaning: I haven’t been aware of the actual values. Even better I guess since only one file needs to be considered…