Custom Component - HP Printer

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

Hi -I hoping to get some assistance.

I’m relatively new to HomeAssistant but have a technical back ground.

I’ve just downloaded this integration to bring additional entities into HA for display (compared to the IPP integration). I’ve been able to download and install it but when I try to add the printer it fails to find the host.

I have two printers : a Brother Laser and a HP Officejet, The Brother shows up in the IPP integration and the native Brother integration but the HP only showns up in the IPP.

Both printers are on the same VLANs but a separate VLAN from HA (I have the firewalls rules in place to allow access (well at least I think I do based on the IPP and Brother native access)).

Below is a snippet of the IPP for the HPshow that HA can reach the IP of the printer

info: 'Officejet Pro 8600 [E12BE3]'
serial: xxxxxxxxxx
location: ''
state_message: null
state_reason: null
command_set: 'PCL3GUI,PCL3,PJL,JPEG,PCLM,URF,DW-PCL,802.11,802.3,DESKJET,DYN'
uri_supported: 'ipp://172.18.22.13/ipp/printer'
friendly_name: HP Officejet Pro 8600
icon: 'mdi:printer'

Any assistance as to help resolve this would be appreciated.

This thread is not related to IPP component, I suggest to find the right thread and get assistance over there

Hi @bar

Thank you for responding - I only made reference to the IPP component because its working and able to reach the printer using the specified IP address (172.18.22.13).

I am trying to use the HP Printer integration but when I enter the IP - 172. 18.22.13 for the host I get the following error

image

Is there anything I need to show to assist with debugging the issue.

Thanks

Are you on the latest version?
Can you attach debug logs of the component?

This is a snapshot of the integration in HACS (I only installed a few days ago and there has been no updates that I’ve seen)

This is the error log

Thanks

Thanks for the log, will check it

2020-05-06

Fixed bugs:

  • Fix Log is filling with errors #57

Implemented enhancements:

  • More descriptive error message when unable to access printer’s API at setup or changing options