custom-components / grocy

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

Add undocumented api call for rescheduling chores #288

Open Pebkac03 opened 10 months ago

Pebkac03 commented 10 months ago

I discoverd today that Grocy haven't documented all possible API-calls in their API Browser and found one that is really handy: the ability to reschedule chores. Would be wonderfull to se it added to this integration. Link: https://www.reddit.com/r/grocy/comments/114sca1/tasks_that_consume_products_possible/

droans commented 6 months ago

You can already accomplish this with grocy.update_generic. Here's an example:

service: grocy.update_generic
data:
  entity_type: chores
  object_id: 20 # Chore ID
  data:
   # Date only
    rescheduled_date: {{ states('input_datetime.chore_reschedule_date') | as_timestamp | timestamp_custom('%Y-%m-%d 00:00:00') }}

   # Date and time
    rescheduled_date: {{ states('input_datetime.chore_reschedule_date') | as_timestamp | timestamp_custom('%Y-%m-%d %H:%M:%S') }} 

   # Manually typed. use 24 hour time
    rescheduled_date: '2024-01-05 15:20:00'