Simple Inventory v0.5.1
Breaking Changes
Expiring-soon sensor state semantics changed
sensor._items_expiring_soon and sensor.all_items_expiring_soon previously reported a combined count of expiring-soon and already-expired items. They now report only items within their alert threshold but not yet expired. Automations or dashboards
reading the state value of these sensors will see different numbers after upgrading.
sensor._inventory attributes removed
total_value, categories, locations, and items (full item list) have been removed from the inventory sensor's state attributes to prevent the HA 16 KB attribute size warning on large inventories. Any template reading these via state_attr(...) will
silently return None. Use the get_items service call to retrieve full item data including value, categories, and locations.
────────────────────────────────────────────────────────────────────────────────
New Sensors
Two dedicated expired-items sensors have been added:
- sensor._expired_items — Per-inventory. State is the count of items past their expiration date. Attributes: expired_items, total_expired, inventory_id, inventory_name. Fixed icon: mdi:calendar-remove.
- sensor.all_expired_items — Global, aggregates across all inventories. Attributes: expired_items, total_expired, oldest_expired, inventories_count. Fixed icon: mdi:calendar-remove.
New Service: get_inventory_consumption_rates
Returns consumption analytics for all items in an inventory based on their decrement history. Complements the existing get_item_consumption_rates (single-item) service.
service: simple_inventory.get_inventory_consumption_rates
data:
inventory_id: "01JYFPCDMBRBRK4MB3C26S2FKH"
window_days: 30 # optionalReturns daily/weekly rates, days until depletion, and a summary of most-consumed items and items running out soonest.
New Barcode Provider: UPCItemDB
upcitemdb is now available as a barcode lookup provider. Configure it in the integration options.
New WebSocket Command: get_inventory_statistics
simple_inventory/get_inventory_statistics returns a statistics snapshot (total items, quantity, value, categories, locations, below-threshold, expiring items) without subscribing to updates.
New Translation: Slovenian
Full Slovenian (sl.json) translation added.
Bug Fixes
- Delete and re-add integration fails — Removing the integration and re-adding it with the same inventory name caused a UNIQUE constraint failed: index 'idx_inventories_name' error on setup. The integration now implements async_remove_entry, which
deletes all data for an inventory (items, barcodes, history) from the database when the integration is explicitly removed. Users who hit this on a prior version can clean up manually — see the README for instructions. - Expiring-soon sensor stale state — The per-inventory expiry cache was not invalidated on coordinator refresh, causing the sensor to report stale counts. Cache is now correctly cleared on each update.
- get_items falls back when coordinator unavailable — If get_items was called during startup before a coordinator was fully registered, it would raise an error. It now falls back to querying the repository directly, consistent with
get_items_from_all_inventories. - CSV export date range — Export was hard-coding the date range instead of deriving it from the actual data.
Internal
- Coordinator refactored from a single coordinator.py into a package (coordinator/) with focused modules: _core, _analytics, _statistics, _import_export, _protocol. No behavioral changes.
- Service registration refactored to a table-driven loop; _SERVICE_NAMES tuple keeps registration and teardown in sync automatically.
- compute_quantity_needed extracted to const.py for reuse across the stack.
- CONTRIBUTING.md added documenting development setup and code conventions.