Skip to content

Commit cc2f726

Browse files
committed
Refresh chores/tasks after a generic service
1 parent 50fafd4 commit cc2f726

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

custom_components/grocy/services.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ def wrapper():
289289
coordinator.grocy_api.add_generic(entity_type, data)
290290

291291
await hass.async_add_executor_job(wrapper)
292+
await post_generic_refresh(coordinator, entity_type);
292293

293294

294295
async def async_update_generic_service(hass, coordinator, data):
@@ -307,6 +308,7 @@ def wrapper():
307308
coordinator.grocy_api.update_generic(entity_type, object_id, data)
308309

309310
await hass.async_add_executor_job(wrapper)
311+
await post_generic_refresh(coordinator, entity_type);
310312

311313

312314
async def async_delete_generic_service(hass, coordinator, data):
@@ -323,8 +325,13 @@ def wrapper():
323325
coordinator.grocy_api.delete_generic(entity_type, object_id)
324326

325327
await hass.async_add_executor_job(wrapper)
328+
await post_generic_refresh(coordinator, entity_type);
326329

327330

331+
async def post_generic_refresh(coordinator, entity_type):
332+
if entity_type == "tasks" or entity_type == "chores":
333+
await _async_force_update_entity(coordinator, entity_type)
334+
328335
async def async_consume_recipe_service(hass, coordinator, data):
329336
"""Consume a recipe in Grocy."""
330337
recipe_id = data[SERVICE_RECIPE_ID]

0 commit comments

Comments
 (0)