From c330fdbd4d1a26776b7b78fac3826027569c6d10 Mon Sep 17 00:00:00 2001 From: Carlo Costanzo Date: Thu, 13 Aug 2026 16:54:56 -0400 Subject: [PATCH] refactor(infrastructure): retire reset credit telemetry --- .../partials/home_sections.yaml | 37 ------- .../partials/joanna_sections.yaml | 99 ----------------- config/packages/bearclaw.yaml | 100 ------------------ tools/dashboard_entity_allowlist.txt | 2 - 4 files changed, 238 deletions(-) diff --git a/config/dashboards/infrastructure/partials/home_sections.yaml b/config/dashboards/infrastructure/partials/home_sections.yaml index 37558c72..dbe23776 100644 --- a/config/dashboards/infrastructure/partials/home_sections.yaml +++ b/config/dashboards/infrastructure/partials/home_sections.yaml @@ -181,12 +181,6 @@ variables: ok_state: ok healthy_text: HEALTHY - warning_text: RESET SOON - critical_text: RESET URGENT - warning_entity_ids: - - binary_sensor.codex_reset_credit_expiring_soon - critical_entity_ids: - - binary_sensor.codex_reset_credit_expiring_critical tap_action: action: navigate navigation_path: /dashboard-infrastructure/joanna @@ -490,37 +484,6 @@ action: navigate navigation_path: /dashboard-infrastructure/network - - type: custom:button-card - template: bearstone_infra_alert_row - entity: binary_sensor.codex_reset_credit_expiring_soon - name: Codex reset expires soon - icon: mdi:calendar-alert - variables: - alert_kind: binary_on - warning_entity_ids: - - binary_sensor.codex_reset_credit_expiring_soon - critical_entity_ids: - - binary_sensor.codex_reset_credit_expiring_critical - exception_detail: > - [[[ - const raw = states['sensor.codex_reset_credit_next_expiration']?.state; - const days = Number(states['sensor.codex_reset_credit_min_days_remaining']?.state); - if (!raw || ['unknown', 'unavailable'].includes(String(raw).toLowerCase())) return 'EXPIRATION DATE UNAVAILABLE'; - const when = new Date(raw).toLocaleString('en-US', { - month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: '2-digit' - }); - return `${when} ยท ${Number.isFinite(days) ? days.toFixed(1) + ' DAYS' : 'DAYS UNKNOWN'}`; - ]]] - state_display: > - [[[ - return states['binary_sensor.codex_reset_credit_expiring_critical']?.state === 'on' - ? 'RESET URGENT' - : 'RESET SOON'; - ]]] - tap_action: - action: navigate - navigation_path: /dashboard-infrastructure/joanna - - type: custom:button-card template: bearstone_infra_alert_row entity: sensor.proxmox_garage_average_temperature diff --git a/config/dashboards/infrastructure/partials/joanna_sections.yaml b/config/dashboards/infrastructure/partials/joanna_sections.yaml index b3ac6158..79189f9e 100644 --- a/config/dashboards/infrastructure/partials/joanna_sections.yaml +++ b/config/dashboards/infrastructure/partials/joanna_sections.yaml @@ -187,102 +187,3 @@ const stale = states['binary_sensor.joanna_memory_index_stale']?.state === 'on'; return `${docs} docs | ${chunks} chunks${stale ? ' | STALE' : ''}`; ]]] - - - type: custom:vertical-stack-in-card - card_mod: - style: !include /config/dashboards/infrastructure/card_mod/infra_panel.yaml - cards: - - type: custom:button-card - template: bearstone_infra_panel_header - name: Codex Reset Credits - - - type: custom:button-card - template: bearstone_infra_list_row - entity: sensor.codex_reset_credit_status - name: Collector Status - icon: mdi:clipboard-pulse-outline - state_display: > - [[[ - const usage = states['sensor.bearclaw_status_telemetry']?.attributes?.codexUsage || {}; - const last = usage.lastCheckAt ? String(usage.lastCheckAt).replace('T', ' ').slice(0, 16) : 'not checked'; - return `${usage.ok === true ? 'ok' : (usage.status || 'unknown')} | ${last}`; - ]]] - - - type: custom:button-card - template: bearstone_infra_status_kpi - entity: binary_sensor.codex_reset_credit_expiring_soon - name: Next Expiration - icon: mdi:calendar-alert - variables: - ok_state: 'off' - warning_text: EXPIRING SOON - critical_text: EXPIRING URGENTLY - warning_entity_ids: - - binary_sensor.codex_reset_credit_expiring_soon - critical_entity_ids: - - binary_sensor.codex_reset_credit_expiring_critical - state_display: > - [[[ - const raw = states['sensor.codex_reset_credit_next_expiration']?.state; - const days = Number(states['sensor.codex_reset_credit_min_days_remaining']?.state); - if (!raw || raw === 'unknown' || raw === 'unavailable') return 'NO DATA'; - const when = new Date(raw).toLocaleString('en-US', { - month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: '2-digit' - }); - return `${when} | ${Number.isFinite(days) ? days.toFixed(1) + ' DAYS' : ''}`; - ]]] - - - type: custom:button-card - template: bearstone_infra_list_row - entity: sensor.codex_reset_credit_status - name: Reset Slot 1 - icon: mdi:numeric-1-box-outline - state_display: > - [[[ - const credit = (entity?.attributes?.credits || []).find(item => Number(item.index) === 1); - if (!credit?.expires_at) return 'NO DATA'; - const when = new Date(credit.expires_at).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }); - const days = Number(credit.days_remaining); - return `${when} | ${Number.isFinite(days) ? days.toFixed(1) + ' DAYS' : String(credit.status || '').toUpperCase()}`; - ]]] - - type: custom:button-card - template: bearstone_infra_list_row - entity: sensor.codex_reset_credit_status - name: Reset Slot 2 - icon: mdi:numeric-2-box-outline - state_display: > - [[[ - const credit = (entity?.attributes?.credits || []).find(item => Number(item.index) === 2); - if (!credit?.expires_at) return 'NO DATA'; - const when = new Date(credit.expires_at).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }); - const days = Number(credit.days_remaining); - return `${when} | ${Number.isFinite(days) ? days.toFixed(1) + ' DAYS' : String(credit.status || '').toUpperCase()}`; - ]]] - - - type: custom:button-card - template: bearstone_infra_list_row - entity: sensor.codex_reset_credit_status - name: Reset Slot 3 - icon: mdi:numeric-3-box-outline - state_display: > - [[[ - const credit = (entity?.attributes?.credits || []).find(item => Number(item.index) === 3); - if (!credit?.expires_at) return 'NO DATA'; - const when = new Date(credit.expires_at).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }); - const days = Number(credit.days_remaining); - return `${when} | ${Number.isFinite(days) ? days.toFixed(1) + ' DAYS' : String(credit.status || '').toUpperCase()}`; - ]]] - - - type: custom:button-card - template: bearstone_infra_list_row - entity: sensor.codex_reset_credit_status - name: Reset Slot 4 - icon: mdi:numeric-4-box-outline - state_display: > - [[[ - const credit = (entity?.attributes?.credits || []).find(item => Number(item.index) === 4); - if (!credit?.expires_at) return 'NO DATA'; - const when = new Date(credit.expires_at).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }); - const days = Number(credit.days_remaining); - return `${when} | ${Number.isFinite(days) ? days.toFixed(1) + ' DAYS' : String(credit.status || '').toUpperCase()}`; - ]]] diff --git a/config/packages/bearclaw.yaml b/config/packages/bearclaw.yaml index d9177a59..f7e22add 100644 --- a/config/packages/bearclaw.yaml +++ b/config/packages/bearclaw.yaml @@ -18,10 +18,6 @@ # Notes: Status telemetry includes the latest 12 dispatches in the rolling 24-hour window for the Joanna Activity drill-down. # Notes: Status telemetry also exposes compact, user-keyed step trends and personal records for the Health dashboard. # Notes: Retired QMD health telemetry is no longer imported or materialized in Home Assistant. -# Notes: Codex reset-credit expiry telemetry is sourced from the appliance `codexUsage` status field. -# Notes: Reset-credit urgency is dashboard-only: warning within 7 days and critical within 3 days; no Repair is created. -# Notes: Codex reset walkthrough: https://youtu.be/7wKhtrvtyiI -# Notes: Codex reset companion post: https://www.vcloudinfo.com/2026/06/track-codex-resets-home-assistant.html # Notes: TeslaMate road-trip walkthrough: https://youtu.be/9-9T6v17NEw # Notes: TeslaMate road-trip companion post: https://www.vcloudinfo.com/2026/07/teslamate-road-trip-reports-codex.html # Notes: Nightly Duplicati verification calls a codex_appliance admin endpoint and returns structured health to HA via response_variable. @@ -148,7 +144,6 @@ sensor: - platform - transports - followups - - codexUsage - memoryIndex - healthInsights @@ -255,70 +250,6 @@ template: {% set elapsed_ms = active.get('elapsedMs', 0) | int(0) %} {{ (elapsed_ms / 60000) | round(1) }} - - name: Codex Reset Credits Available - unique_id: codex_reset_credits_available - icon: mdi:backup-restore - unit_of_measurement: resets - state_class: measurement - state: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('availableCount', 0) | int(0) }} - - - name: Codex Reset Credits Expiring Soon - unique_id: codex_reset_credits_expiring_soon - icon: mdi:alert-clock - unit_of_measurement: resets - state_class: measurement - state: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('warningCount', 0) | int(0) }} - - - name: Codex Reset Credit Min Days Remaining - unique_id: codex_reset_credit_min_days_remaining - icon: mdi:timer-sand - unit_of_measurement: d - state_class: measurement - availability: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('minDaysRemaining') not in [none, 'unknown', 'unavailable', ''] }} - state: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('minDaysRemaining', 0) | float(0) | round(1) }} - - - name: Codex Reset Credit Next Expiration - unique_id: codex_reset_credit_next_expiration - icon: mdi:calendar-clock - device_class: timestamp - availability: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('soonestExpiresAt') not in [none, 'unknown', 'unavailable', ''] }} - state: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('soonestExpiresAt') }} - - - name: Codex Reset Credit Status - unique_id: codex_reset_credit_status - icon: mdi:clipboard-pulse-outline - state: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('status', 'unknown') }} - attributes: - ok: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('ok', false) }} - last_check_at: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('lastCheckAt') }} - next_check_at: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('nextCheckAt') }} - last_error: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('lastError') }} - credits: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('credits', []) }} - - name: Joanna Minutes Since HA Dispatch unique_id: joanna_minutes_since_ha_dispatch icon: mdi:clock-fast @@ -503,37 +434,6 @@ template: {% set memory = state_attr('sensor.bearclaw_status_telemetry', 'memoryIndex') | default({}, true) %} {{ memory.get('stale', false) in [true, 'true', 'True', 'on', 'yes', 1, '1'] }} - - name: Codex Reset Credit Expiring Soon - unique_id: codex_reset_credit_expiring_soon - icon: mdi:alert-clock - state: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('issueActive', false) in [true, 'true', 'True', 'on', 'yes', 1, '1'] }} - attributes: - warn_days: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('warnDays', 7) }} - warning_count: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('warningCount', 0) }} - soonest_expires_at: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('soonestExpiresAt') }} - - - name: Codex Reset Credit Expiring Critical - unique_id: codex_reset_credit_expiring_critical - device_class: problem - icon: mdi:calendar-alert - state: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {% set available = usage.get('availableCount', 0) | int(0) %} - {% set min_days = usage.get('minDaysRemaining') %} - {{ available > 0 and min_days not in [none, 'unknown', 'unavailable', ''] and min_days | float(99) <= 3 }} - attributes: - critical_days: 3 - min_days_remaining: >- - {% set usage = state_attr('sensor.bearclaw_status_telemetry', 'codexUsage') | default({}, true) %} - {{ usage.get('minDaysRemaining') }} automation: - id: bearclaw_lifecycle_webhook alias: BearClaw Lifecycle Webhook diff --git a/tools/dashboard_entity_allowlist.txt b/tools/dashboard_entity_allowlist.txt index 00ce2c21..5dfedc60 100644 --- a/tools/dashboard_entity_allowlist.txt +++ b/tools/dashboard_entity_allowlist.txt @@ -1,6 +1,5 @@ # Static dashboard entities supplied by UI-managed helpers or integrations. # Keep sorted. The validator proves these exist in live HA storage when available. -binary_sensor.codex_reset_credit_expiring_soon binary_sensor.garage_phyn_leak_alert binary_sensor.mcu1_gpio10 binary_sensor.mcu1_gpio13 @@ -51,7 +50,6 @@ sensor.carlo_nas01_temperature sensor.carlo_nas01_volume_1_used_space sensor.carlo_nvr_temperature sensor.carlo_nvr_volume_1_used_space -sensor.codex_reset_credit_status sensor.database_oldest_record sensor.database_records_per_day sensor.database_size