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
73.56k stars 30.73k forks source link

ERROR (MainThread) [homeassistant.components.ipp.coordinator] Error fetching ipp data: Invalid response from API: Timeout occurred while connecting to IPP server. #93006

Open legantois opened 1 year ago

legantois commented 1 year ago

The problem

I get regularly this message when my printer is in sleep mode

on the other side my printer is always available

Is it possible to catch these connection errors (retrying every x minutes and providing a real error only when repeated erors occur)

What version of Home Assistant Core has the issue?

core-2023.5.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

IPP

Link to integration documentation on our website

https://www.home-assistant.io/integrations/ipp

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @ctalkington, mind taking a look at this issue as it has been labeled with an integration (ipp) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `ipp` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign ipp` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


ipp documentation ipp source (message by IssueLinks)

Q916 commented 1 year ago

Same issue here

Petorrr commented 1 year ago

Same problem here, after upgrading to 2023.5.3 the following message; Invalid response from API: Timeout occurred while connecting to IPP server. (Epson ET2720 series). If I add the printer manually again via IP address, it says it is already configured, so that doesn’t help either.

Doctor-Who commented 1 year ago

Same issue here after upgraded to 2023.5.4 HP ENVY Photo 7800 series Invalid response from API: Error occurred while communicating with IPP server.

castellionair commented 1 year ago

Same issue here after upgraded to 2023.5.4 Brother DCP-L3550CDW series Invalid response from API: Timeout occurred while connecting to IPP server.

Any clue?

c0nt4x commented 1 year ago

Same here for 2 or 3 days now

Screenshot 2023-05-30 at 13 50 21
castellionair commented 1 year ago

I rebooted HA yesterday and seems the issue has gone so far!

c0nt4x commented 1 year ago

Rebooting doesn't solve it for me unfortunately.

Petorrr commented 1 year ago

I rebooted HA yesterday and seems the issue has gone so far!

I can also confirm, upgraded from 2023.5.3 to 2023.5.4, rebooted the system, and problem was gone

richlawson commented 1 year ago

Unfortunately, it's still an issue for me as well with an HP printer even after a full reboot. I'm on 2023.5.4, Supervisor 2023.04.1, HASS Operating System 10.2, Screenshot 2023-05-30 164738

agoode commented 1 year ago

I have 3 printers configured through the IPP integration. Upon each restart of Home Assistant, it's likely that one of the printers has this issue. Sometimes they are all working, and it's not always the same printer that cannot be reached. Each restart can lead to a different set of printers being unavailable.

Dregi56 commented 1 year ago

I have verified that this error occurs when Home assistant is restarted and that to avoid it, simply turn on the printer before restarting. But that's certainly not the solution...

TekFan commented 1 year ago

Nope, in my case, this happens randomly, even when the printer is online. Sometimes, it even won't work again after multiple core restart, so I have to delete and reinstall the integration.

meastman commented 1 year ago

I frequently get a timeout talking to my printer during hass startup (when hass is near 100% cpu), which would be fine except that lately it never seems to recover. According to extra logging I added locally, IPPDataUpdateCoordinator._async_update_data never gets called again if that initial update fails or times out. This appears to be a very similar issue to https://github.com/home-assistant/core/issues/90289#issuecomment-1588342217 and not reusing the coordinator across calls to async_setup_entry appears to solve the issue for me:

--- a/homeassistant/components/ipp/__init__.py
+++ b/homeassistant/components/ipp/__init__.py
@@ -20,17 +20,16 @@ PLATFORMS = [Platform.SENSOR]
 async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
     """Set up IPP from a config entry."""
     hass.data.setdefault(DOMAIN, {})
-    if not (coordinator := hass.data[DOMAIN].get(entry.entry_id)):
-        # Create IPP instance for this entry
-        coordinator = IPPDataUpdateCoordinator(
-            hass,
-            host=entry.data[CONF_HOST],
-            port=entry.data[CONF_PORT],
-            base_path=entry.data[CONF_BASE_PATH],
-            tls=entry.data[CONF_SSL],
-            verify_ssl=entry.data[CONF_VERIFY_SSL],
-        )
-        hass.data[DOMAIN][entry.entry_id] = coordinator
+    # Create IPP instance for this entry
+    coordinator = IPPDataUpdateCoordinator(
+        hass,
+        host=entry.data[CONF_HOST],
+        port=entry.data[CONF_PORT],
+        base_path=entry.data[CONF_BASE_PATH],
+        tls=entry.data[CONF_SSL],
+        verify_ssl=entry.data[CONF_VERIFY_SSL],
+    )
+    hass.data[DOMAIN][entry.entry_id] = coordinator

     await coordinator.async_config_entry_first_refresh()
richlawson commented 1 year ago

This was fixed for me in 2023.6.2: https://github.com/home-assistant/core/pull/94573

legantois commented 1 year ago

Not for me 2023-06-25 17:10:31.104 ERROR (MainThread) [homeassistant.components.ipp.coordinator] Error fetching ipp data: Invalid response from API: Timeout occurred while connecting to IPP server.

Doctor-Who commented 1 year ago

Fix with the latest release on my instance too.

JohnSmith-LT commented 1 year ago

Was working for me too but I just noticed it again for the first time 5 minutes after printing a document...

2023-07-09T10:05:47.217189806Z 2023-07-09 11:05:47.216 ERROR (MainThread) [homeassistant.components.ipp.coordinator] Error fetching ipp data: Invalid response from API: Timeout occurred while connecting to IPP server.

It resolved itself again after 1 minute though as seen in the Logbook

image

This is on 2023.7.1

Maybe it's just one of those things that isn't really an "Error" and should be marked as a "Timeout" or something else...

legantois commented 1 year ago

Hello @ctalkington, how can we help to solve this ?

I believe we should try to better catch these connection issues

Many Thanks

JohnSmith-LT commented 1 year ago

@legantois if you are a programmer or can copy+paste some scripts together then you may wish to try dealing with these in a different way, perhaps with a count of the number of times it happens and only reporting after 3 in a row... or look at what @meastman has added above...

The error is being thrown by the coordinator of the ipp component, around about line 50

https://github.com/home-assistant/core/blob/0317afeb177ba1003728db76a6f2dc3633e5d63a/homeassistant/components/ipp/coordinator.py#L50-L55

I'd look at it myself but for some reason I am not seeing it any more without any update to HA - I have re-jigged my network since reporting though so not sure if pfsense or one of my switches was playing up and causing the connection to fail - it has been moved onto a different vlan and different port on the switch...

ctalkington commented 1 year ago

there was an issue resolved in 2023.6 release cycle that could explain alot of not recovering after failure.

ultimately we are using DataUpdateCoordinator here which handles retries and logging. I get the logging can be annoying as printers do often sleep or have smart plugs involved.

the long term goal is to implement restore functionality which would maintain the ink levels between HA and device on/off/sleep. with this we would also not fail setup if device is offline.

I'm currently catching up on multiple open source projects but I hope to circle back to my WIP PR In the coming month.

Bastian007 commented 1 year ago

Facing the same issue also with 2023.11.1

Logger: homeassistant.components.ipp.coordinator
Source: helpers/update_coordinator.py:322
Integration: Internet Printing Protocol (IPP) ([documentation](https://www.home-assistant.io/integrations/ipp), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+ipp%22))
First occurred: 12:07:47 (1 occurrences)
Last logged: 12:07:47
Error fetching ipp data: Invalid response from API: Error occurred while communicating with IPP server.

It go along with Logbook entry "became unavailable" image

somansch commented 11 months ago

Facing the same random issue with current version:

Core 2023.11.3 Supervisor 2023.11.6 OS 11.1

image
jhemak commented 9 months ago

Same

smarthomefamilyverrips commented 9 months ago

Logger: homeassistant.components.ipp.coordinator Source: helpers/update_coordinator.py:332 Integration: Internet Printing Protocol (IPP) (documentation, issues) First occurred: 01:51:41 (2 occurrences) Last logged: 05:52:27

Error fetching ipp data: Invalid response from API: Timeout occurred while connecting to IPP server.

Same on 2024.1.6

@ctalkington how is the "circling back" progressing?

roshan-abady commented 6 months ago

Same here:

Logger: homeassistant.components.ipp.coordinator
Source: helpers/update_coordinator.py:347
integration: Internet Printing Protocol (IPP) (documentation, issues)
First occurred: May 1, 2024 at 3:41:54 AM (15 occurrences)
Last logged: 9:51:55 AM

Error fetching ipp data: Invalid response from API: Timeout occurred while connecting to IPP server.
AnthonyBe commented 6 months ago

I only started seeing this recently (2024.5.x?). But like others, getting regularly logged. Oddly, only on 1 of my 2 printers. I get the errors constantly on an HP Color LaserJet MFP M277dw but never on a Brother MFC-9335CDW. One obvious difference at my end is that the HP LaserJet is on WiFi, while the Brother printer is on ethernet.

Logger: homeassistant.components.ipp.coordinator
Source: helpers/update_coordinator.py:347
integration: Internet Printing Protocol (IPP) (documentation, issues)
First occurred: 13:34:06 (78 occurrences)
Last logged: 22:22:54

Error fetching ipp data: Invalid response from API: Timeout occurred while connecting to IPP server.
Dawidooox commented 2 months ago

I also encounter the same error while restarting Home Assistant and my Wi-Fi printer is turned off. Maybe this integration was designed with ethernet wired printers in mind mostly. 🤔

011V32 commented 1 month ago

Unfortunately I have the same issue.