Last active
October 16, 2025 05:04
-
-
Save kusold/a9aceb293ffc6ad45c5dfdf0dfb0ca93 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Freezer Inventory Scan Handler | |
| description: > | |
| Sends scanned QR or barcode codes to a Freezer Inventory REST API. | |
| Includes mode (Add/Consume) and location for added items. | |
| domain: automation | |
| input: | |
| scan_input: | |
| name: Scanner Input | |
| description: The input_text entity used for scanner input. | |
| selector: | |
| entity: | |
| domain: input_text | |
| mode_select: | |
| name: Mode Selector | |
| description: The input_select entity that controls Add or Consume mode. | |
| selector: | |
| entity: | |
| domain: input_select | |
| location_select: | |
| name: Location Selector | |
| description: The input_select entity that selects location (only used when adding). | |
| selector: | |
| entity: | |
| domain: input_select | |
| api_url: | |
| name: Freezer Inventory API URL | |
| description: Full URL to your API endpoint (e.g. http://192.168.1.10:8000/api/scan). | |
| default: "http://localhost:8000/api/scan" | |
| selector: | |
| text: | |
| auth_token: | |
| name: Bearer Token (optional) | |
| description: Optional API token for authentication. | |
| default: "" | |
| selector: | |
| text: | |
| mode: restart | |
| trigger: | |
| - platform: state | |
| entity_id: !input scan_input | |
| condition: | |
| - condition: template | |
| value_template: "{{ trigger.to_state.state | length > 0 }}" | |
| action: | |
| - variables: | |
| code: "{{ trigger.to_state.state }}" | |
| mode: "{{ states(!input mode_select) }}" | |
| location: "{{ states(!input location_select) }}" | |
| api_url: !input api_url | |
| auth: !input auth_token | |
| - service: rest_command.freezer_inventory_temp | |
| data: | |
| code: "{{ code }}" | |
| mode: "{{ mode }}" | |
| location: "{{ location }}" | |
| api_url: "{{ api_url }}" | |
| auth: "{{ auth }}" | |
| - service: input_text.set_value | |
| target: | |
| entity_id: !input scan_input | |
| data: | |
| value: "" | |
| - service: persistent_notification.create | |
| data: | |
| title: "Freezer Inventory" | |
| message: >- | |
| Sent {{ code }} as {{ mode }} | |
| {% if mode == 'Add' %}to {{ location }}{% endif %} | |
| rest_command: | |
| freezer_inventory_temp: | |
| url: "{{ api_url }}" | |
| method: POST | |
| headers: | |
| Content-Type: "application/json" | |
| Authorization: "Bearer {{ auth }}" | |
| payload: >- | |
| { | |
| "code": "{{ code }}", | |
| "mode": "{{ mode }}", | |
| "location": "{{ location }}" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment