As Octoprint has moved from YAML to GUI as of 2021.11, I’m trying to re-add the integration to my Home Assistant after removing the YAML configuration. I’m running into some problems here as the GUI comes back with 'Unexpected error" after clicking “Allow” in OctoPrint. In OctoPrint, a registered application key is added nevertheless.
Via the log I’ve been able to get the following information:
Failed to get an application key: Application key creation request has been denied or timed out
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/octoprint/config_flow.py", line 99, in async_step_get_api_key
await self.api_key_task
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 33, in request_app_key
status_response = await self._api.appkeys_check_status(request_id)
File "/usr/local/lib/python3.9/site-packages/pyoctoprintapi/api.py", line 81, in appkeys_check_status
raise ApiError("Application key creation request has been denied or timed out")
pyoctoprintapi.exceptions.ApiError: Application key creation request has been denied or timed out
These are the settings in the GUI I use for setup:
Hi there, instead of the native octoprint integration, I think that it is better to use the HomeAssistant Discovery plugin in octoprint and use mqtt discovery to add the device. With this method, there are more sensors inbuilt and also there is option to add more custom sensors as mqtt sensors.
Hope you could try it out. If you want to add camera, just use the generic camera integration.
Sound like a valid option, I’ll definitely look into that! Thanks for sharing.
Nevertheless, the official integration should work properly as well, shouldn’t it?
Actually I haven’t seen such an error being reported with octoprint integration. You could open a bug report to get developer assistance. Also i haven’t used the native integration till now because I find the other more useful.
I was having the same issue and found that in my OctoPrint, the bundled discovery plugin was disabled. Enabling this plugin allowed me to add it to home assistant using the integrations GUI