This Home Assistant blueprint fully automates product inventory tracking and restocking. Ideal for consumables like dishwashing tabs, coffee beans, toilet paper, etc.
Features
Detects product usage via
input_boolean
(e.g. dishwasher started)Decreases inventory (
input_number
) when product is usedAutomatically adds product to your shopping list (
todo
) when stock is lowDetects when the item is marked as purchased (removed from the list)
Sends a push notification asking βHow many did you buy?β
Increases your inventory based on the entered amount
Supports multiple mobile devices for push notifications
Requirements
- Home Assistant Core with built-in
input_boolean
,input_number
,todo
(shopping list), andnotify
integrations - No third-party custom components required
Use Cases
- Track and restock dishwasher tabs, laundry detergent, coffee, toilet paper, etc.
- Share restocking notifications with multiple household members
- Avoid running out of essentials
How it works
- You define which input_boolean represents βproduct usedβ (e.g. dishwasher ran)
- When triggered, the product counter is decreased by 1
- If the product count drops below a threshold, itβs added to the shopping list
- When the item is removed from the list (purchased), a push notification is sent
- You reply with the amount purchased β your inventory is updated accordingly
blueprint:
name: Smart Product Inventory Management
description: >
Fully automates tracking of a product's stock.
- Triggers on usage via input_boolean
- Decrements stock (input_number)
- Adds product to shopping list when low
- Detects when product is removed from list (purchased)
- Asks via push how many were bought
- Increases stock accordingly
Works with multiple mobile devices.
domain: automation
input:
input_boolean_trigger:
name: Usage Trigger (input_boolean)
description: Turns 'on' to signal product use.
selector:
entity:
domain: input_boolean
input_number_storage:
name: Inventory Counter (input_number)
description: Tracks current stock level.
selector:
entity:
domain: input_number
shopping_list:
name: Shopping List (todo)
description: The shopping list entity to use.
selector:
entity:
domain: todo
product_name:
name: Product Name
description: Exact name as listed in your shopping list.
selector:
text:
notify_targets:
name: Notification Targets
description: One or more notify.* services (e.g. mobile devices).
selector:
entity:
domain: notify
multiple: true
state_helper:
name: Status Flag (input_boolean)
description: Tracks whether the product is currently on the shopping list.
selector:
entity:
domain: input_boolean
stock_threshold:
name: Low Stock Threshold
description: Below this value, the product is added to the shopping list.
default: 5
selector:
number:
min: 1
max: 100
step: 1
mode: parallel
variables:
storage: !input input_number_storage
trigger_flag: !input input_boolean_trigger
todo_list: !input shopping_list
product: !input product_name
notify_targets: !input notify_targets
status_flag: !input state_helper
threshold: !input stock_threshold
trigger:
- platform: state
entity_id: !input input_boolean_trigger
to: "on"
- platform: numeric_state
entity_id: !input input_number_storage
below: !input stock_threshold
- platform: state
entity_id: !input shopping_list
- platform: event
event_type: mobile_app_notification_action
event_data:
action: REPLY
action:
- choose:
# 1. Usage detected β decrement stock
- conditions:
- condition: trigger
id: "0"
sequence:
- service: input_number.decrement
data:
entity_id: !input input_number_storage
# 2. Stock low β add item to shopping list
- conditions:
- condition: trigger
id: "1"
sequence:
- service: todo.add_item
data:
entity_id: !input shopping_list
item: !input product_name
# 3. Product removed from shopping list β send push notification
- conditions:
- condition: trigger
id: "2"
sequence:
- service: todo.get_items
data:
status:
- needs_action
target:
entity_id: !input shopping_list
response_variable: shopping_items
- variables:
item_in_list: >-
{{ product in shopping_items[todo_list]['items'] | map(attribute='summary') | list }}
- choose:
- conditions:
- condition: template
value_template: "{{ item_in_list and is_state(status_flag, 'off') }}"
sequence:
- service: input_boolean.turn_on
data:
entity_id: !input state_helper
- conditions:
- condition: template
value_template: "{{ is_state(status_flag, 'on') and not item_in_list }}"
sequence:
- service: input_boolean.turn_off
data:
entity_id: !input state_helper
- repeat:
for_each: !input notify_targets
sequence:
- service: notify.{{ repeat.item }}
data:
message: "How many {{ product }} did you buy?"
data:
actions:
- action: REPLY
title: "Enter amount"
# 4. Reply received β increase stock
- conditions:
- condition: trigger
id: "3"
- condition: template
value_template: "{{ trigger.event.data.reply_text | regex_match('^\\d+$') }}"
sequence:
- variables:
current: "{{ states(storage) | float(0) }}"
add: "{{ trigger.event.data.reply_text | float(0) }}"
new: "{{ current + add }}"
- service: input_number.set_value
data:
entity_id: !input input_number_storage
value: "{{ new | float }}"
- service: persistent_notification.create
data:
title: "β
{{ product }} stock updated"
message: "Previous: {{ current }} + Bought: {{ add }} = New: {{ new }}"