I’m trying to get a fleet of Xerox printers at my work in Home Assistant so we can better monitor them. I found the OID and I’m able to retrieve the “hrPrinterDetectedErrorState”. The issue I’m having is how the data comes into the sensor.
" ```
"This object represents any error conditions detected
by the printer. The error conditions are encoded as
bits in an octet string, with the following
definitions:
Condition Bit #
lowPaper 0
noPaper 1
lowToner 2
noToner 3
doorOpen 4
jammed 5
offline 6
serviceRequested 7
inputTrayMissing 8
outputTrayMissing 9
markerSupplyMissing 10
outputNearFull 11
outputFull 12
inputTrayEmpty 13
overduePreventMaint 14"
I’ve been beating my head against the wall all day trying to figure this out, because when SNMP pulls the data into home assistant, it gives the data as a HEX value. Soo, something like Low Paper would be 10000000, but it comes into Home Assistant as \x80. If a printer has multiple issues it may list out \x80\x20, which would be Low Paper and Low Toner. I need to be able to take the values it is pulling in, and split them up, I don’t need the \x part, but the 2 numbers are crucial to determine exactly what is wrong with a machine. In my configuration.yml file each printer has an entry like this
- platform: snmp
name: Language Hallway Printer Error
host: 10.xx.xx.xx
community: public
baseoid: .1.3.6.1.2.1.25.3.5.1.2.1
accept_errors: true
One printer may return \x00, another may return \x01\x04. If I could store the values like “00”, “01”, “04”, I could then use the value_template to go along with a human error code. But I’m struggling to figure out how to do that. When I put SNMP in debug mode I can see some printers send really weird info like !\x00 … Not sure what the exclamation point is for, but… Any help is appreciated