Caution
This is a work in progress and made using GPT and basic knowledge.
The Pantry Tracker add-on is a Home Assistant designed to help you keep track of products in your kitchen, pantry, or any other storage space. With a user-friendly interface and a powerful backend, this add-on simplifies the organization and management of your items by allowing you to create categories, assign products to them, and maintain an up-to-date inventory.
The add-on operates using a Flask API server hosted locally. All product and category data is stored persistently in a .db file using JSON, ensuring your data is retained across reboots.
🖥️ Responsive User Interface
The add-on provides a sleek, easy-to-navigate interface that adapts to different screen sizes for seamless use on both desktop and mobile devices.
📦 Product Management
Add, update, or remove products from your inventory. Automatically track counts for individual products.
🗂️ Category Management
Create, edit, or delete custom categories. Assign products to specific categories for better organization.
🔄 Real-Time Updates
Sensors in Home Assistant are updated in real time to reflect changes made via the API or the interface.
💾 Backup & Restore
The ability to save a copy of the database and restore an existing database
1: Add https://github.com/mintcreg/pantry_tracker/ to repositories to the addon store
2: Install Addon from the addon store
3: Install Pantry Tracker - Custom Components (Note; this needs to be installed after the pantry_tracker addon)
4: Restart Home Assistant
5: Navigate to http://homeassistant.local:5000/ and add products/categories
Tip
(Optional) Install Pantry Tracker Card to display the data within lovelace.
Endpoint | Method | Description | Parameters (Body) | Response |
---|---|---|---|---|
/ |
GET |
Root endpoint that serves the HTML UI. | None | Renders index.html . |
/categories |
GET |
Fetch all categories. | None | 200 : List of category names. Example: ["Fruits", "Vegetables"] 500 : Error message if fetch fails. |
/categories |
POST |
Add a new category. | {"name": "CategoryName"} |
200 : Updated list of categories. 400 : Validation errors or duplicate category. 500 : Error message if addition fails. |
/categories |
DELETE |
Delete a category and reassign its products to "Uncategorized". | {"name": "CategoryName"} |
200 : Updated list of categories. 400 : Validation errors. 404 : Category not found. 500 : Error message if deletion fails. |
/products |
GET |
Fetch all products along with their categories and URLs. | None | 200 : List of products with their details. Example: [{"name": "Apple", "url": "image.jpg", "category": "Fruits"}] 500 : Error message if fails. |
/products |
POST |
Add a new product. | {"name": "ProductName", "url": "ProductImageURL", "category": "CategoryName"} |
200 : Updated list of products. 400 : Validation errors or duplicate product. 500 : Error message if addition fails. |
/products |
DELETE |
Delete a product by name. | {"name": "ProductName"} |
200 : Updated list of products. 400 : Validation errors. 404 : Product not found. 500 : Error message if deletion fails. |
/update_count |
POST |
Update the count of a specific product by entity ID. | {"entity_id": "sensor.product_name", "action": "increase/decrease", "amount": 1} |
200 : Updated count. Example: {"status": "ok", "count": 5} 400 : Validation errors. 404 : Product not found. 500 : Error message. |
/counts |
GET |
Fetch the current count of all products. | None | 200 : Dictionary of product counts keyed by entity_id . Example: {"sensor.product_apple": 5} 500 : Error message if fetch fails. |
/barcode_increase |
POST |
Increase the count of a product by scanning its barcode. | {"barcode": "1234567890123", "amount": 1} |
200 : Updated count. Example: {"status": "ok", "count": 6} 400 : Validation errors. 404 : Barcode not found. 500 : Error message. |
/barcode_decrease |
POST |
Decrease the count of a product by scanning its barcode. | {"barcode": "1234567890123", "amount": 1} |
200 : Updated count. Example: {"status": "ok", "count": 4} 400 : Validation errors. 404 : Barcode not found. 500 : Error message. |
/health |
GET |
Health check endpoint to verify the service is running. | None | 200 : Health status. Example: {"status": "healthy"} |
This project uses data and images provided by OpenFoodFacts.
- Data and images are licensed under the Open Database License (ODbL) and the Database Contents License (DbCL).
- You are encouraged to contribute to OpenFoodFacts by adding missing products and improving data accuracy.
Visit OpenFoodFacts to learn more.