Closed kernel610 closed 1 year ago
I finally got this working and admit the issue was on my part. It appears the Error 400 is a generic error for most failures on the API. In my situation, I was missing required fields in the data portion of the request. My recommendation to anyone else struggling with this is to go to the API browser and try your API calls from there to make sure you have the right fields first. The API browser provides better error messages which helped me troubleshoot my problem. Once the API call is successful and data is validated, you should be able to transform this into the service call.
Also, look into the grocy.update_generic service as well. I ended up using this service instead of add_generic because I wanted to create the chore template in Grocy and then reschedule the next occurrence.
I've been using Grocy for about a month with assigned reoccurring chores and marking them complete using your Grocy card filtered by each family member assigned. Everything has been working great.
I'm trying to take the next step of automatically creating chores based on other automations using the grocy.add_generic service. I continue to receive the Error 400 message when calling the service from Developer Tools and Node Red. I see a few other issues logged that mention it is related to the user_id and who created the API in Grocy. It seems the solution is to define the user_ids or map users; however it looks like that is all specific to the card. How is the user defined in the standard integration for service calls not using the card?
I am user 2 in Grocy and I believe the default user for the integration is admin (1). I also tested by creating a new API key with the admin user (user_id = 1) and setup the HA integration again using the new API key. The connection works but still fails with Error 400 in the service call.