custom-components / grocy

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

Feature request: reload data service #266

Closed karwosts closed 1 year ago

karwosts commented 1 year ago

I track my grocy chores on the HA frontend, with a grocy-chores-card.

I also have some input helpers that I use to add new tasks from the same frontend (input_text, input_datetime, and a button that allows me to add a grocy task from those inputs).

However when I post a new task, the chores card doesn't update until the next 60 seconds later or however long it refreshes, so it leaves me in a state of wondering if my post was accepted or had an error.

It would be nice if I could call a service to trigger an instant reload of the tasks data. Then maybe I can call that after I post a task, or maybe even a reload button could be added to the corner of the grocy-chores-card.

karwosts commented 1 year ago

Another idea that might work for me:

After tracking a task, we calll a force refresh on the task object:

await _async_force_update_entity(coordinator, ATTR_TASKS)

Maybe we can do the same in add_generic, for example if we call add_generic with entity_type tasks, we can force update the tasks after it is done.