Nice job! I will try it with my Brother color-printer.
No, not working
I have an MFC-J497DW, the status page shows exactly the same html-info as shown in the post above by @DasLetzteEinhorn
The four toner-sensors are there but they all show the state unknown
.
I put the file brother-printer-status.py
in the apps-directory.
My apps.yaml:
---
brother-printer-status:
module: brother-printer-status
class: BrotherPrinterStatus
host: 192.168.x.xyz
status_interval: 30
use_mqtt: true
mac: xx:xx:xx:xx:xx:xx
retain: true
My AppDaemon config is the default one.
I checked the messages on MQTT, I see the messages on the homeassistant/sensor/toner-xyz topics, but no topic that displays the toner-values.
Could you save and show me status and information pages from your printer?
Only a status page, see above. No information page present.
Removed, see new post.
Your printer doesn’t have this page? http://IP_ADDRESS/general/information.html
Please send page as text on pastebin or hastebin.
No, it only has a status-page.
I’m testing some more by not using MQTT, still not working.
Some more progress:
In your code I changed toner-
to toner_
(I seem to remember that “-” is not allowed anymore, must be “_”) and now I see in the AppDaemon-log:
2019-11-09 11:40:06.406341 INFO AppDaemon: Initializing app brother-printer-status using class BrotherPrinterStatus from module brother-printer-status
2019-11-09 11:40:07.201245 WARNING AppDaemon: brother-printer-status: Entity sensor.printer_toner_magenta not found in AppDaemon
2019-11-09 11:40:07.224962 WARNING AppDaemon: brother-printer-status: Entity sensor.printer_toner_cyan not found in AppDaemon
2019-11-09 11:40:07.251002 WARNING AppDaemon: brother-printer-status: Entity sensor.printer_toner_yellow not found in AppDaemon
2019-11-09 11:40:07.273977 WARNING AppDaemon: brother-printer-status: Entity sensor.printer_toner_black not found in AppDaemon
Any idea what could be wrong?
After doing some more research, looks like using set-state
is the reason?
We are not supposed to use this command, only for testing.
When I have some time on my hands, I will try to turn this into a custom_component…
I will also work to turn this to custom_component in the next week
That’s good news!
I can help testing, reviewing code, if you want.
When I have logged in, these are the options:
When I select the option Firmware Update, this is shown:
This page is not accessible when not being logged in. Only the status-page is accessible without being logged in:
I found new way to get data from the printer. Could you run script for test and paste here the result? You can download script here: https://github.com/bieniu/ha-brother/blob/245d95591edf46cf65841ef1926bc9ddd89a03ac/brother.py
How to run the script:
$ python3 -m pip instal pysnmp --user
$ python3 brother.py PRINTER_IP_ADDRESS
Nice. I would love to test with my HL-L2380DW all-in-one printer.
I will not try your script, sorry.
I looked at using snmp before (snmp-walked my printer) and I found there is nothing of interest that I would want to use from my printer.
I’m interested in the contents of the ink-containers of my printer, this info is not available via snmp, only an indication that containers are either OK for use or need to be replaced.
You are not right. Printer send a lot of data via snmp but in hex format. I found a way to decode this data. This is an example of data from DCP-L3550CDW retreived via snmp: https://pastebin.com/qNUfwx7X
Please give a try my script.
Ok, sorry, will do
Yes,it works, see here: https://pastebin.com/dXRTK5WP
After looking in more detail: I’m impressed, good job!
Thanks, I have positive result from four models so it seems that method works.