-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add getters for aggregate report and dry food consumption #202
base: dev
Are you sure you want to change the base?
Conversation
I just tested this with multiple pets and dry and wet food and I have some comments and questions:
|
@pikim Thank you for trying out this PR and for the feedback. I'll push some updates here over the next few days. |
Ah and about passing in a start and end date, I thought that was more flexible in case someone wanted the total over the past week or month. It'd be trivial to add a wrapper for just a day. |
Document bowl_index and per day reports as well as minor doc cleanups
@pikim I've made updates to allow for selecting the |
@jdrews it works. After playing around a bit: what about extending it in a way to be able to retrieve the consumptions of all bowls in one request? The data is already there after calling
|
Thank you so much for adding this! I've done a lot of work to try to manually build aggregate feeding totals within Home Assistant using this integration, and there are a few things I've learned that might need to be incorporated for full accuracy here:
|
@pikim I have incorporated your changes to this PR to enable returning an array of pet food consumption per bowl. |
@magicmega Thanks! It is hard to understand what is a feeding vs a refill. I'd welcome a code review with improvements to the pet food consumption algorithm! |
This PR adds two GETs:
Why this PR
I wanted to know how much food my pet was eating per day. With the above getters you can do the following to see how much food your pet ate on 2023-12-14.
How it works
get_pet_food_consumption_report
actually callsget_pet_aggregate_report
to get the raw data. The sure petcare app gets these datapoints on the frontend/client and then calculates total food consumption on the clientside. Theget_pet_food_consumption_report
performs that calculation.One interesting oddity that took a while to figure out is how the client calculates total consumption. I've added an optional
app_mode
boolean parameter that lets you toggle between following the app's total consumption logic and raw summation.You can also pass in a
bowl_index
to specify which bowl you want to get pet food consumption from. If you only have one bowl thebowl_index
is 0 and defaults to such.