bieniu/brother

Brother HL-5350DN: noSuchName, 2

Closed this issue · 16 comments

Hi,

I'm trying to integrate a Brother HL-5350DN into Home Assistant. Since it wouldn't connect, I used the test script provided here. The script reports the following:

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:brother:Using host: brn001ba9e7ce21.lan
noSuchName, 2
ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<handle_timeout() running at <string>:4> wait_for=<Future pending cb=[Task.task_wakeup()]>>

Is it one of the older, unsupported printers?
What can I do to add support for it?

Thanks

noSuchName means that the library is not able to find the device in the network. Use IP address.

Thanks for the quick response. Unfortunately, the output is exactly the same.
I can ping the device (by name and by IP address) and I can see open ports (161/udp is amongst the list).

Sorry, I was wrong, "nosuchname" means some OIDs are not available for your printer. You can check what OIDs are used here https://github.com/bieniu/brother/blob/master/brother/const.py#L86-L95

Thanks, that helped: I tried all of the OIDs with snmpwalk -v2c -c public IP OID and all but one OID reported data (including ATTR_COUNTERS). The failing one is ATTR_FIRMWARE. I noticed that I'm not on the latest Network firmware (1.0.4 vs. 1.0.5), I'll try an update and see if that helps. If not,

The firmware update makes no difference. If I remove ATTR_FIRMWARE, the output is as follows:

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:brother:Using host: 192.168.17.118
DEBUG:brother:RAW data: {'1.3.6.1.2.1.43.7.1.1.4.1.1': '2004', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.8.0': ['110104000061a8', '31010101410101', '03630101035401', '01016601010135', '01010136010101', '62010101'], '1.3.6.1.4.1.2435.2.3.9.1.1.7.0': 'MFG:Brother;CMD:PJL,PCL,PCLXL;MDL:HL-5350DN series;CLS:PRINTER;', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.11.0': ['41010400000000', '82010400000000', '7301040000777d', '8601040000961e', '7701040001205a', '78010400010af6', '8101040000777d', '8901040000777d'], '1.3.6.1.2.1.43.10.2.1.4.1.1': '69411', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0': 'A3J574454', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.2.0': 'ENERGIESPAREN   \rTROMMEL ERSETZ. ', '1.3.6.1.2.1.1.3.0': '8590', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.10.0': ['00010400010f23']}
RAW data: %s {'1.3.6.1.2.1.43.7.1.1.4.1.1': '2004', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.8.0': ['110104000061a8', '31010101410101', '03630101035401', '01016601010135', '01010136010101', '62010101'], '1.3.6.1.4.1.2435.2.3.9.1.1.7.0': 'MFG:Brother;CMD:PJL,PCL,PCLXL;MDL:HL-5350DN series;CLS:PRINTER;', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.11.0': ['41010400000000', '82010400000000', '7301040000777d', '8601040000961e', '7701040001205a', '78010400010af6', '8101040000777d', '8901040000777d'], '1.3.6.1.2.1.43.10.2.1.4.1.1': '69411', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0': 'A3J574454', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.2.0': 'ENERGIESPAREN   \rTROMMEL ERSETZ. ', '1.3.6.1.2.1.1.3.0': '8590', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.10.0': ['00010400010f23']}
DEBUG:brother:Data: {'model': 'HL-5350DN', 'serial': 'A3J574454', 'status': 'energiesparen   \rtrommel ersetz.', 'uptime': datetime.datetime(2022, 4, 16, 15, 30, 37, tzinfo=datetime.timezone.utc), 'page_counter': 69411, 'drum_counter': 25000, 'black_toner_status': 21037313, 'drum_remaining_pages': 0, 'laser_unit_remaining_pages': 30589, 'pf_kit_mp_remaining_pages': 38430, 'pf_kit_1_remaining_pages': 73818, 'fuser_unit_remaining_pages': 30589}
Model: HL-5350DN
Firmware: None
trommel ersetz.sparen   
Serial no: A3J574454
Sensors data: {'model': 'HL-5350DN', 'serial': 'A3J574454', 'status': 'energiesparen   \rtrommel ersetz.', 'uptime': datetime.datetime(2022, 4, 16, 15, 30, 37, tzinfo=datetime.timezone.utc), 'page_counter': 69411, 'drum_counter': 25000, 'black_toner_status': 21037313, 'drum_remaining_pages': 0, 'laser_unit_remaining_pages': 30589, 'pf_kit_mp_remaining_pages': 38430, 'pf_kit_1_remaining_pages': 73818, 'fuser_unit_remaining_pages': 30589}
ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<handle_timeout() running at <string>:4> wait_for=<Future pending cb=[Task.task_wakeup()]>>

Is the black_toner_status as expected?

There are some other OIDs that report the firmware version (and model number etc.) that I found while capturing the firmware update traffic:

1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1 reports MODEL="HL-5350DN series"
1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.2 reports SERIAL="A3J574454"
1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.3 reports SPEC=""
1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.4 reports FIRMID="MAIN"
1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.5 reports FIRMVER="1.18"
1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.6 reports FIRMID="BRNET"
1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.7 reports FIRMID="1.0.5"

Is the black_toner_status as expected?

No

Do other values match those in the printer's web panel?

Yes, the other counters match. The black toner is at about 60%, it's hard to tell from the web page.
According to various discussions, this printer does not support displaying the toner level via SNMP. It might just report empty or OK or nothing at all. The display string is the most important information on that.

Stale issue message

Will be fixed

Stale issue message

Will be fixed

Hi, could you install brother package with this command:

pip install --upgrade git+https://github.com/bieniu/brother.git@gen-oids#brother==2.0.0

and test it with your printer?

I tried the test script example.py and it seems to look good:

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:brother:Initializing device BRN001BA9E7CE21
DEBUG:brother:RAW data: {'1.3.6.1.2.1.43.7.1.1.4.1.1': '2004', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.10.0': ['00010400011029'], '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.8.0': ['110104000061a8', '31010101410101', '03630101035401', '01016601010135', '01010136010101', '62010101'], '1.3.6.1.4.1.2435.2.3.9.1.1.7.0': 'MFG:Brother;CMD:PJL,PCL,PCLXL,POSTSCRIPT;MDL:HL-5350DN series;CLS:PRINTER;', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.11.0': ['41010400000000', '82010400000000', '73010400007677', '8601040000961e', '77010400011fb1', '78010400010abb', '81010400007677', '89010400007677'], '1.3.6.1.2.1.43.10.2.1.4.1.1': '69673', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0': 'A3J574454', '1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.2.0': 'ENERGIESPAREN   \rTROMMEL ERSETZ. ', '1.3.6.1.2.1.1.3.0': '7060'}
DEBUG:brother:Data: {'model': 'HL-5350DN', 'serial': 'A3J574454', 'firmware': None, 'status': 'energiesparen   \rtrommel ersetz.', 'uptime': datetime.datetime(2022, 9, 8, 7, 29, 27, tzinfo=datetime.timezone.utc), 'page_counter': 69673, 'drum_counter': 25000, 'black_toner_status': 21037313, 'drum_remaining_pages': 0, 'laser_unit_remaining_pages': 30327, 'pf_kit_mp_remaining_pages': 38430, 'pf_kit_1_remaining_pages': 73649, 'fuser_unit_remaining_pages': 30327}
Model: HL-5350DN
Firmware: None
trommel ersetz.sparen   
Serial no: A3J574454
Sensors data: BrotherSensors(model='HL-5350DN', serial='A3J574454', belt_unit_remaining_life=None, belt_unit_remaining_pages=None, black_counter=None, black_drum_counter=None, black_drum_remaining_life=None, black_drum_remaining_pages=None, black_ink_remaining=None, black_ink_status=None, black_ink=None, black_toner_remaining=None, black_toner_status=21037313, black_toner=None, bw_counter=None, color_counter=None, cyan_counter=None, cyan_drum_counter=None, cyan_drum_remaining_life=None, cyan_drum_remaining_pages=None, cyan_ink_remaining=None, cyan_ink_status=None, cyan_ink=None, cyan_toner_remaining=None, cyan_toner_status=None, cyan_toner=None, drum_counter=25000, drum_remaining_life=None, drum_remaining_pages=0, drum_status=None, duplex_unit_pages_counter=None, firmware=None, fuser_remaining_life=None, fuser_unit_remaining_pages=30327, image_counter=None, laser_remaining_life=None, laser_unit_remaining_pages=30327, magenta_counter=None, magenta_drum_counter=None, magenta_drum_remaining_life=None, magenta_drum_remaining_pages=None, magenta_ink_remaining=None, magenta_ink_status=None, magenta_ink=None, magenta_toner_remaining=None, magenta_toner_status=None, magenta_toner=None, page_counter=69673, pf_kit_1_remaining_life=None, pf_kit_1_remaining_pages=73649, pf_kit_mp_remaining_life=None, pf_kit_mp_remaining_pages=38430, status='energiesparen   \rtrommel ersetz.', uptime=datetime.datetime(2022, 9, 8, 7, 29, 27, tzinfo=datetime.timezone.utc), yellow_counter=None, yellow_drum_counter=None, yellow_drum_remaining_life=None, yellow_drum_remaining_pages=None, yellow_ink_remaining=None, yellow_ink_status=None, yellow_ink=None, yellow_toner_remaining=None, yellow_toner_status=None, yellow_toner=None)
ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<AsyncioDispatcher.handle_timeout() running at /home/andy/projects/brother/venv/lib/python3.10/site-packages/pysnmp/carrier/asyncio/dispatch.py:56> wait_for=<Future pending cb=[Task.task_wakeup()]>>

With one minor thing: the status contains two lines and the lines are separated only with a CR, not a LF. The output is overwritten in the test script, so
"trommel ersetz.sparen"

should actually read

"energiesparen
trommel ersetz."

Yes, I plan to add function to clean status (remove \r and unwanted spaces).

Thanks for testing and sorry that you have to wait so long 😀

No worries, thanks for having a look at this!