home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.71k stars 28.87k forks source link

IPP returns ink level "-2" when printer is in standby/sleep/(Unavailable) mode #33892

Closed ricarva closed 4 years ago

ricarva commented 4 years ago

The problem

Environment

Problem-relevant configuration.yaml

Not configured in YAML

Traceback/Error logs

2020-04-09 12:30:03 ERROR (MainThread) [homeassistant.components.ipp] Error fetching ipp data: Invalid response from API: Timeout occurred while connecting to IPP server. 2020-04-09 14:28:03 ERROR (MainThread) [homeassistant.components.ipp] Error fetching ipp data: Invalid response from API: ('HTTP 500', {'content-type': None, 'message': '', 'status-code': 500}) 2020-04-09 15:08:12 ERROR (MainThread) [homeassistant.components.ipp] Error fetching ipp data: Invalid response from API: Timeout occurred while connecting to IPP server.

Additional information

The IPP integration seems to be mishandling my printer when it goes into sleep/standby mode.

Most notably, ink levels are reported as "-2%" for all 5 cartridges as long as the printer is in sleep mode, with the correct values coming up once I wake/turn on the device.

probot-home-assistant[bot] commented 4 years ago

Hey there @ctalkington, mind taking a look at this issue as its been labeled with a integration (ipp) you are listed as a codeowner for? Thanks!

ctalkington commented 4 years ago

Thanks for the report, what make and model is your printer?

ricarva commented 4 years ago

Thanks for the report, what make and model is your printer?

A Canon Pixma TS6350.

Let me know if you need any other info.

ctalkington commented 4 years ago

Just to confirm, the inks levels are correct initially? Ive seen a few cases where printers like to drop in integers into the marker values but i havent found a good documentation source for what the integers mean. I need to deep dive into CUPS to see if they catch amything like this for more insoght because marker-levels is never actually defined in the IPP Specs that ive searched

ctalkington commented 4 years ago

If you are able to provide a debug dump from your printer by running direct python script, please see https://github.com/ctalkington/python-ipp/blob/master/examples/debug.py and open an issue on that repo with your printer make and model plus the bin file that is produced.

That allows me to expand the tests to cover your printers manufacturer specific implementation.

ricarva commented 4 years ago

Just to confirm, the inks levels are correct initially? Ive seen a few cases where printers like to drop in integers into the marker values but i havent found a good documentation source for what the integers mean. I need to deep dive into CUPS to see if they catch amything like this for more insoght because marker-levels is never actually defined in the IPP Specs that ive searched

Yes, values are correct initially, and any time the printer wakes up; once it goes into sleep mode again, values drop back down to -2.

If you are able to provide a debug dump from your printer by running direct python script, please see https://github.com/ctalkington/python-ipp/blob/master/examples/debug.py and open an issue on that repo with your printer make and model plus the bin file that is produced.

That allows me to expand the tests to cover your printers manufacturer specific implementation.

'Will give it a try.

ctalkington commented 4 years ago

Ok it seems that negatives are defined as part of CUPS.

A value of -1 indicates the level is unavailable, -2 indicates unknown, and -3 indicates the level is unknown but has not yet reached capacity

I suspect the printer IPP continues to run during sleep, but however it queries the ink levels isnt available during sleep. I made a PR to filter out negative values from being displayed and provide no state instead

ricarva commented 4 years ago

Thanks for the quick response, @ctalkington

I just updated to HA Core 0.108.2, and your code change is up and running.

No more "-2"; ink levels are now listed as "unknown" when the printer is in sleep mode.

Ideally, though, shouldn't the behavior be to not go from "90%" to "unknown"?

seaniedan commented 3 years ago

I get "unavailable" on my Canon printer when in sleep mode. Surely this would be a good case to 'retain' the last known good value?

jtommi commented 6 months ago

Hello @ctalkington I'm having the issue with an HP LaserJet Pro MFP M127fw Any troubleshooting I can do?

isXander commented 5 months ago

Seems to be a regression. I'm observing this on 2024.1.1