Closed excalbian closed 4 years ago
Where does that URL come from? It seems...Not correct?
I noticed it will just spin and return to the list of integrations, if you haven't restarted after installing and starting grocy from the Supervisor addon store.
After that, when adding the integration it loaded the form for url and api key. I'm using 114.0 at the moment.
I can also say my url was my internal ip since I dont have my grocy exposed to outside world. I just had to uncheck verify cert since it will cause an issue.
That URL is the docker container ID (assigned by hassio supervisor I guess). I tried also with the LAN IP of my hassio host (raspberry pi - 192.168.x.y) as well as the docker IP (172.30.33.5). I've set both with http
and https
(https://192.168.x.y:9192/ will load Grocy from my browser, albeit with a security warning since the certificate doesn't match - which is why I have verify_ssl: false
).
Have you disabled any functions in Grocy, like the stock?
EDIT: But then it worked. I restarted HA yet again, restarted the Grocy addon yet again, and tried to add the integration yet again. And this time it worked. Absolutely no idea why. I don't think I did anything differently. The API URL that worked for me was my external one (ie. https://xxx.duckdns.org). And I had already forwarded 9192 on the router.
But here's what I had before...
I'm struggling with this too under hassio with the official grocy addon. Whatever I type into API URL produces either "Unknown error occurred" or "Invalid flow specified". Once I get the invalid flow error, I can key any garbage into the API URL and still get the same error. I've tried with internal and external URLs, plus the ingress URL, all with SSL true or false.
The instructions for hassio create two API keys (at steps 4 and 9). Is this required? I get the same result with one or two.
Grocy is installed ok - I can navigate to it using 192.168.0.66:9192 and add things in. It is also visible to the outside world using the hassio duckdns addon, so I can also navigate to https://xxxx.duckdns.org:9192. I'm running under Ubuntu 18.04 on HA 0.110.3, supervisor 234.
The way I've specified url that works for me is http://192.168.1.xx
and then port 9192, SSL off.
Am I understanding correct that everything now works for you?
The instructions for hassio create two API keys (at steps 4 and 9). Is this required? I get the same result with one or two.
I don't thing so, I guess the README could get worked over as whole, maybe with screenshots and stuff?
@SebRut It's on my todo list after I refactor some code and add options flow for the different sensors!
Yes everything works for me. However, http://192.168.0.66 (the address of my HA box) did not work (I get "Unknown error occurred"). I had to use my external URL.
Yes everything works for me. However, http://192.168.0.66 (the address of my HA box) did not work (I get "Unknown error occurred"). I had to use my external URL.
There should be log output for this which would probably be helpful to get to the root cause of issues like this. Could you try to provide the error from the log (file)?
You're right - redoing http://192.168.0.66 produces the "Unknown error occurred", but in the logs it shows "400 Client Error: Bad Request for url: http://192.168.0.66:9192/api/stock". When I key this into a browser I get the same error, but if I change it to https it works. And then setting the API URL to https://192.168.0.66 it works.
It looks like the reason for the unknown error is that in handling this error it gets another exception. The relevant part of the log is below:
2020-08-19 11:16:46 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/config/custom_components/grocy/config_flow.py", line 89, in _test_credentials
await self.hass.async_add_executor_job(client.stock)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/pygrocy/grocy.py", line 435, in stock
raw_stock = self._api_client.get_stock()
File "/usr/local/lib/python3.7/site-packages/pygrocy/grocy_api_client.py", line 475, in get_stock
parsed_json = self._do_get_request("stock")
File "/usr/local/lib/python3.7/site-packages/pygrocy/grocy_api_client.py", line 443, in _do_get_request
resp.raise_for_status()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 941, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://192.168.0.66:9192/api/stock
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 125, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 145, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 54, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 103, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 153, in async_configure
result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 201, in _async_handle_step
result: Dict = await getattr(flow, method)(user_input)
File "/config/custom_components/grocy/config_flow.py", line 35, in async_step_user
user_input["port"],user_input["verify_ssl"]
File "/config/custom_components/grocy/config_flow.py", line 92, in _test_credentials
_LOGGER.exception(e)
NameError: name '_LOGGER' is not defined
Thank you for the log output! The primary error of using "http" instead "https" is kinda caused by the user, we should think of a way to assist the user with finding errors in his config without checking the log.
The error with stock sounds like the usual one with stock not being enabled in Grocy and therefore the component can't get stock when it tries. I'll try to remedy this in the refactoring I'm doing now. Also to make more clear error messages for the config.
Beta for 2.0 is out. I would be very happy if you could download it and check if the issue persists, and also if everything else is still working as expected. To download a beta via Hacs, if you haven't before, press the tre dots at the integration and choose reinstall, then you can choose to show beta releases.
EDIT: Then again, I noticed that none of the entities showed up in HA. Is there a breaking change between 1.0.2 and 2.0.0?
The error I was getting "Bad Request for url: http://192.168.0.66:9192/api/stock" because I have stock disabled seems to be fixed by v2.0.0-beta4
. Well done.
Describe the bug I have followed the instructions in
readme
for installing the custom component using HACS (I'm on a Rasberry Pi 3 with Hassio and have Grocy from the add-on store). When I try to add the integration from the UI (step 10) it spins for a while and just returns to the list of integrations.I also tried adding the configuration (details below) to configuration.yaml, with similar results. I do get a message in the HA logs that
2020-08-15 11:15:18 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for grocy which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
but still don't see any states (or services) from the custom component in developer tools and Grocy says the API Key has never been used.To Reproduce Steps to reproduce the behavior:
Expected behavior Trying to use the grocy component to integrate tasks and lists within HA.
Are you using HASSIO to run grocy? Yes
configuration.yaml entry
Additional context Have been facing this issue since HA 110 - just updated to 114 and still have the same experience.