Custom Component - HP Printer

Did you changed this code after the update of bar-card to 3.0.0 ?
I have a huge headache trying it and unsuccesully… If you already changed it can you PLEASE share the code?

@Maurizio, you can take look at my code for SNMP printer monitoring for inspiration; I just updated it to use new bar-card 3.0.0.

1 Like

Does it work with HP Photosmart C309A?

details of how to check it available in the documentation

in case you have width defintion, please remove it and it will work

I was surprised to see when I upgraded to 0.108 that my HP DeskJet 3630 was discovered by the new Internet Printing Protocol integration and provides the same sensors as this custom component apart from 1) The number of pages scanned and 2) The status binary sensor.

Considering I have the pretty heavy weight HACS installed only for this custom component, I’ve gone with this new native printer integration and uninstalled HACS/this custom component.

That’s not to take away from the great work done on this, and I’m not sure how compatible the new integration is with various HP printers.

If anyone does the same, be sure to remove “HP Printers” from the integrations page first, then uninstall the HP Printers HACS extension. If it’s done the other way around “HP Printers” on the integrations page can’t be removed.

Thanks for this update,
I don’t see a reason to continue maintaining that custom component,
I will leave it here in case anyone wants to use it.

IPP is a standard so it’s much better than the integration I’ve done with specific API cover printers supports that API.

Regarding the lack of number of pages scanned, printed and cancelled - I will check if I can extend it and do a pull request.

2 Likes

My printer also showed up after moving to 0.108, HP 3545.
Since I use only the Ink Level feature for my home printing purpose, the IP Printer integration does the job.

@bar : Many thanks for all the work and developing this so far.

@Alec : appreciate the heads up on the removal sequence :wink: Worked for me like you described.

grtz
John

Hi,
I am a newbie and this is component seems very helpful to get higher WAF :slight_smile:
I am a little lost in how to handle the Github Download
ha-hpprinter-master.zip file.
I have already one custom component installed and running in the ‘custom_components’ folder.

I copied the ‘hpp_printer’ folder to
\\192.168.1.70\config\custom_components
But what to do with the files: hacs.json etc?

After a restart (without copying the single files), my HA system discovered the HP Printer 6970 (Desktop/Scanner) as before … this offers only access to ink filling state.

What do I need to do for access to i.e. printed pages etc.

Best regards,
Joerg

After 2 weeks with IPP integration I realized it’s working for me much better that component than the official-generic-one.

2 main issues that made me realize it:

  • When printer is off or in power saving mode, there are lots of error messages in log
  • No support for scanner and lack of details available in this component

I also worked a bit on the component and released new version with the following changes:

Implemented enhancements:

  • Added changelog
  • Added ability to configure update entities interval in seconds (Integrations -> Integration Name -> Options) #31
  • Added validation to add new integration, display error in case printer is unreachable or unsupported #15 #11
  • Moved code to new file structure
  • More logs added for easier debugging
  • Removed service hpprinter.save_debug_data
  • Added option to store debug files from Integration UI -> Option (more details in README)

Fixed bugs:

  • Fix entities / device / device’s area changing names is being reset after restart #24 #28 #39
  • Moved [Updating 2020-04-14 09:21…] to DEBUG #39
1 Like

I did some digging, and it looks like this logging is happening for the following line of code…

I have the same issue with my Laser Jet Pro M118DW which is a monochrome printer. There was a code change around that line for this issue:

Am wondering if this gets resolved with this commit.

Hi,
I tried to include the code of @Johann_Edelmuller (Thanks for that code!)

at a new Manual Card via the Lovelace UI. (Before I had to figure out, how to include those custom-cards used :slight_smile: - took me some time.
My sensor states are available.
But the last sensor values are not included in the markdown.

Maybe someone here has any idea, whats wrong.
Screenshot-HPPrinter-Code-error

Here is the Manual Card Code:

type: 'custom:vertical-stack-in-card'
cards:
  - type: entities
    entities:
      - type: 'custom:text-divider-row'
        text: HP 6970 Infos
      - type: 'custom:bar-card'
        columns: 4
        entities:
          - sensor.hp_6970_ink_black
          - sensor.hp_6970_ink_cyan
          - sensor.hp_6970_ink_magenta
          - sensor.hp_6970_ink_yellow
        height: 200px
        min: 0
        max: 100
        width: 100px
        direction: up
        align: center-split
        title_position: inside
        severity:
          - color: '#ff0000'
            value: 10
          - color: '#bf4040'
            value: 25
          - color: '#d3db39'
            value: 60
          - color: '#40bf40'
            value: 100
  - type: markdown
    content: >
      [HP 6970 Weboberfläche](http://192.168.1.66)


      - <ha-icon icon="mdi:counter"></ha-icon> - Druck Counter:
      **[[sensor.hp_6970_printer  ]]** Seiten

      - <ha-icon icon="mdi:cancel"></ha-icon> - Druck ABBRÜCHE:
      **[[sensor.hp_6970_printer.attributes.Cancelled ]]** Seiten

      - <ha-icon icon="mdi:scanner"></ha-icon> - Scan Vorgänge:
      **[[sensor.hp_6970_scanner ]]** Seiten

Regards,
Jörg

The card had chance his options… and i habe also chance the look!

lovelace.yaml

               - type: custom:text-divider-row
                  text: HP Photosmart 5510 Infos ### HP Photosmart 5510 B111a 
                - entity: binary_sensor.hp_photosmart_5510_b111a_connectivity
                - type: custom:bar-card
                  style: |-
                    bar-card-value {
                      margin-right: auto;
                      font-size: 23px;
                      font-weight: bold;
                      text-shadow: 1px 1px #0005;
                    }
                  columns: 4
                  entity_row: true
                  direction: up
                  stack: horizontal
                  entities:
                    - color: black
                      entity: sensor.hp_photosmart_5510_b111a_ink_black
                      name: Black
                    
                    - color: '#00ffff'
                      entity: sensor.hp_photosmart_5510_b111a_ink_cyan
                      name: Cyan
                  
                    - color: '#ff00ff'
                      entity: sensor.hp_photosmart_5510_b111a_ink_magenta
                      name: Magenta
                     
                    - color: '#ffff00'
                      entity: sensor.hp_photosmart_5510_b111a_ink_yellow            
                      name: Yellow 
                                       
                  height: 150px
                  min: 0
                  max: 100
                  padding: 10px
                  target: 20
                  title_position: bottom
                  align: center-split
                  icon_position: inside
                  unit_of_measurement: '%'
                  width: 100%
                 # color: white
    
            - type: markdown
              style: |
                 ha-card {
                   font-size: 18px;
                 }
              content: |
                     [HP Photosmart 5510 B111a Weboberfläche](http://192.168.1.121)
                     
                     - <ha-icon icon="mdi:counter"></ha-icon> - Druck Counter: **{{states('sensor.hp_photosmart_5510_b111a_printer')}}** Seiten
                     - <ha-icon icon="mdi:cancel"></ha-icon> - Druck ABBRÜCHE: **{{states.sensor.hp_photosmart_5510_b111a_printer.attributes.Cancelled}}** Seiten
                     - <ha-icon icon="mdi:scanner"></ha-icon> - Scan Vorgänge: **{{states('sensor.hp_photosmart_5510_b111a_scanner')}}** Seiten
                     - <ha-icon icon="mdi:bible"></ha-icon> - Papier Stau: **{{states.sensor.hp_photosmart_5510_b111a_printer.attributes.Jams}}** mal
            - type: entities
              entities:
                - entity: sensor.hp_photosmart_5510_b111a_ink_black
                  style: |
                    :host {
                     --paper-item-icon-color: black;
                    }
                  type: custom:multiple-entity-row
                  name: Ink Black
                  icon: mdi:invert-colors
                  name_state: Füllstand
                  entities:
                    - attribute: Installed At
                      name: Eingebaut am
                    - attribute: Warranty Expiration Date
                      name: Läuft ab am
                    
                - entity: sensor.hp_photosmart_5510_b111a_ink_cyan
                  style: |
                    :host {
                     --paper-item-icon-color: cyan;
                    }
                  type: custom:multiple-entity-row
                  name: Ink Cyan
                  icon: mdi:invert-colors
                  name_state: Füllstand
                  entities:
                    - attribute: Installed At
                      name: Eingebaut am
                    - attribute: Warranty Expiration Date
                      name: Läuft ab am
                - entity: sensor.hp_photosmart_5510_b111a_ink_magenta
                  style: |
                    :host {
                     --paper-item-icon-color: magenta;
                    }
                  type: custom:multiple-entity-row
                  name: Ink Magenta
                  icon: mdi:invert-colors
                  name_state: Füllstand
                  entities:
                    - attribute: Installed At
                      name: Eingebaut am
                    - attribute: Warranty Expiration Date
                      name: Läuft ab am
                - entity: sensor.hp_photosmart_5510_b111a_ink_yellow
                  style: |
                    :host {
                     --paper-item-icon-color: yellow;
                    }
                  type: custom:multiple-entity-row
                  name: Ink Yellow
                  icon: mdi:invert-colors
                  name_state: Füllstand
                  entities:
                    - attribute: Installed At
                      name: Eingebaut am
                    - attribute: Warranty Expiration Date
                      name: Läuft ab am
1 Like

A general question…
Has the filling level been below 20% at any time?
My black seems to be now at 20% for 14 days…(2 Home offices and 1 Homeschooling victim).
These figures are always in 10% steps?
What is your experience?
Greets
Jörg

Just installed v109.0 and get this in the log:

hpprinter: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this

Please install from HACS or copy to hp_printer just the content of custom_components/hp_printer into it

this is a warning, since 109 just released I didn’t implement it yet (caused issue), will do that in the upcoming few days

No probs, no rush.

Just a short hint, for beginners (like me)…
I struggled with @Johann_Edelmuller nice script - even with hints from him directly.
So I reduced the script and the integration via Manual Card has finally been easy (after hours of trying to get the complete script running).

I posted my infight here:

My Printer Frontend looks now like this - the Printer Link I will try to add as final step.
HP-Ink-Card


Regards,
Jörg

1 Like

All sorted and no errors now