custom-components / grocy

Custom Grocy integration for Home Assistant
Apache License 2.0
156 stars 47 forks source link

Error 400 when completing task from HA on external Grocy #254

Closed rickgardner077 closed 1 year ago

rickgardner077 commented 1 year ago

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

Describe the bug On marking a task as complete in the HA UI an error 400 is returned. The task is not marked as completed in external Grocy installation

What is your installed versions of Home Assistant, Grocy and this integration?

Home Assistant 2022.9.7 Supervisor 2022.09.1 Operating System 9.0 Frontend 20220907.2 - latest

Grocy custom component 4.7.1 Grocy 3.3.1

Have you added debugging to the log, and what does the log say?

Log Details (ERROR) Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/grocy/services.py:231 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 20:10:13 (1 occurrences) Last logged: 20:10:13

[547589538432] <Response [400]> Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/grocy/services.py", line 146, in async_call_grocy_service await async_execute_chore_service(hass, coordinator, service_data) File "/config/custom_components/grocy/services.py", line 233, in async_execute_chore_service await hass.async_add_executor_job(wrapper) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/grocy/services.py", line 231, in wrapper coordinator.grocy_api.execute_chore(chore_id, done_by, skipped=skipped) File "/usr/local/lib/python3.10/site-packages/pygrocy/grocy.py", line 131, in execute_chore return self._api_client.execute_chore(chore_id, done_by, tracked_time, skipped) File "/usr/local/lib/python3.10/site-packages/pygrocy/grocy_api_client.py", line 469, in execute_chore return self._do_post_request(f"chores/{chore_id}/execute", data) File "/usr/local/lib/python3.10/site-packages/pygrocy/grocy_api_client.py", line 376, in _do_post_request raise GrocyError(resp)

pygrocy.errors.grocy_error.GrocyError: <Response [400]>

mrmorganmurphy commented 1 year ago

I had the same error when using the grocy-chores-card. I was able to resolve it by setting the user_id to the correct user.