A sophisticated custom card for Home Assistant that transforms InvenTree inventory management into a modern, interactive dashboard experience. Built with React and Redux for robust performance and flexible customization.
InvenTree Card bridges your InvenTree inventory system with Home Assistant, providing real-time stock management, intelligent automation, and touchscreen-friendly controls. Perfect for home workshops, maker spaces, small businesses, or anyone managing physical inventory alongside their smart home.
- React & Redux: Modern component architecture with centralized state management
- Real-time Updates: WebSocket integration for instant inventory synchronization
- Optimized Performance: Debounced operations, intelligent caching, and efficient rendering
- Multiple Data Sources: InvenTree parts via HA sensors, direct API connections, or manual part selection
- Entity Bindings: Integrate any Home Assistant entity (sensors, switches, lights) into your inventory logic
- Smart Parameter Loading: Automatically fetch InvenTree parameters for targeted parts
- Custom Thumbnails: Override images with local paths for better visual organization
- Custom Portions: Define increment/decrement amounts per item (e.g., -15g coffee, +500g restock)
- Slider Mode: Touch-friendly slider for precise stock adjustments with configurable ranges and steps
- Unit Support: Display stock with units (grams, milliliters, pieces, etc.)
- Debounced Updates: Intelligent batching of rapid stock changes with eventual consistency
- WebSocket Verification: Automatic validation of stock updates against server state
- Expression Builder: Create reusable conditions based on part parameters, attributes, or HA entity states
- Dynamic Effects: Automatically change visibility, styling, highlights, icons, and badges based on conditions
- Logical Operators: Support for AND/OR/NOT combinations with nested logic groups
- Real-time Evaluation: Conditions automatically re-evaluate when data changes
- Multi-Operation Actions: Chain multiple operations in sequence (call services, update parameters, trigger logic)
- Rich Triggers: Buttons, thumbnail clicks, or automated events
- Template Support: Dynamic values using part data or entity bindings
- Confirmation Dialogs: Optional user confirmation for critical actions
- Flexible Grid System: Configure 4-24 columns for different screen sizes
- Multiple View Types: Grid, list, table, detail, and variant views
- Custom Cell Layouts: Position and size each element precisely
- Zoom & Preview: Visual editor with live preview and zoom controls
- React-based Interface: Modern, intuitive configuration UI
- Live Preview: See changes in real-time as you configure
- Inline Editors: Configure portions, slider settings, and actions directly
- Data Availability Indicators: Visual feedback on parameter and entity loading status
- Ensure HACS is installed
- Navigate to HACS in your Home Assistant interface
- Click the three dots (⋮) and select "Custom repositories"
- Add
https://github.com/benoit505/inventree-cardas the Repository URL - Select "Lovelace" as the Category and click "Add"
- Find "InvenTree Card" in the HACS Lovelace section and click "Install"
- Download
inventree-card.jsfrom the latest release - Copy it to your
config/www/directory - Add to Lovelace resources:
- Go to Configuration → Lovelace Dashboards → Resources
- Click "Add Resource"
- Set URL to
/local/inventree-card.jsand type to "JavaScript Module"
Or in YAML mode:
resources:
- url: /local/inventree-card.js
type: moduletype: custom:inventree-card
data_sources:
inventree_hass_sensors:
- sensor.inventree_all_parts
view_type: grid
layout_options:
columns: 3
grid_spacing: 8type: custom:inventree-card
data_sources:
inventree_pks: [150, 179, 305] # Coffee, Tea, Milk
direct_api:
enabled: true
url: 'http://inventree.local:8000'
api_key: 'your_api_key'
layout:
gridColumns: 12 # 12-column grid for tablet display
cells:
- id: coffee-stock
partPk: 150
content: in_stock
x: 0
y: 0
w: 4
h: 1
stockUnit: g
decrementAmount: 15 # Daily use
incrementAmount: 500 # Restock amount
sliderMin: 0
sliderMax: 1000
sliderStep: 50expressions:
low_stock:
name: "Stock Below Threshold"
type: "comparison"
source:
type: "part_attribute"
id: "in_stock"
operator: "less_than"
value: 10
conditional_logic:
definedLogics:
- id: "highlight_low_stock"
name: "Highlight Low Stock Items"
conditionRules:
combinator: "and"
rules:
- field: "expression:low_stock"
operator: "equals"
value: true
effects:
- type: "set_style"
styleProperty: "border"
styleValue: "2px solid red"
targetPartPks: "*"The card offers extensive configuration through the visual editor. Key sections include:
- Data Sources: Define where parts and entity data come from
- Direct API: Optional direct connection to InvenTree
- Layout: Grid configuration, cell positioning, and view type
- Expressions: Reusable conditions and calculations
- Conditional Logic: Dynamic styling and visibility rules
- Actions: Custom interactions and automations
- Display: Control which elements are shown
For detailed documentation, see the Configuration Guide.
# Install dependencies
npm install
# Build for production
npm run build
# Watch mode for development
npm run watchThe build outputs to dist/inventree-card.js. Copy this to your Home Assistant config/www/ directory for testing.
- Home Workshop: Track tools, materials, and consumables alongside your smart home
- Kitchen Inventory: Monitor pantry stock with automatic low-stock alerts
- Maker Space: Manage shared resources with touchscreen kiosks
- Small Business: Integrate inventory with environmental sensors and automation
- Consumables: Perfect for coffee, tea, milk, snacks with custom portion tracking
- Enhanced visual editor with drag-and-drop layout builder
- Advanced relationship handling (assemblies, BOMs)
- More layout types and customization options
- Extended expression engine with functions and calculations
- Barcode/QR code scanning integration
- Historical stock trend visualization
Contributions are welcome! Please:
- Open an issue to discuss proposed changes
- Fork the repository
- Create a feature branch
- Submit a pull request
MIT © benoit505
Built with modern web technologies:
- React for UI components
- Redux Toolkit for state management
- React Grid Layout for flexible positioning
- Framer Motion for smooth animations
- TypeScript for type safety