61 lines
2.8 KiB
Markdown
61 lines
2.8 KiB
Markdown
# Print Log Project — Context for Claude Code
|
||
|
||
## What we're building
|
||
|
||
A Home Assistant automation system that logs 3D printer activity to a Notion database in real time — creating a row when a print starts and updating it when it finishes, fails, or is cancelled.
|
||
|
||
## Notion Database
|
||
|
||
- Name: 🖨️ Print Log
|
||
- URL: <https://www.notion.so/c7bab550efd740909f656f101697832d>
|
||
- Database ID: c7bab550efd740909f656f101697832d
|
||
- Location: CubeCraft Creations page
|
||
|
||
## Printers
|
||
|
||
| Friendly Name | Entity Prefix | Type | Notes |
|
||
|-----------------------|----------------------------------|-------------|--------------------------------|
|
||
| PrintsCharming | p1s_01p09c470102673 | Bambu P1S | Full data |
|
||
| Ds-Turd-Flinger | a1_03919d540806387 | Bambu A1 | Full data |
|
||
| Polly-Pocket | a1mini_0309ca580403653 | Bambu A1Mini| Full data |
|
||
| Constipation-Orion | constipation_orion | Bambu | Full data |
|
||
| Jordyns-Layer-Slayer | jordyns_layer_slayer | Bambu | Full data |
|
||
| Centauri Carbon | centauri_carbon | Elegoo FDM | file_name + print_status only |
|
||
| Saturn | saturn | Elegoo Resin| file_name + print_status only |
|
||
|
||
Bambu sensors follow pattern: sensor.{prefix}_print_status, _gcode_filename,
|
||
_print_weight, _print_length, _active_tray (attrs: type, color)
|
||
|
||
Elegoo sensors: sensor.{prefix}_file_name, sensor.{prefix}_print_status
|
||
(status values for Elegoo need verification — may differ from Bambu)
|
||
|
||
## HA Config Files Produced
|
||
|
||
Three files were generated (in the HA config repo):
|
||
|
||
- print_log_configuration.yaml — input_text helpers + rest_commands
|
||
- print_log_automations.yaml — 14 automations (start+finish × 7 printers)
|
||
- print_log_secrets_addition.yaml — Notion bearer token line for secrets.yaml
|
||
|
||
## Correct Template for Storing Notion Page ID
|
||
|
||
`rest_command` responses are already parsed as dicts — do NOT use `| from_json`:
|
||
CORRECT: value: "{{ notion_response.content.id | default('') }}"
|
||
WRONG: value: "{{ (notion_response.content | from_json).id | default('') }}"
|
||
|
||
The finish automation condition checks `| length == 36` on the stored ID.
|
||
|
||
## Notion rest_command structure
|
||
|
||
- notion_create_print: POST to /v1/pages, returns page ID in response body
|
||
- notion_update_print: PATCH to /v1/pages/{page_id}
|
||
- Auth header uses !secret notion_token_bearer (full "Bearer ntn_..." string)
|
||
- Token stored in secrets.yaml as notion_token_bearer
|
||
|
||
## HA Setup
|
||
|
||
- HAOS on x86 server
|
||
- Gitea repo at code.cubecraftcreations.com (username: overseer)
|
||
- IoT VLAN: 192.168.69.x, Main: 192.168.1.x
|
||
- ~150 devices, UniFi networking
|