From d05b010be0441f5e30f9d7ef8947b5879ebb85f0 Mon Sep 17 00:00:00 2001 From: Carlo Costanzo Date: Tue, 17 Feb 2026 09:13:20 -0500 Subject: [PATCH] Enhance Docker infrastructure dashboard by adding support for dozzle_agent_17 and fed437a0f191_tugtainer_socket_proxy. Update APT update card to include docker_17 entities and remove reboot status references. Refactor button card templates for improved clarity. Remove unused Activity Feed view and related configurations. --- .../docker_container_rows_include.yaml | 18 + .../partials/docker_containers_sections.yaml | 13 +- .../partials/home_sections.yaml | 64 ---- .../partials/website_health_sections.yaml | 84 ----- .../templates/button_card_templates.yaml | 5 +- .../views/08_activity_feed.yaml | 20 -- .../infrastructure_apt_updates_card.yaml | 11 +- .../infrastructure_apt_updates_view.yaml | 13 +- config/packages/README.md | 2 +- config/packages/docker_infrastructure.yaml | 321 +++++------------- tools/ha_ui_smoke.ps1 | 1 - 11 files changed, 125 insertions(+), 427 deletions(-) delete mode 100644 config/dashboards/infrastructure/views/08_activity_feed.yaml diff --git a/config/dashboards/infrastructure/partials/docker_container_rows_include.yaml b/config/dashboards/infrastructure/partials/docker_container_rows_include.yaml index df118656..f72072ad 100644 --- a/config/dashboards/infrastructure/partials/docker_container_rows_include.yaml +++ b/config/dashboards/infrastructure/partials/docker_container_rows_include.yaml @@ -90,6 +90,15 @@ variables: restart_button: button.dozzle_agent_14_restart_container name: dozzle_agent_14 +- entity_id: binary_sensor.dozzle_agent_17_status + options: + type: custom:button-card + template: bearstone_infra_container_row + name: dozzle_agent_17 + icon: mdi:docker + variables: + restart_button: button.dozzle_agent_17_restart_container + name: dozzle_agent_17 - entity_id: binary_sensor.dozzle_status options: type: custom:button-card @@ -117,6 +126,15 @@ variables: restart_button: button.esphome_restart_container name: esphome +- entity_id: binary_sensor.fed437a0f191_tugtainer_socket_proxy_status + options: + type: custom:button-card + template: bearstone_infra_container_row + name: fed437a0f191_tugtainer_socket_proxy + icon: mdi:docker + variables: + restart_button: button.fed437a0f191_tugtainer_socket_proxy_restart_container + name: fed437a0f191_tugtainer_socket_proxy - entity_id: binary_sensor.foodie_tracker_status options: type: custom:button-card diff --git a/config/dashboards/infrastructure/partials/docker_containers_sections.yaml b/config/dashboards/infrastructure/partials/docker_containers_sections.yaml index 2cce2caf..ab1f9825 100644 --- a/config/dashboards/infrastructure/partials/docker_containers_sections.yaml +++ b/config/dashboards/infrastructure/partials/docker_containers_sections.yaml @@ -35,7 +35,7 @@ - type: grid column_span: 4 - columns: 3 + columns: 4 square: false cards: - type: custom:button-card @@ -44,16 +44,22 @@ entity: sensor.docker_10_apt_status variables: last_update_sensor: sensor.docker_10_apt_last_update - reboot_status_sensor: sensor.docker_10_apt_reboot_status prune_button: button.carlo_hass_prune_unused_images name: docker_10 + - type: custom:button-card + template: bearstone_infra_apt_prune_tile + name: docker_17 + entity: sensor.docker_17_apt_status + variables: + last_update_sensor: sensor.docker_17_apt_last_update + prune_button: button.docker17_prune_unused_images + name: docker_17 - type: custom:button-card template: bearstone_infra_apt_prune_tile name: docker_69 entity: sensor.docker_69_apt_status variables: last_update_sensor: sensor.docker_69_apt_last_update - reboot_status_sensor: sensor.docker_69_apt_reboot_status prune_button: button.docker69_prune_unused_images name: docker_69 - type: custom:button-card @@ -62,7 +68,6 @@ entity: sensor.docker_14_apt_status variables: last_update_sensor: sensor.docker_14_apt_last_update - reboot_status_sensor: sensor.docker_14_apt_reboot_status prune_button: button.docker2_prune_unused_images name: docker_14 diff --git a/config/dashboards/infrastructure/partials/home_sections.yaml b/config/dashboards/infrastructure/partials/home_sections.yaml index 4034fe64..1303a004 100644 --- a/config/dashboards/infrastructure/partials/home_sections.yaml +++ b/config/dashboards/infrastructure/partials/home_sections.yaml @@ -365,45 +365,6 @@ tap_action: action: none - - type: custom:button-card - template: bearstone_infra_alert_row - entity: binary_sensor.docker_10_apt_reboot_required - name: docker_10 needs reboot - icon: mdi:restart-alert - variables: - alert_kind: binary_on - tap_action: - action: navigate - navigation_path: /dashboard-infrastructure/docker - state_display: > - [[[ return 'REBOOT REQUIRED'; ]]] - - - type: custom:button-card - template: bearstone_infra_alert_row - entity: binary_sensor.docker_14_apt_reboot_required - name: docker_14 needs reboot - icon: mdi:restart-alert - variables: - alert_kind: binary_on - tap_action: - action: navigate - navigation_path: /dashboard-infrastructure/docker - state_display: > - [[[ return 'REBOOT REQUIRED'; ]]] - - - type: custom:button-card - template: bearstone_infra_alert_row - entity: binary_sensor.docker_69_apt_reboot_required - name: docker_69 needs reboot - icon: mdi:restart-alert - variables: - alert_kind: binary_on - tap_action: - action: navigate - navigation_path: /dashboard-infrastructure/docker - state_display: > - [[[ return 'REBOOT REQUIRED'; ]]] - - type: custom:auto-entities show_empty: false card: @@ -602,28 +563,3 @@ - entity: sensor.speedtest_upload name: Upload -# ------------------------------------------------------------------- -# Activity highlights (compact) -# ------------------------------------------------------------------- -- type: grid - column_span: 4 - columns: 1 - square: false - cards: - - type: custom:vertical-stack-in-card - grid_options: - columns: full - card_mod: - style: !include /config/dashboards/infrastructure/card_mod/infra_panel.yaml - cards: - - type: custom:button-card - template: bearstone_infra_panel_header - name: Activity Highlights - tap_action: - action: navigate - navigation_path: /dashboard-infrastructure/activity - - type: logbook - target: - entity_id: - - sensor.activity_feed - hours_to_show: 24 diff --git a/config/dashboards/infrastructure/partials/website_health_sections.yaml b/config/dashboards/infrastructure/partials/website_health_sections.yaml index 5d027871..b55d1511 100644 --- a/config/dashboards/infrastructure/partials/website_health_sections.yaml +++ b/config/dashboards/infrastructure/partials/website_health_sections.yaml @@ -150,87 +150,3 @@ return `${days}d | ${exp}`; ]]] -# ------------------------------------------------------------------- -# Certificate health -# ------------------------------------------------------------------- -- type: grid - column_span: 4 - columns: 1 - square: false - cards: - - type: custom:vertical-stack-in-card - grid_options: - columns: full - card_mod: - style: !include /config/dashboards/infrastructure/card_mod/infra_panel.yaml - cards: - - type: custom:button-card - template: bearstone_infra_panel_header - name: Certificate Health - - type: custom:button-card - template: bearstone_infra_list_row - name: Cert telemetry sensors - icon: mdi:certificate-outline - state_display: > - [[[ - const keys = Object.keys(states).filter((k) => - k.startsWith('sensor.') && - /(vcloudinfo|kingcrafthomes)/.test(k) && - /(cert|ssl|tls)/.test(k) - ); - return keys.length === 0 ? 'Missing (domain expiry only)' : `${keys.length} sensor(s)`; - ]]] - - type: custom:button-card - template: bearstone_infra_list_row - name: Minimum cert days remaining - icon: mdi:calendar-alert - state_display: > - [[[ - const keys = Object.keys(states).filter((k) => - k.startsWith('sensor.') && - /(vcloudinfo|kingcrafthomes)/.test(k) && - /(cert|ssl|tls)/.test(k) - ); - let min = null; - keys.forEach((k) => { - const n = Number(states[k]?.state); - if (Number.isFinite(n)) min = (min === null) ? n : Math.min(min, n); - }); - return (min === null) ? 'Not available' : `${Math.round(min)} days`; - ]]] - - type: custom:button-card - template: bearstone_infra_list_row - name: Cert warning (< 30d) - icon: mdi:alert-outline - state_display: > - [[[ - const keys = Object.keys(states).filter((k) => - k.startsWith('sensor.') && - /(vcloudinfo|kingcrafthomes)/.test(k) && - /(cert|ssl|tls)/.test(k) - ); - let min = null; - keys.forEach((k) => { - const n = Number(states[k]?.state); - if (Number.isFinite(n)) min = (min === null) ? n : Math.min(min, n); - }); - return (min !== null && min < 30 && min >= 14) ? 'ALERT' : 'OK'; - ]]] - - type: custom:button-card - template: bearstone_infra_list_row - name: Cert critical (< 14d) - icon: mdi:alert-circle - state_display: > - [[[ - const keys = Object.keys(states).filter((k) => - k.startsWith('sensor.') && - /(vcloudinfo|kingcrafthomes)/.test(k) && - /(cert|ssl|tls)/.test(k) - ); - let min = null; - keys.forEach((k) => { - const n = Number(states[k]?.state); - if (Number.isFinite(n)) min = (min === null) ? n : Math.min(min, n); - }); - return (min !== null && min < 14) ? 'ALERT' : 'OK'; - ]]] diff --git a/config/dashboards/infrastructure/templates/button_card_templates.yaml b/config/dashboards/infrastructure/templates/button_card_templates.yaml index 63f52a86..94e35ae7 100644 --- a/config/dashboards/infrastructure/templates/button_card_templates.yaml +++ b/config/dashboards/infrastructure/templates/button_card_templates.yaml @@ -165,11 +165,8 @@ bearstone_infra_apt_prune_tile: label: >- [[[ const lastSensor = variables.last_update_sensor ? variables.last_update_sensor : ''; - const rebootSensor = variables.reboot_status_sensor ? variables.reboot_status_sensor : ''; const lastValue = lastSensor ? (states[lastSensor]?.state ?? 'unknown') : 'unknown'; - const rebootValue = rebootSensor ? (states[rebootSensor]?.state ?? '') : ''; - const rebootText = rebootValue ? (" | " + rebootValue) : ''; - return "Last update: " + lastValue + rebootText + " | Hold to prune"; + return "Last update: " + lastValue + " | Hold to prune"; ]]] bearstone_infra_container_row: diff --git a/config/dashboards/infrastructure/views/08_activity_feed.yaml b/config/dashboards/infrastructure/views/08_activity_feed.yaml deleted file mode 100644 index 046ae0de..00000000 --- a/config/dashboards/infrastructure/views/08_activity_feed.yaml +++ /dev/null @@ -1,20 +0,0 @@ -###################################################################### -# @CCOSTAN - Follow Me on X -# For more info visit https://www.vcloudinfo.com/click-here -# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig -# ------------------------------------------------------------------- -# Infrastructure View - Untitled -# YAML-exported Lovelace dashboard (split into view files). -# ------------------------------------------------------------------- -# Notes: Exported from config/.storage/lovelace.dashboard_infrastructure view index 4. -###################################################################### - -icon: mdi:clipboard-text-outline -title: Activity -path: activity -type: sections -theme: default -max_columns: 4 -badges: [] -cards: [] -sections: !include /config/dashboards/infrastructure/partials/activity_sections.yaml diff --git a/config/lovelace/infrastructure_apt_updates_card.yaml b/config/lovelace/infrastructure_apt_updates_card.yaml index 3af5abb7..bc88f4d2 100644 --- a/config/lovelace/infrastructure_apt_updates_card.yaml +++ b/config/lovelace/infrastructure_apt_updates_card.yaml @@ -6,7 +6,7 @@ # Infrastructure Card - APT update status for Docker hosts # Paste this card into the existing Infrastructure dashboard (storage mode). # ------------------------------------------------------------------- -# Notes: Depends on `config/packages/apt_updates.yaml`. +# Notes: Depends on `config/packages/docker_infrastructure.yaml`. ###################################################################### type: entities @@ -18,18 +18,21 @@ entities: - entity: sensor.docker_10_apt_status - entity: sensor.docker_10_apt_last_check - entity: sensor.docker_10_apt_last_update - - entity: sensor.docker_10_apt_reboot_status - type: section label: docker_14 - entity: sensor.docker_14_apt_status - entity: sensor.docker_14_apt_last_check - entity: sensor.docker_14_apt_last_update - - entity: sensor.docker_14_apt_reboot_status + + - type: section + label: docker_17 + - entity: sensor.docker_17_apt_status + - entity: sensor.docker_17_apt_last_check + - entity: sensor.docker_17_apt_last_update - type: section label: docker_69 - entity: sensor.docker_69_apt_status - entity: sensor.docker_69_apt_last_check - entity: sensor.docker_69_apt_last_update - - entity: sensor.docker_69_apt_reboot_status diff --git a/config/lovelace/infrastructure_apt_updates_view.yaml b/config/lovelace/infrastructure_apt_updates_view.yaml index c967e204..69ae4520 100644 --- a/config/lovelace/infrastructure_apt_updates_view.yaml +++ b/config/lovelace/infrastructure_apt_updates_view.yaml @@ -6,7 +6,7 @@ # Infrastructure View - APT updates (3-column layout) # Paste this view into the Infrastructure dashboard (storage mode). # ------------------------------------------------------------------- -# Notes: Uses `sensor.docker_*` entities from `config/packages/apt_updates.yaml`. +# Notes: Uses `sensor.docker_*` entities from `config/packages/docker_infrastructure.yaml`. ###################################################################### title: "Infrastructure - APT Updates" @@ -25,7 +25,6 @@ sections: - entity: sensor.docker_10_apt_status - entity: sensor.docker_10_apt_last_check - entity: sensor.docker_10_apt_last_update - - entity: sensor.docker_10_apt_reboot_status - type: entities title: docker_14 @@ -34,7 +33,14 @@ sections: - entity: sensor.docker_14_apt_status - entity: sensor.docker_14_apt_last_check - entity: sensor.docker_14_apt_last_update - - entity: sensor.docker_14_apt_reboot_status + + - type: entities + title: docker_17 + show_header_toggle: false + entities: + - entity: sensor.docker_17_apt_status + - entity: sensor.docker_17_apt_last_check + - entity: sensor.docker_17_apt_last_update - type: entities title: docker_69 @@ -43,4 +49,3 @@ sections: - entity: sensor.docker_69_apt_status - entity: sensor.docker_69_apt_last_check - entity: sensor.docker_69_apt_last_update - - entity: sensor.docker_69_apt_reboot_status diff --git a/config/packages/README.md b/config/packages/README.md index fc40b931..583b62eb 100755 --- a/config/packages/README.md +++ b/config/packages/README.md @@ -45,7 +45,7 @@ Live collection of plug-and-play Home Assistant packages. Each YAML file in this | [lightning.yaml](lightning.yaml) | Blitzortung lightning counter monitoring with snoozeable push actions. | `sensor.blitzortung_lightning_counter`, `input_boolean.snooze_lightning`, notify engine actions | | [logbook_activity_feed.yaml](logbook_activity_feed.yaml) | Dummy `sensor.activity_feed` + helper to write clean Activity entries (Issue #1550). | `sensor.activity_feed`, `script.send_to_logbook` | | [mariadb_monitoring.yaml](mariadb_monitoring.yaml) | MariaDB health sensors and Lovelace dashboard snippet for recorder stats. | `sensor.mariadb_status`, `sensor.database_size` | -| [docker_infrastructure.yaml](docker_infrastructure.yaml) | Docker host patching + staggered auto-reboot flow + container-down Repairs alerts. | `sensor.docker_*_apt_status`, `repairs.create`, `repairs.remove` | +| [docker_infrastructure.yaml](docker_infrastructure.yaml) | Docker host patching telemetry (docker_10/14/17/69) + host-side auto-reboots + container-down Repairs alerts. | `sensor.docker_*_apt_status`, `repairs.create`, `repairs.remove` | | [infrastructure_observability.yaml](infrastructure_observability.yaml) | Normalized WAN/DNS/backup/domain/cert health sensors used by the Infrastructure Home + Website Health dashboards. | `binary_sensor.infra_*`, `sensor.infra_*`, `script.send_to_logbook` | | [mariadb.yaml](mariadb.yaml) | MariaDB recorder health and capacity SQL sensors. | `sensor.mariadb_status`, `sensor.database_size` | | [tugtainer_updates.yaml](tugtainer_updates.yaml) | Tugtainer container update notifications via webhook + persistent alerts. | `persistent_notification.create`, `input_datetime.tugtainer_last_update` | diff --git a/config/packages/docker_infrastructure.yaml b/config/packages/docker_infrastructure.yaml index 090c4ca5..3f7c1077 100644 --- a/config/packages/docker_infrastructure.yaml +++ b/config/packages/docker_infrastructure.yaml @@ -4,11 +4,11 @@ # Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig # ------------------------------------------------------------------- # Docker Infrastructure - Host patching and container alerts -# APT webhook results and container down repairs. +# APT webhook results (docker_10/14/17/69) and container down repairs. # ------------------------------------------------------------------- # Notes: Hosts run weekly Wed 12:00 APT job and POST JSON to webhooks. -# Notes: If reboot is required, hosts auto-schedule reboot after posting status. -# Notes: Reboot staggering: docker_14 reboots first, docker_10 reboots later. +# Notes: Reboots are handled directly on each host by apt_weekly.sh. +# Notes: Reboot staggering: docker_14 first, docker_69 second, docker_10 third. # Notes: Container watchlist is explicit; extend entity list as needed. ###################################################################### @@ -21,6 +21,14 @@ input_datetime: name: "docker_10 APT last update" has_date: true has_time: true + apt_docker_17_last_check: + name: "docker_17 APT last check" + has_date: true + has_time: true + apt_docker_17_last_update: + name: "docker_17 APT last update" + has_date: true + has_time: true apt_docker_14_last_check: name: "docker_14 APT last check" has_date: true @@ -42,6 +50,9 @@ input_text: apt_docker_10_last_result: name: "docker_10 APT last result" max: 255 + apt_docker_17_last_result: + name: "docker_17 APT last result" + max: 255 apt_docker_14_last_result: name: "docker_14 APT last result" max: 255 @@ -49,17 +60,6 @@ input_text: name: "docker_69 APT last result" max: 255 -input_boolean: - apt_docker_10_reboot_required: - name: "docker_10 reboot required" - icon: mdi:restart-alert - apt_docker_14_reboot_required: - name: "docker_14 reboot required" - icon: mdi:restart-alert - apt_docker_69_reboot_required: - name: "docker_69 reboot required" - icon: mdi:restart-alert - template: - sensor: - name: "docker_10 APT status" @@ -82,18 +82,30 @@ template: {% if stamp not in ['unknown', 'unavailable', 'none', ''] %} {{ as_local(as_datetime(stamp)) }} {% endif %} - - name: "docker_10 APT reboot status" - unique_id: apt_docker_10_reboot_status - icon: >- - {{ 'mdi:restart-alert' if is_state('input_boolean.apt_docker_10_reboot_required', 'on') - else 'mdi:check-circle' }} - state: >- - {{ 'REBOOT REQUIRED' if is_state('input_boolean.apt_docker_10_reboot_required', 'on') - else 'NO REBOOT NEEDED' }} - name: "docker_14 APT status" unique_id: apt_docker_14_status icon: mdi:package-up state: "{{ states('input_text.apt_docker_14_last_result') }}" + - name: "docker_17 APT status" + unique_id: apt_docker_17_status + icon: mdi:package-up + state: "{{ states('input_text.apt_docker_17_last_result') }}" + - name: "docker_17 APT last check" + unique_id: apt_docker_17_last_check + device_class: timestamp + state: >- + {% set stamp = states('input_datetime.apt_docker_17_last_check') %} + {% if stamp not in ['unknown', 'unavailable', 'none', ''] %} + {{ as_local(as_datetime(stamp)) }} + {% endif %} + - name: "docker_17 APT last update" + unique_id: apt_docker_17_last_update + device_class: timestamp + state: >- + {% set stamp = states('input_datetime.apt_docker_17_last_update') %} + {% if stamp not in ['unknown', 'unavailable', 'none', ''] %} + {{ as_local(as_datetime(stamp)) }} + {% endif %} - name: "docker_14 APT last check" unique_id: apt_docker_14_last_check device_class: timestamp @@ -110,14 +122,6 @@ template: {% if stamp not in ['unknown', 'unavailable', 'none', ''] %} {{ as_local(as_datetime(stamp)) }} {% endif %} - - name: "docker_14 APT reboot status" - unique_id: apt_docker_14_reboot_status - icon: >- - {{ 'mdi:restart-alert' if is_state('input_boolean.apt_docker_14_reboot_required', 'on') - else 'mdi:check-circle' }} - state: >- - {{ 'REBOOT REQUIRED' if is_state('input_boolean.apt_docker_14_reboot_required', 'on') - else 'NO REBOOT NEEDED' }} - name: "docker_69 APT status" unique_id: apt_docker_69_status icon: mdi:package-up @@ -138,31 +142,6 @@ template: {% if stamp not in ['unknown', 'unavailable', 'none', ''] %} {{ as_local(as_datetime(stamp)) }} {% endif %} - - name: "docker_69 APT reboot status" - unique_id: apt_docker_69_reboot_status - icon: >- - {{ 'mdi:restart-alert' if is_state('input_boolean.apt_docker_69_reboot_required', 'on') - else 'mdi:check-circle' }} - state: >- - {{ 'REBOOT REQUIRED' if is_state('input_boolean.apt_docker_69_reboot_required', 'on') - else 'NO REBOOT NEEDED' }} - - - binary_sensor: - - name: "docker_10 APT reboot required" - unique_id: apt_docker_10_reboot_required - device_class: problem - icon: mdi:restart-alert - state: "{{ is_state('input_boolean.apt_docker_10_reboot_required', 'on') }}" - - name: "docker_14 APT reboot required" - unique_id: apt_docker_14_reboot_required - device_class: problem - icon: mdi:restart-alert - state: "{{ is_state('input_boolean.apt_docker_14_reboot_required', 'on') }}" - - name: "docker_69 APT reboot required" - unique_id: apt_docker_69_reboot_required - device_class: problem - icon: mdi:restart-alert - state: "{{ is_state('input_boolean.apt_docker_69_reboot_required', 'on') }}" automation: - alias: "APT Update Report - docker_10" @@ -180,22 +159,17 @@ automation: success: "{{ payload.get('success', true) | bool }}" updated: "{{ payload.get('updated', false) | bool }}" packages: "{{ payload.get('packages', 0) | int(0) }}" - reboot_required: "{{ payload.get('reboot_required', false) | bool }}" - auto_reboot_scheduled: "{{ payload.get('auto_reboot_scheduled', false) | bool }}" - reboot_delay_minutes: "{{ payload.get('reboot_delay_minutes', 0) | int(0) }}" message: "{{ payload.get('message', '') | string }}" result: >- {% if not success %} ERROR{% if (message | trim) != '' %}: {{ message | trim }}{% endif %} - {% elif reboot_required and not updated %} - REBOOT REQUIRED{% if auto_reboot_scheduled %}; AUTO REBOOT {{ reboot_delay_minutes }}M{% endif %} {% elif updated %} - UPDATED {{ packages }} PKGS{% if reboot_required %}; REBOOT REQUIRED{% endif %}{% if auto_reboot_scheduled %}; AUTO REBOOT {{ reboot_delay_minutes }}M{% endif %} + UPDATED {{ packages }} PKGS {% else %} NO UPDATES {% endif %} log_message: >- - docker_10 updated {{ packages }} package{% if packages != 1 %}s{% endif %}{% if reboot_required %} (reboot required){% endif %}{% if auto_reboot_scheduled %}; auto reboot in {{ reboot_delay_minutes }} minute{% if reboot_delay_minutes != 1 %}s{% endif %}{% endif %}. + docker_10 updated {{ packages }} package{% if packages != 1 %}s{% endif %}. action: - service: input_datetime.set_datetime target: @@ -207,16 +181,6 @@ automation: entity_id: input_text.apt_docker_10_last_result data: value: "{{ result }}" - - choose: - - conditions: "{{ success and reboot_required }}" - sequence: - - service: input_boolean.turn_on - target: - entity_id: input_boolean.apt_docker_10_reboot_required - default: - - service: input_boolean.turn_off - target: - entity_id: input_boolean.apt_docker_10_reboot_required - choose: - conditions: "{{ success and updated }}" sequence: @@ -245,22 +209,17 @@ automation: success: "{{ payload.get('success', true) | bool }}" updated: "{{ payload.get('updated', false) | bool }}" packages: "{{ payload.get('packages', 0) | int(0) }}" - reboot_required: "{{ payload.get('reboot_required', false) | bool }}" - auto_reboot_scheduled: "{{ payload.get('auto_reboot_scheduled', false) | bool }}" - reboot_delay_minutes: "{{ payload.get('reboot_delay_minutes', 0) | int(0) }}" message: "{{ payload.get('message', '') | string }}" result: >- {% if not success %} ERROR{% if (message | trim) != '' %}: {{ message | trim }}{% endif %} - {% elif reboot_required and not updated %} - REBOOT REQUIRED{% if auto_reboot_scheduled %}; AUTO REBOOT {{ reboot_delay_minutes }}M{% endif %} {% elif updated %} - UPDATED {{ packages }} PKGS{% if reboot_required %}; REBOOT REQUIRED{% endif %}{% if auto_reboot_scheduled %}; AUTO REBOOT {{ reboot_delay_minutes }}M{% endif %} + UPDATED {{ packages }} PKGS {% else %} NO UPDATES {% endif %} log_message: >- - docker_14 updated {{ packages }} package{% if packages != 1 %}s{% endif %}{% if reboot_required %} (reboot required){% endif %}{% if auto_reboot_scheduled %}; auto reboot in {{ reboot_delay_minutes }} minute{% if reboot_delay_minutes != 1 %}s{% endif %}{% endif %}. + docker_14 updated {{ packages }} package{% if packages != 1 %}s{% endif %}. action: - service: input_datetime.set_datetime target: @@ -272,16 +231,6 @@ automation: entity_id: input_text.apt_docker_14_last_result data: value: "{{ result }}" - - choose: - - conditions: "{{ success and reboot_required }}" - sequence: - - service: input_boolean.turn_on - target: - entity_id: input_boolean.apt_docker_14_reboot_required - default: - - service: input_boolean.turn_off - target: - entity_id: input_boolean.apt_docker_14_reboot_required - choose: - conditions: "{{ success and updated }}" sequence: @@ -295,13 +244,13 @@ automation: topic: "APT" message: "{{ log_message }}" - - alias: "APT Update Report - docker_69" - id: apt_update_report_docker_69 - description: "Receive docker_69 APT results and update helpers/logbook." + - alias: "APT Update Report - docker_17" + id: apt_update_report_docker_17 + description: "Receive docker_17 APT results and update helpers/logbook." mode: queued trigger: - platform: webhook - webhook_id: !secret apt_webhook_docker_69 + webhook_id: !secret apt_webhook_docker_17 allowed_methods: - POST local_only: true @@ -310,49 +259,34 @@ automation: success: "{{ payload.get('success', true) | bool }}" updated: "{{ payload.get('updated', false) | bool }}" packages: "{{ payload.get('packages', 0) | int(0) }}" - reboot_required: "{{ payload.get('reboot_required', false) | bool }}" - auto_reboot_scheduled: "{{ payload.get('auto_reboot_scheduled', false) | bool }}" - reboot_delay_minutes: "{{ payload.get('reboot_delay_minutes', 0) | int(0) }}" message: "{{ payload.get('message', '') | string }}" result: >- {% if not success %} ERROR{% if (message | trim) != '' %}: {{ message | trim }}{% endif %} - {% elif reboot_required and not updated %} - REBOOT REQUIRED{% if auto_reboot_scheduled %}; AUTO REBOOT {{ reboot_delay_minutes }}M{% endif %} {% elif updated %} - UPDATED {{ packages }} PKGS{% if reboot_required %}; REBOOT REQUIRED{% endif %}{% if auto_reboot_scheduled %}; AUTO REBOOT {{ reboot_delay_minutes }}M{% endif %} + UPDATED {{ packages }} PKGS {% else %} NO UPDATES {% endif %} log_message: >- - docker_69 updated {{ packages }} package{% if packages != 1 %}s{% endif %}{% if reboot_required %} (reboot required){% endif %}{% if auto_reboot_scheduled %}; auto reboot in {{ reboot_delay_minutes }} minute{% if reboot_delay_minutes != 1 %}s{% endif %}{% endif %}. + docker_17 updated {{ packages }} package{% if packages != 1 %}s{% endif %}. action: - service: input_datetime.set_datetime target: - entity_id: input_datetime.apt_docker_69_last_check + entity_id: input_datetime.apt_docker_17_last_check data: datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - service: input_text.set_value target: - entity_id: input_text.apt_docker_69_last_result + entity_id: input_text.apt_docker_17_last_result data: value: "{{ result }}" - - choose: - - conditions: "{{ success and reboot_required }}" - sequence: - - service: input_boolean.turn_on - target: - entity_id: input_boolean.apt_docker_69_reboot_required - default: - - service: input_boolean.turn_off - target: - entity_id: input_boolean.apt_docker_69_reboot_required - choose: - conditions: "{{ success and updated }}" sequence: - service: input_datetime.set_datetime target: - entity_id: input_datetime.apt_docker_69_last_update + entity_id: input_datetime.apt_docker_17_last_update data: datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - service: script.send_to_logbook @@ -360,150 +294,55 @@ automation: topic: "APT" message: "{{ log_message }}" - - alias: "APT Boot Report - docker_10" - id: apt_boot_report_docker_10 - description: "Clear or keep reboot-required flag after docker_10 boots." - mode: queued - trigger: - - platform: webhook - webhook_id: !secret apt_boot_webhook_docker_10 - allowed_methods: - - POST - local_only: true - variables: - payload: "{{ trigger.json | default({}) }}" - reboot_required: "{{ payload.get('reboot_required', false) | bool }}" - action: - - choose: - - conditions: "{{ reboot_required }}" - sequence: - - service: input_boolean.turn_on - target: - entity_id: input_boolean.apt_docker_10_reboot_required - - service: script.send_to_logbook - data: - topic: "APT" - message: "docker_10 boot report: reboot is still required." - default: - - service: input_boolean.turn_off - target: - entity_id: input_boolean.apt_docker_10_reboot_required - - service: script.send_to_logbook - data: - topic: "APT" - message: "docker_10 reboot completed and reboot flag cleared." - - - alias: "APT Boot Report - docker_14" - id: apt_boot_report_docker_14 - description: "Clear or keep reboot-required flag after docker_14 boots." + - alias: "APT Update Report - docker_69" + id: apt_update_report_docker_69 + description: "Receive docker_69 APT results and update helpers/logbook." mode: queued trigger: - platform: webhook - webhook_id: !secret apt_boot_webhook_docker_14 + webhook_id: !secret apt_webhook_docker_69 allowed_methods: - POST local_only: true variables: payload: "{{ trigger.json | default({}) }}" - reboot_required: "{{ payload.get('reboot_required', false) | bool }}" + success: "{{ payload.get('success', true) | bool }}" + updated: "{{ payload.get('updated', false) | bool }}" + packages: "{{ payload.get('packages', 0) | int(0) }}" + message: "{{ payload.get('message', '') | string }}" + result: >- + {% if not success %} + ERROR{% if (message | trim) != '' %}: {{ message | trim }}{% endif %} + {% elif updated %} + UPDATED {{ packages }} PKGS + {% else %} + NO UPDATES + {% endif %} + log_message: >- + docker_69 updated {{ packages }} package{% if packages != 1 %}s{% endif %}. action: + - service: input_datetime.set_datetime + target: + entity_id: input_datetime.apt_docker_69_last_check + data: + datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" + - service: input_text.set_value + target: + entity_id: input_text.apt_docker_69_last_result + data: + value: "{{ result }}" - choose: - - conditions: "{{ reboot_required }}" + - conditions: "{{ success and updated }}" sequence: - - service: input_boolean.turn_on + - service: input_datetime.set_datetime target: - entity_id: input_boolean.apt_docker_14_reboot_required - - service: script.send_to_logbook + entity_id: input_datetime.apt_docker_69_last_update data: - topic: "APT" - message: "docker_14 boot report: reboot is still required." - default: - - service: input_boolean.turn_off - target: - entity_id: input_boolean.apt_docker_14_reboot_required - - service: script.send_to_logbook - data: - topic: "APT" - message: "docker_14 reboot completed and reboot flag cleared." - - - alias: "APT Boot Report - docker_69" - id: apt_boot_report_docker_69 - description: "Clear or keep reboot-required flag after docker_69 boots." - mode: queued - trigger: - - platform: webhook - webhook_id: !secret apt_boot_webhook_docker_69 - allowed_methods: - - POST - local_only: true - variables: - payload: "{{ trigger.json | default({}) }}" - reboot_required: "{{ payload.get('reboot_required', false) | bool }}" - action: - - choose: - - conditions: "{{ reboot_required }}" - sequence: - - service: input_boolean.turn_on - target: - entity_id: input_boolean.apt_docker_69_reboot_required + datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - service: script.send_to_logbook data: topic: "APT" - message: "docker_69 boot report: reboot is still required." - default: - - service: input_boolean.turn_off - target: - entity_id: input_boolean.apt_docker_69_reboot_required - - service: script.send_to_logbook - data: - topic: "APT" - message: "docker_69 reboot completed and reboot flag cleared." - - - alias: "APT Reboot Repairs" - id: apt_reboot_repairs - description: "Create or clear Repairs issues when Docker hosts need a reboot." - mode: queued - trigger: - - platform: state - entity_id: - - binary_sensor.docker_10_apt_reboot_required - - binary_sensor.docker_14_apt_reboot_required - - binary_sensor.docker_69_apt_reboot_required - variables: - host_name: >- - {% if 'docker_10' in trigger.entity_id %} - docker_10 - {% elif 'docker_14' in trigger.entity_id %} - docker_14 - {% else %} - docker_69 - {% endif %} - issue_id: >- - {% if 'docker_10' in trigger.entity_id %} - apt_docker_10_reboot_required - {% elif 'docker_14' in trigger.entity_id %} - apt_docker_14_reboot_required - {% else %} - apt_docker_69_reboot_required - {% endif %} - action: - - choose: - - conditions: "{{ trigger.to_state.state == 'on' }}" - sequence: - - service: repairs.create - data: - issue_id: "{{ issue_id }}" - severity: warning - persistent: true - title: "{{ host_name }} needs reboot" - description: >- - {{ host_name }} reports a reboot is required after APT updates. - Status: {{ states('sensor.' ~ host_name ~ '_apt_status') }}. - default: - - continue_on_error: true - service: repairs.remove - data: - issue_id: "{{ issue_id }}" + message: "{{ log_message }}" - alias: "Docker Container Offline - Create Repairs" id: docker_container_offline_repairs_create diff --git a/tools/ha_ui_smoke.ps1 b/tools/ha_ui_smoke.ps1 index 282fde91..ff41a808 100644 --- a/tools/ha_ui_smoke.ps1 +++ b/tools/ha_ui_smoke.ps1 @@ -40,7 +40,6 @@ $targets = @( '/profile', '/dashboard-infrastructure', '/dashboard-infrastructure/home', - '/dashboard-infrastructure/activity', '/dashboard-infrastructure/docker', '/dashboard-kiosk' )