HP Printer over SNMP

I am trying to adapt this to my HA.

Code below is running as a package. I am trying to mirrow the setup for the HP Printer over SNMP by the original code poster @mirekmal. If you had a moment and could take a look and offer suggestions. Realizing this is not complete, but trying to mimic what you have. thanks.

# Printer information via SNMP

# Black toner
- platform: snmp
  name: 'e120n_black_capacity'
  host: 192.168.2.6
  baseoid: 1.3.6.1.2.1.43.11.1.1.6.1.1
  accept_errors: true
  scan_interval: 90
  # unit_of_measurement: '%'

- platform: snmp
  name: 'e120n_black_remaining'
  host: 192.168.2.6
  baseoid: 1.3.6.1.2.1.43.11.1.1.9.1.1
  accept_errors: true
  scan_interval: 90
  # unit_of_measurement: '%'

- platform: template
  sensors:
    cp1515n_black_level:
      friendly_name: "Black Toner Level"
      unit_of_measurement: '%'
      value_template: "{{ (states('sensor.cp1515n_black_remaining')|float / states('sensor.cp1515n_black_capacity')|float * 100) | round(0) }}"

e120n_printer_error:
  friendly_name: "Printer Error"
  value_template: >-
    {% if is_state('sensor.e120n_printer_error_code', '0') %}
      Paper Jam
    {% elif is_state('sensor.e120n_printer_error_code', '1') %}
      Cover Open
    {% elif is_state('sensor.e120n_printer_error_code', '2') %}
      Toner Status
    {% else %}  
      Unknown
    {% endif %}

I was brought here to help.

For Lexmark printers

Print count:
.1.3.6.1.2.1.43.10.2.1.4.1.1

Consumables:
(you need to find out the number of consumables you have in the printer, snmpwalk can help here. n is an integer between 1 and 30-40)
  item type/name:
    .1.3.6.1.2.1.43.11.1.1.6.1. + n
  item capacity:
    .1.3.6.1.2.1.43.11.1.1.8.1. + n
  item left (of capacity):
    .1.3.6.1.2.1.43.11.1.1.9.1. + n

If item left == -1 "OK"
If item left == -2 "unknown"
If item left == -3 "some left" # unknown amount/less than you can detect.

Warning messages:
.1.3.6.1.2.1.43.18.1.1.8.1.29
.1.3.6.1.2.1.43.18.1.1.8.1.31
.1.3.6.1.2.1.43.18.1.1.8.1.518
.1.3.6.1.2.1.43.18.1.1.8.1.305


Basic information:
  Printer:
    .1.3.6.1.4.1.641.2.1.2.1.2.1
  Printer name:
    .1.3.6.1.2.1.1.5.0
  Serial #:
    .1.3.6.1.4.1.641.2.1.2.1.6.1
  Date of installation:
    .1.3.6.1.4.1.641.6.2.3.1.7.1

I have the same OIDs for HP and Nashuatec also if anyone is interested.

@Hellis81 - Does item capacity and item left both refer to the black toner? What about individual warning messages. Can you tell me what each refers to? I am not at home and would have to do another snmpwalk to see if what I get is the same what your getting.

Yes

.1.3.6.1.2.1.43.11.1.1.6.1.1

Is probably “Black toner”

.1.3.6.1.2.1.43.11.1.1.8.1.1

Could be 10000

.1.3.6.1.2.1.43.11.1.1.9.1.1

Might be 5000

And the three above then means the Black toner is at 50%.

If you replace the last digit to a 2 you might get a color toner, or rollers, service kit, staples, image unit or anything else that it reports.

The warning messages is kind of a mess.
In my Excel file I just group them all in to one string and add a new line in between.
Sometimes they are all the same or sometimes they show the same thing differently or different things all together.
I have not really understood it. But for my use case, I just need all warning messages

Even from the original poster and from searching google I don’t see OID’s start with a ‘.’ When you reference them you begin with the dot. Is that correct?

I believe it depends on the language you use to get the data.
Some require the dot some don’t.
I haven’t put much thought to it, but I do know that VBA requires the dot.

@Hellis81 Just curious how did you setup your SNMP printer? I ask because I setup mine as a package and it seemed to be fine until an update for HA came out yesterday which forced me to revert back to a older backup.

I don’t have a printer at home or connected to HA.
I just manage all printers at work using Excel VBA script.
Can’t help you