core: HASS 2021.11.0 - Octoprint failed to import or configure

The problem

After upgrading to 2021.11.0, Octoprint setting wasn’t imported. And I can add octoprint to integration. It ask permission on Octoprint side but got en error in HASS.

What version of Home Assistant Core has the issue?

core-2021.11.0

What was the last working version of Home Assistant Core?

core-2021.10.7

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Octoprint

Link to integration documentation on our website

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

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2021-11-03 22:02:34 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/octoprint/config_flow.py", line 191, in _async_get_auth_key
user_input[CONF_API_KEY] = await octoprint.request_app_key(
File "/usr/local/lib/python3.9/site-packages/pyoctoprintapi/octoprint_client.py", line 39, in request_app_key
raise OctoprintException("Timeout waiting for authorization")
pyoctoprintapi.exceptions.OctoprintException: Timeout waiting for authorization

Additional information

Octoprint was up and running when updating to 2021.11.0. Same when trying to add new integration.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 29 (8 by maintainers)

Most upvoted comments

Same failure here after removing the YAML integration and trying to reconfigure it through the UI. After confirming the permissions dialog on OctoPrint’s side HA fails with an “Unexpected error” and no logs.

unexpected_error

No proxy, no timeout, and no difference after restarting both HA and OctoPrint.

I did not, that was it! It’d be nice if this was mentioned in the documentation somewhere or if the error message pointed users in the right direction.

[…] in my case the bundled discovery plugin was disabled. Enabling that has worked for me […]

I confirm that by enabling it the integration wizard completes and sensors are discovered, but it also has to be kept enabled for the integration to continue working.

Are you talking about HomeAssistant Discovery?

No, its’s OctoPrint’s own Discovery plugin.

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 has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

I don’t mean to pile on here and hopefully this is a bit more info than “I also have this problem” but I just discovered that half of the integration also become unavailable and does not come back if you shut down Octoprint and restart it. This seems like a large bug to me, I don’t want to have to remove and readd the Octoprint integration every single time I shut down the machine that Octoprint is running on. I lost the bed temp and tool temp sensors and they have not come back.

There is an open PR to add the sensors once the printer is back online. Currently pending a PR and merge. https://github.com/home-assistant/core/pull/59666

If having SSDP/UPNP/ZeroConf discovery enabled at all times for your OctoPrint instance is not desirable, a workaround could be restricting the plugin to listen on the loopback address and/or an interface you’re not using (wireless if you’re using wired and vice versa). See the official docs and this ~/.octoprint/config.yaml snippet:

  discovery:
    address: 127.0.0.1
    interfaces:
      - wlan0
      #- eth0

By quickly skimming over the source for HA’s integration, pyoctoprintapi and OctoPrint’s Discovery plugin, it’s not immediately obvious to me why the latter needs to be enabled since the client library seems to interact directly with the API through its hostname. A proper look could shed some light, though.

I was able to get the temperature sensors (remove the integration and re-add), but the your 3D printer needs to be actually turned on. I had the following messages in the homeassistant.log which triggered me

2021-11-04 11:51:09 ERROR (MainThread) [homeassistant.components.octoprint] Unable to retrieve printer information: Printer offline
2021-11-04 11:51:09 ERROR (MainThread) [homeassistant.components.octoprint.sensor] Printer appears to be offline, skipping temperature sensors