custom-components / grocy

Custom Grocy integration for Home Assistant
Apache License 2.0
153 stars 45 forks source link

Error setting up entry Grocy for grocy #304

Open rmanwiller2 opened 6 months ago

rmanwiller2 commented 6 months ago

Unless all relevant information is provided, I can't help you

Describe the bug Error setting up the integration with Grocy hosted separately from the Home Assistant device( not an add-on).

Expected behavior Integration connects to the Grocy server and completes setup

To Reproduce step 1, install Grocy as a docker container on a separate machine at 192.168.x.100 using port 9234 step 2, Verify grocy app works at that address and create an api key Step 3, install Grocy custom integration and begin setup, input the address as http://192.168.x.100, api key and set port to 9234 step 5. Integration "completes" setup but all entities are unavailable and logs show an error that the integration could not complete setup

What is your installed versions of Home Assistant, Grocy and this integration? Home Assistant Core 2023.12.4 Home Assistant OS 11.2 Grocy custom component 4.11.1 Grocy 4.0.3

How do you have Grocy installed? Add-on or external? external docker container, 192.168.x.100:9234 | 0.0.0.0:9234-->8080/tcp

Have you added debugging to the log, and what does the log say? 2024-01-06 01:46:16.688 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Grocy for grocy Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/simplejson/init.py", line 514, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/simplejson/decoder.py", line 386, in decode obj, end = self.raw_decode(s) ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/simplejson/decoder.py", line 416, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/grocy/init.py", line 45, in async_setup_entry coordinator.available_entities = await _async_get_available_entities( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/grocy/init.py", line 73, in _async_get_available_entities grocy_config = await grocy_data.async_get_config() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/grocy/grocy_data.py", line 94, in async_get_config return await self.hass.async_add_executor_job(wrapper) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/grocy/grocy_data.py", line 92, in wrapper return self.api.get_system_config() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pygrocy/grocy.py", line 317, in get_system_config raw_system_config = self._api_client.get_system_config() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pygrocy/grocy_api_client.py", line 723, in get_system_config parsed_json = self._do_get_request("system/config") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pygrocy/grocy_api_client.py", line 358, in _do_get_request raise GrocyError(resp) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pygrocy/errors/grocy_error.py", line 9, in init json = response.json() ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Additional context Android and iOS apps connect just fine to grocy server, web ui works as well.