Core: IPP component can't handle an offline printer

Created on 31 May 2020  ·  17Comments  ·  Source: home-assistant/core

The problem


IPP is able to discover a local printer and setup everything correctly.

Unfortunately if the printer becomes offline, IPP will just fill your logs.

Worst, when restarting HA and the printer is offline, it will just delay the all process.

Environment

  • Home Assistant Core release with the issue: 0.110.4
  • Last working Home Assistant Core release (if known): None
  • Operating environment (Home Assistant/Supervised/Docker/venv): venv
  • Integration causing this issue: ipp
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/ipp/

Problem-relevant configuration.yaml


setup using config flow after auto-discovery

Traceback/Error logs

2020-05-31 15:40:11 ERROR (MainThread) [homeassistant.components.ipp] Error fetching ipp data: Invalid response from API: Error occurred while communicating with IPP server.
2020-05-31 15:40:11 WARNING (MainThread) [homeassistant.config_entries] Config entry for ipp not ready yet. Retrying in 20 seconds.

Additional information

The expected behaviour would be for when printer is off the IPP entities would become disabled. That, until autodiscovery finds the printer again (when turned on)

ipp

Most helpful comment

For me it would be enough not to spam the log file....

All 17 comments

ipp documentation
ipp source
(message by IssueLinks)

I would say the expected behavior here is not the established behavior of HA config entries. The config entry logic will backoff on its setup the more it fails (ie receives ConfigNotReady).

IPP is also async so it shouldnt be hindering other integrations as no IO should be blocking.

I fully understand what you said. But maybe we need to come up with a better handling of this situation. It happens also with several TV's.

If the device is not ready it should become disabled, and not enter the connection retry loop, at least after a retry timeout.

I'm still debugging what is delaying my startup ¯_(ツ)_/¯

I would say instant disable is a bit harsh. I think the backoff works but im not sure how long it retries or the upper limit at the moment

It sounds like 2 issues here. One is when we restart ha with ConfigNotReady I see this with wled too. Ideally it should print one error and retry in the background without flooding the logs. The second issue sounds like when the printer becomes unavailable it should only print 1 error and not print anymore while it's in that state. I think filling up the logs is a checkpoint for the quality scale isn't it?

The Brother integration has the same "problem". It was tried to fix but the PR was rejected: https://github.com/home-assistant/core/pull/31524

Same issue here.
The "normal" situation should be "printer turned off" (i.e. not wasting energy).
Most printers nowadays sent an announcement when they are turned on; why not use that to trigger configuration and/or availability?

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?

For me it would be enough not to spam the log file....

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Still happens on 0.116.2

The printer isn't even always offline when it occurs. Both HA and printer are connected via cable.

On 116.4, I still get

Oct 16 07:37:36 arrakis hass[2877507]: 2020-10-16 07:37:36 ERROR (MainThread) [homeassistant.components.ipp] Error fetching ipp data: Invalid response from API: Error occurred while communicating with IPP server.
Oct 16 07:37:36 arrakis hass[2877507]: 2020-10-16 07:37:36 WARNING (MainThread) [homeassistant.config_entries] Config entry for ipp not ready yet. Retrying in 80 seconds

I know. The printer is switched off. And no, that is not an error, it is the normal condition.

We are running Home Assistant. At home printers are usually offline.

This integration could use a different approach which does not need the printer to be online 24/7

Else users find cumbersome work arounds: https://community.home-assistant.io/t/internet-printing-protocol-ipp-integration-show-last-know-sensor-state-when-printer-is-offline/204081

For the record, this still happens in Home Assistant 0.118.0.

With 0.118.0 it has become even worse:

2020-11-18 21:55:54 ERROR (MainThread) [homeassistant.components.ipp] Error fetching ipp data: Invalid response from API: ('Unexpected printer status code', {'status-code': 1030}) 2020-11-18 21:55:54 WARNING (MainThread) [homeassistant.config_entries] Config entry for ipp not ready yet. Retrying in 80 seconds 2020-11-18 21:55:54 ERROR (MainThread) [homeassistant.components.ipp] Error fetching ipp data: Invalid response from API: ('Unexpected printer status code', {'status-code': 1030}) 2020-11-18 21:55:54 WARNING (MainThread) [homeassistant.config_entries] Config entry for ipp not ready yet. Retrying in 80 seconds 2020-11-18 21:55:54 ERROR (MainThread) [homeassistant.components.ipp] Error fetching ipp data: Invalid response from API: ('Unexpected printer status code', {'status-code': 1030}) 2020-11-18 21:55:54 WARNING (MainThread) [homeassistant.config_entries] Config entry for ipp not ready yet. Retrying in 80 seconds 2020-11-18 21:56:09 ERROR (MainThread) [homeassistant.components.ipp] Error fetching ipp data: Invalid response from API: Error occurred while communicating with IPP server. 2020-11-18 21:56:09 WARNING (MainThread) [homeassistant.config_entries] Config entry for ipp not ready yet. Retrying in 80 seconds 2020-11-18 21:56:09 ERROR (MainThread) [homeassistant.components.ipp] Error fetching ipp data: Invalid response from API: Error occurred while communicating with IPP server. 2020-11-18 21:56:09 WARNING (MainThread) [homeassistant.config_entries] Config entry for ipp not ready yet. Retrying in 80 seconds

More than 8500 log entries in the last 1.5 days

@hogend that looks like a different issue, do you use CUPS or such to share printerfrom another device? Those 1030 errors mean not found whjch means it connects but something is configured wrong (from the searches ive done on such error code).

If you would open an issue about error code 1030 not being handled. We could likely abort entirely in such cases.

@hogend that looks like a different issue, do you use CUPS or such to share printerfrom another device? Those 1030 errors mean not found whjch means it connects but something is configured wrong (from the searches ive done on such error code).

If you would open an issue about error code 1030 not being handled. We could likely abort entirely in such cases.

You are right about the error code 1030 coming from CUPS. I will create an issue for that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Konstigt picture Konstigt  ·  3Comments

arangates picture arangates  ·  3Comments

moskovskiy82 picture moskovskiy82  ·  3Comments

sogeniusio picture sogeniusio  ·  3Comments

sibbl picture sibbl  ·  3Comments