Grocy integration issue(not addon)
Describe the bug
So grocy itself works, but the problem is in devices its not loaded, when i try to reload i get that error.
After upgrading Home Assistant OS from 2025.3.3 to 2025.4.1, the Grocy integration fails to set up and throws a JSONDecodeError.
⸻
Expected behavior
Grocy integration should load normally without errors upon system startup or reload.
⸻
The error
Logger: homeassistant.config_entries
Source: config_entries.py:751
First occurred: 12:11:57 (3 occurrences)
Last logged: 12:13:30
Error setting up entry Grocy for grocy
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/requests/models.py", line 974, in json
return complexjson.loads(self.text, **kwargs)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/simplejson/__init__.py", line 514, in loads
return _default_decoder.decode(s)
~~~~~~~~~~~~~~~~~~~~~~~^^^
File "/usr/local/lib/python3.13/site-packages/simplejson/decoder.py", line 386, in decode
obj, end = self.raw_decode(s)
~~~~~~~~~~~~~~~^^^
File "/usr/local/lib/python3.13/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 751, in __async_setup_with_context
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(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
coordinator.grocy_data
^^^^^^^^^^^^^^^^^^^^^^
)
^
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.13/concurrent/futures/thread.py", line 59, 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.13/site-packages/pygrocy2/grocy.py", line 319, in get_system_config
raw_system_config = self._api_client.get_system_config()
File "/usr/local/lib/python3.13/site-packages/pygrocy2/grocy_api_client.py", line 735, in get_system_config
parsed_json = self._do_get_request("system/config")
File "/usr/local/lib/python3.13/site-packages/pygrocy2/grocy_api_client.py", line 356, in _do_get_request
raise GrocyError(resp)
~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/site-packages/pygrocy2/errors/grocy_error.py", line 9, in __init__
json = response.json()
File "/usr/local/lib/python3.13/site-packages/requests/models.py", line 978, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Full traceback available above — appears to fail while trying to retrieve system config from Grocy via pygrocy2.
⸻
Installed versions • Home Assistant OS: 2025.4.1 • Grocy: 0.24.0 • Grocy integration: (custom component)
⸻
How is Grocy installed? Installed via Home Assistant Add-on.
⸻
Additional context This was working fine before the upgrade. The error started immediately after updating to HA 2025.4.1. Seems like Grocy API is returning an empty or invalid response when queried for system config.
⸻
Same thing happens to me. Integration randomly fails to initialize, after reloading it a couple of times it eventually loads.
`Logger: homeassistant.config_entries Source: config_entries.py:751 First occurred: 17:13:01 (1 occurrences) Last logged: 17:13:01
Error setting up entry Grocy for grocy Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/requests/models.py", line 974, in json return complexjson.loads(self.text, **kwargs) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/simplejson/init.py", line 514, in loads return _default_decoder.decode(s) ~~~~~~~~~~~~~~~~~~~~~~~^^^ File "/usr/local/lib/python3.13/site-packages/simplejson/decoder.py", line 386, in decode obj, end = self.raw_decode(s) ~~~~~~~~~~~~~~~^^^ File "/usr/local/lib/python3.13/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 751, in __async_setup_with_context 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( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ coordinator.grocy_data ^^^^^^^^^^^^^^^^^^^^^^ ) ^ 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.13/concurrent/futures/thread.py", line 59, 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.13/site-packages/pygrocy2/grocy.py", line 319, in get_system_config raw_system_config = self._api_client.get_system_config() File "/usr/local/lib/python3.13/site-packages/pygrocy2/grocy_api_client.py", line 735, in get_system_config parsed_json = self._do_get_request("system/config") File "/usr/local/lib/python3.13/site-packages/pygrocy2/grocy_api_client.py", line 359, in _do_get_request return resp.json() ~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/requests/models.py", line 978, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)`
Installed versions • Home Assistant OS: 15.2 • Home Assistant Core: 2025.4.2 • Grocy Add-On: 0.24.0 • Grocy integration: (custom component), 2025.2.2
⸻
How is Grocy installed? Installed via Home Assistant Add-on.
This occurs intermittently, impossible to predict when it will happen next.
I cannot even install the integration(not the addon). I'm able to logon and use the AddOn ok. But after I create the API key and try and add the integration I get a similar error as above. I've tried using the HA URL, local IP Address, ingress address, and the docked container address. All give an error. Just says something went wrong in the UI but the logs are pretty much identical. I'd like to have the entities to be able to pull into scripts and automations. Let me know if there is anything I can do to assist.
Integration for me seems to fail to load almost every time on system restart. Usually works after restarting the integration. Also happy to provide further info if helpful
`Logger: homeassistant.config_entries Source: config_entries.py:751 First occurred: 3:34:03 AM (1 occurrence) Last logged: 3:34:03 AM
Error setting up entry Grocy for grocy Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 198, in _new_conn sock = connection.create_connection( (self._dns_host, self.port), ...<2 lines>... socket_options=self.socket_options, ) File "/usr/local/lib/python3.13/site-packages/urllib3/util/connection.py", line 85, in create_connection raise err File "/usr/local/lib/python3.13/site-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) ~~~~~~~~~~~~^^^^ ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 787, in urlopen response = self._make_request( conn, ...<10 lines>... **response_kw, ) File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 493, in _make_request conn.request( ~~~~~~~~~~~~^ method, ^^^^^^^ ...<6 lines>... enforce_content_length=enforce_content_length, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 494, in request self.endheaders() ~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/http/client.py", line 1333, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/http/client.py", line 1093, in _send_output self.send(msg) ~~~~~~~~~^^^^^ File "/usr/local/lib/python3.13/http/client.py", line 1037, in send self.connect() ~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 325, in connect self.sock = self._new_conn() ~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 213, in _new_conn raise NewConnectionError( self, f"Failed to establish a new connection: {e}" ) from e urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f7253de80>: Failed to establish a new connection: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( method=request.method, ...<9 lines>... chunked=chunked, ) File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 841, in urlopen retries = retries.increment( method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2] ) File "/usr/local/lib/python3.13/site-packages/urllib3/util/retry.py", line 519, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.2.118', port=9192): Max retries exceeded with url: /api/system/config (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7253de80>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 751, in __async_setup_with_context 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( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ coordinator.grocy_data ^^^^^^^^^^^^^^^^^^^^^^ ) ^ 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 98, in async_get_config return await self.hass.async_add_executor_job(wrapper) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/grocy/grocy_data.py", line 96, in wrapper return self.api.get_system_config() ~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/pygrocy2/grocy.py", line 319, in get_system_config raw_system_config = self._api_client.get_system_config() File "/usr/local/lib/python3.13/site-packages/pygrocy2/grocy_api_client.py", line 735, in get_system_config parsed_json = self._do_get_request("system/config") File "/usr/local/lib/python3.13/site-packages/pygrocy2/grocy_api_client.py", line 347, in _do_get_request resp = requests.get( req_url, verify=self._verify_ssl, headers=self._headers, params=params ) File "/usr/local/lib/python3.13/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, **kwargs) File "/usr/local/lib/python3.13/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.13/site-packages/requests/adapters.py", line 700, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.2.118', port=9192): Max retries exceeded with url: /api/system/config (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7253de80>: Failed to establish a new connection: [Errno 111] Connection refused')) `
This is fixed in the fork https://github.com/iamkarlson/grocy since v2.0.0. A non-JSON error from Grocy no longer causes a JSONDecodeError, and Home Assistant retries the setup until Grocy answers. You can install the fork in HACS as a custom repository.