Canon printer. I had it working and then it partly broke. Or the “Status” broke. every other OID value worked. I got it working again but not sure it’s right. Rather have it right than just kind of working. So here’s the deal.
This is what I had:
- platform: snmp
name: Canon MF8580CDW Status
host: 192.168.0.6
baseoid: 1.3.6.1.2.1.25.3.5.1.2.1
accept_errors: true
scan_interval: 1000
value_template: >-
{% if value|int(base=16) is equalto 0 %} <- After value_template
OK
{% else %}
Failed
{% endif %}
So it would return OK when the printer was fine but now errors out. I changed it to:
- platform: snmp
name: Canon MF8580CDW Status
host: 192.168.0.6
baseoid: 1.3.6.1.2.1.25.3.5.1.2.1
accept_errors: true
scan_interval: 1000
value_template: >
{% if value == "" or value == null or value == " " %}
OK
{% else %}
Failed
{% endif %}
and it returns that it’s good and Failed if I like pull the paper try out. So you are like what’s the problem? Well in Windows I run snmpget and get:
snmpget -r:192.168.0.6 -t:10 -o:.1.3.6.1.2.1.25.3.5.1.2.1
SnmpGet v1.01 - Copyright (C) 2009 SnmpSoft Company
[ More useful network tools on http://www.snmpsoft.com ]
OID=.1.3.6.1.2.1.25.3.5.1.2.1
Type=OctetString
Value=
So it’s an OctetString and according to this website:
If that OID is all good and there are no printer issues it’s returns blank.
That said for my “working” value_template only one of those three options that work is the space between the quotes. So it’s “blank” when there is a space which I’m not sure is what they mean by blank. When it errors like if the paper tray is out I get back A0. What is the correct way to be dealing with this hardware and SNMP output?