[ { "id": "'3D Printer - Active Tray Changed: Update Spoolman Last Used'", "result": { "structured": "TRIGGER: When 3d printer active tray [sensor.ntk_ryansoffice_3dprinter_active_tray] changes state OR When 3d printer current stage [sensor.ntk_ryansoffice_3dprinter_current_stage] changes to printing. CONDITIONS: (3d printer current stage [sensor.ntk_ryansoffice_3dprinter_current_stage] is printing) AND (NOT (3d printer active tray [sensor.ntk_ryansoffice_3dprinter_active_tray] is unavailable)) AND (NOT (3d printer active tray [sensor.ntk_ryansoffice_3dprinter_active_tray] is unknown)). ACTIONS: 1. (Disabled) Create a debug notification with active tray details. 2. Set variables from active tray attributes. 3. Call script.find_matching_spool_in_spoolman with tray details. 4. Based on script response: IF (script succeeded) THEN (Disabled) Loop through returned spools, check for UUID match, and if found, update spool's last_used and first_used via spoolman.patch_spool. Also call script.update_spool_last_and_first_used. IF (active tray UUID is valid AND spool's extra.spool_uuid is empty AND spool vendor is Bambu Lab) THEN update spool's extra.spool_uuid. ELSE IF (script failed) THEN create an error notification. 5. (Disabled) Set diagnostic variables.", "natural_language": { "trigger": "The automation triggers either when the 3d printer active tray [sensor.ntk_ryansoffice_3dprinter_active_tray] sensor changes its state, or when the 3d printer current stage [sensor.ntk_ryansoffice_3dprinter_current_stage] sensor changes to 'printing'.", "conditions": "For the automation to proceed, the 3d printer current stage [sensor.ntk_ryansoffice_3dprinter_current_stage] must be 'printing'. Additionally, the 3d printer active tray [sensor.ntk_ryansoffice_3dprinter_active_tray] must not be in an 'unavailable' or 'unknown' state.", "action": "The automation extracts details like UUID, color, and type from the active tray sensor. It then calls a script to find a matching spool in Spoolman. If a match is found, it updates that spool's 'last used' timestamp (and 'first used' if empty) in Spoolman. If the active tray has a valid UUID and the matched spool lacks a UUID and is from Bambu Lab, it also saves the tray's UUID to the spool's extra data. If no matching spool is found, it creates an error notification. Several debug and diagnostic steps are included but are disabled." }, "human_like": "Updates the last-used timestamp in Spoolman for the correct filament spool whenever the 3D printer's active tray changes while printing.", "complexity": "high" } }, { "id": "Print Complete - Update Filament Usage", "result": { "structured": "TRIGGER: When the 3d printer device [device_id: 210dfdfa64085e8cf073e50eae757d90] finishes a print job (event_print_finished). CONDITIONS: None. ACTIONS: 1. (Disabled) Create a persistent notification with message 'Print Finished'. 2. Store the current state of 3d printer print weight [sensor.ntk_ryansoffice_3dprinter_print_weight] as variable 'store_print_weight'. 3. Store the attributes dictionary of 3d printer print weight [sensor.ntk_ryansoffice_3dprinter_print_weight] as variable 'attributes'. 4. (Disabled) For each key-value pair in 'attributes', if the key contains 'AMS', log the key and value to the logbook. 5. (Disabled) For a number of iterations equal to the length of the attributes dictionary of 3d printer print weight [sensor.ntk_ryansoffice_3dprinter_print_weight], log the current index and store the attribute at that index. 6. Create a string 'ams_trays_string' containing all key-value pairs from the attributes of 3d printer print weight [sensor.ntk_ryansoffice_3dprinter_print_weight] where the key starts with 'AMS', formatted as 'key:value'. Convert this string into a list 'ams_tray_list'. 7. For each item in 'ams_tray_list': a. Parse the item to extract 'tray_name', 'tray_print_weight' (as integer), 'tray_number', and construct a tray entity ID 'tray_entity_id' (e.g., sensor.p1s_01p00c460102350_ams_1_tray_X). b. (Disabled) Choose a specific 'tray_entity' based on the tray number (1, 2, or 4). c. From the entity specified by 'tray_entity_id', get attributes 'tray_uuid', 'type', and 'color' (with '#' removed) and store them in 'selected_tray'. d. Run script 'find_matching_spool_in_spoolman' with parameters from 'selected_tray', storing the result in 'find_spool_response'. e. If 'find_spool_response.success' is true: i. Call service 'spoolman.use_spool_filament' with the spool ID and the 'tray_print_weight'. ii. Log a message to the logbook with the print job name from 3d printer task name [sensor.ntk_ryansoffice_3dprinter_task_name], tray name, spool ID, filament name, and weight used. iii. Create a persistent notification with the same details. f. If 'find_spool_response.success' is NOT false (i.e., an error occurred): Create a persistent notification with an error message.", "natural_language": { "trigger": "When the 3D printer device finishes a print job.", "conditions": "There are no conditions for this automation.", "action": "Upon a print finishing, the automation first stores the current print weight and its attributes. It then filters the attributes to find entries related to the AMS (Automatic Material System) trays, which contain the weight of filament used from each tray. For each AMS tray that was used, it identifies the specific tray sensor (like ams 1 tray 1 [sensor.p1s_01p00c460102350_ams_1_tray_1]) to retrieve details about the filament spool, such as its unique ID, material type, and color. It then calls a helper script to find the corresponding spool in the Spoolman filament management system. If a matching spool is found successfully, it records the filament usage weight to that spool in Spoolman, logs the transaction, and creates a detailed notification about the update. If the script fails to find the spool or returns an error, an error notification is created instead. Several debugging and logging steps within the automation are disabled." }, "human_like": "When a 3D print finishes, this automation automatically logs the amount of filament used from each AMS tray to the Spoolman filament management system.", "complexity": "high" } }, { "id": "Reload Spoolman Integration - Daily @11pm", "result": { "structured": "TRIGGER: At 23:00:00 daily. CONDITIONS: None. ACTIONS: Reload the Home Assistant configuration entry with ID '01JPNH7WNWR5TMZ8YSNDHXWR38'.", "natural_language": { "trigger": "Every day at 11:00 PM.", "conditions": "There are no conditions for this automation.", "action": "Reloads the Home Assistant configuration entry with the ID '01JPNH7WNWR5TMZ8YSNDHXWR38'." }, "human_like": "Reloads the Spoolman integration every night at 11 PM to ensure new spools are registered.", "complexity": "low" } } ]