Grocy - Custom component and card(s)

I have my chores card setup but I get this msg?

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/config/custom_components/grocy/services.py", line 99, in async_call_grocy_service
    await async_execute_chore_service(hass, coordinator, service_data)
  File "/config/custom_components/grocy/services.py", line 191, in async_execute_chore_service
    coordinator.api.execute_chore(chore_id, done_by, tracked_time)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy.py", line 98, in execute_chore
    return self._api_client.execute_chore(chore_id, done_by, tracked_time)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy_api_client.py", line 617, in execute_chore
    return self._do_post_request(f"chores/{chore_id}/execute", data)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy_api_client.py", line 557, in _do_post_request
    resp = requests.post(
  File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 234, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/local/lib/python3.8/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.8/http/client.py", line 1266, in _send_request
    self.putrequest(method, url, **skips)
  File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 214, in putrequest
    return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 150, in protected_loop_func
    check_loop()
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 139, in check_loop
    raise RuntimeError(
RuntimeError: I/O must be done in the executor; Use `await hass.async_add_executor_job()` at custom_components/grocy/services.py, line 191: coordinator.api.execute_chore(chore_id, done_by, tracked_time)

any help will be helpfull

Yep that’s what I getting too

It looks like there’s been a commit to fix the I/O error, be patient and wait for an update :slight_smile:

1 Like

I got some help, so there is now a new release. Please try it. If any problems remain, create an issue in Github. Release v3.0.5 Bugfixes · custom-components/grocy · GitHub

3 Likes

Task completion works again.

1 Like

My not how did you get it to work?

I just updated Home Assistant, then the track started working again without error. I updated grocy after I verified that the track in HA worked and verified that after update of grocy it still worked.
I run HA an grocy in docker containers so that may be different than your setup.

I running docker grocy too. Just restarted everything trying to get it working but no good. Is my Lovelace config look ok

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/config/custom_components/grocy/services.py", line 105, in async_call_grocy_service
    await async_execute_chore_service(hass, coordinator, service_data)
  File "/config/custom_components/grocy/services.py", line 207, in async_execute_chore_service
    await hass.async_add_executor_job(wrapper)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/grocy/services.py", line 205, in wrapper
    coordinator.api.execute_chore(chore_id, done_by, tracked_time)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy.py", line 107, in execute_chore
    return self._api_client.execute_chore(chore_id, done_by, tracked_time)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy_api_client.py", line 633, in execute_chore
    return self._do_post_request(f"chores/{chore_id}/execute", data)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy_api_client.py", line 565, in _do_post_request
    raise GrocyError(resp)
pygrocy.errors.grocy_error.GrocyError: <Response [500]>
2021-04-18 18:43:45 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [23357886547376] <Response [500]>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/config/custom_components/grocy/services.py", line 105, in async_call_grocy_service
    await async_execute_chore_service(hass, coordinator, service_data)
  File "/config/custom_components/grocy/services.py", line 207, in async_execute_chore_service
    await hass.async_add_executor_job(wrapper)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/grocy/services.py", line 205, in wrapper
    coordinator.api.execute_chore(chore_id, done_by, tracked_time)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy.py", line 107, in execute_chore
    return self._api_client.execute_chore(chore_id, done_by, tracked_time)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy_api_client.py", line 633, in execute_chore
    return self._do_post_request(f"chores/{chore_id}/execute", data)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy_api_client.py", line 565, in _do_post_request
    raise GrocyError(resp)
pygrocy.errors.grocy_error.GrocyError: <Response [500]>

Just checking if it’s just me… with home assistant latest update. Do the tracker card for chores work…

Due to a bug in Grocy you can only track chores as the same user that made the api key. Please verify that this is the case.

oh, well I just del my wife as a user now have just one user. I just re did the setup and till the same

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/grocy/services.py:205
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 8:18:03 PM (1 occurrences)
Last logged: 8:18:03 PM

[22641588593328] <Response [500]>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/config/custom_components/grocy/services.py", line 105, in async_call_grocy_service
    await async_execute_chore_service(hass, coordinator, service_data)
  File "/config/custom_components/grocy/services.py", line 207, in async_execute_chore_service
    await hass.async_add_executor_job(wrapper)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/grocy/services.py", line 205, in wrapper
    coordinator.api.execute_chore(chore_id, done_by, tracked_time)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy.py", line 107, in execute_chore
    return self._api_client.execute_chore(chore_id, done_by, tracked_time)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy_api_client.py", line 633, in execute_chore
    return self._do_post_request(f"chores/{chore_id}/execute", data)
  File "/usr/local/lib/python3.8/site-packages/pygrocy/grocy_api_client.py", line 565, in _do_post_request
    raise GrocyError(resp)
pygrocy.errors.grocy_error.GrocyError: <Response [500]>

I put some pic up to check if right.
I useing separate container then HA but on same server.

The issue with not being able to complete chores for another user is fixed in Grocy but not yet released. Until then only the user who created the api key that is used for the integration can complete a chore.

I have added an instruction of how to amend the issue in the meantime in the readme.

After useing the Instruction… found out I am user ID no. 2… Have change card to suit and now working… Thanks… P.S is there a way to press the track button in a Automations as an Actions… It’s going to be for an notification to the Android app… I see we can

call service

and use

Grocy: execute_chore

I don’t know what we do after that but sorry not that smart LOL

I have written how you use it in the issue you created for the other thing.

1 Like

Thanks Teachingbirds
Will post here for anyone looking too…
P.S I will Post my config with how I using my so if anyone think of doing the same.

Use the service call, like this:

service: grocy.execute_chore
data:
  chore_id: 1
  done_by: 2

Chore id you can get from the entity attributes and done by is your user id.

2 Likes

Hi guys, I’d just like to show you my config as an example of how you can also use Teachingbirds nice track card.
So this is my config… it sends a notification to my phone reminding me to clean the birds room with an action button to send a msg to my vacuum to clean the birds room and to Grocy that the chore has been done.
I would like to add a text to my notification so that it can show if the chore is overdue and by how much - any help with that would be nice thanks. I would also like to know whether it is possible to make a condition on this message to have it only sent to me once per day as sometimes I come and go from home several times and at the moment it resends the msg every time I return home.

1st one sends the msg

id: '1619415409992'
alias: Vacuum birds room when some one is home
description: ''
trigger:
  - platform: state
    entity_id: device_tracker.aaron_mobile
    to: home
condition: []
action:
  - service: notify.mobile_app_aaron_mobile
    data:
      message: Will you like to Vacuum the birds room
      title: Welcome Home
      data:
        actions:
          - action: zone_clean_birds_room
            title: clean
mode: single

2nd one makes the actions (msg send to vacuum and other msg sent to grocy)

id: '1619417950784'
alias: Vacuum birds room when actions fired
description: ''
trigger:
  - platform: event
    event_type: mobile_app_notification_action
    event_data:
      action: zone_clean_birds_room
condition: []
action:
  - service: vacuum.send_command
    data:
      command: zoned_cleanup
      params:
        zone_ids:
          - bef19b22-6045-4182-8737-aa257f46f166
    target:
      device_id: b91356b24a24c8d14b4eb0198df31d17
  - service: grocy.execute_chore
    data:
      chore_id: 4
      done_by: 2
mode: single
1 Like

Hi all, I wonder if anyone can help please? I am having issues with the Grocy chores custom card.

  1. I have Grocy installed as an external container instance in Unraid.

  2. I have logged into Grocy and added chores

  3. I have installed the Grocy custom component via HACS

  4. I have configure the custom component with my API key from Grocy

  5. My sensors show up in the Grocy integration and are activated

  6. I installed the grocy-chore-card addon via HACS?

  7. I installed the card-tools addon via HACS?

When I add a card via the Lovelace UI (using the YAML code editor) I have the correct required options and I have also ensured I have the user_id option related to the username who generated the API.

However I see no preview and when I save I see no card. I also lose the ability to add card in the interface. I then have to remove the entries from the Raw Configuration Editor

In the Raw Configuration Editor my understanding is that it is no longer required to add the resources line here as it appears within the Lovelace Dashboards configuration menu.

The only potential issue I can see is that the instructions refer to /local/grocy-chores-card.js whereas my resources reference /hacsfiles/lovelace-grocy-chores-card/grocy-chores-card.js

If you require any further information, please let me know

Kind Regards

ES