Open BenBergman opened 14 hours ago
This might be an issue with the Grocy API. Playing with the API explorer, I see the "wrong" amount when I get the shopping list through the API at http://<grocy_ip>:9192/api/objects/shopping_list
. I'll dig around the API a bit more and see if the "correct" value is available.
I opened an issue with upstream Grocy as the API seems to be reporting the same incorrect values. This integration has more detailed info in the shopping list attributes so there must be more than just returning the raw API results so I'll leave this as open for now in case it makes sense to patch around it here, but odds are it makes more sense to wait for the upstream fix.
From that other ticket it sounds like I misunderstood how the Grocy API works and there is no bug there.
Since this integration seems to be returning more than just the results of a single API call, could a field be added with the amount in the purchase quantity? I had a hard time finding the right place for this when I dug through the code yesterday, but if I find some time I'll try to poke at it a bit myself.
Edit: if adding a "purchase amount" field is undesirable, at least having a field in the product for the stock quantity unit so a conversion can be looked up would be nice.
Unless all relevant information is provided, I can't help you
Describe the bug When viewing the shopping list in Grocy, the correct units are used for quantity (ie. "Default quantity unit purchase").
In the shopping list attributes, the unit used is the "Quantity unit stock" (see the 'amount' field).
When I change the "Quantity unit stock" to match "Default quantity unit purchase", the amount displayed is as I would expect.
Expected behavior The amount for the shopping list item should match the shopping list in Grocy UI, ie. it should be in the "Default quantity unit purchase" unit, or at the very least have this added as on additional field.
To Reproduce
sensor.grocy_shopping_list
General information to help debugging:
Core 2024.11.3 Supervisor 2024.11.4 Operating System 13.2 Frontend 20241106.2
Grocy 4.2.0 (installed as add-on) Grocy custom component 4.11.1