From 93cdbbd8b5907b2be7be33d0bd2f240a3583a4c4 Mon Sep 17 00:00:00 2001 From: Rohan Kapoor Date: Sun, 5 Jan 2025 11:08:51 -0800 Subject: [PATCH] Remove unneeded version sensors --- packages/default_config.yaml | 1 + packages/ha_system.yaml | 159 ----------------------------------- 2 files changed, 1 insertion(+), 159 deletions(-) delete mode 100644 packages/ha_system.yaml diff --git a/packages/default_config.yaml b/packages/default_config.yaml index e47e1d3d..9be46e62 100644 --- a/packages/default_config.yaml +++ b/packages/default_config.yaml @@ -21,6 +21,7 @@ media_source: mobile_app: my: sun: +system_health: # Helpers input_button: diff --git a/packages/ha_system.yaml b/packages/ha_system.yaml deleted file mode 100644 index 549df486..00000000 --- a/packages/ha_system.yaml +++ /dev/null @@ -1,159 +0,0 @@ -############################################################################### -# @author : Rohan Kapoor -# @date : 08/11/2018 -# @package : HA System -# @description : Manages aspects of the home assistant system. If the travis -# build succeeds (on the master branch), it will update the -# local configuration and then check if a HA update is -# required (in the repo) and the process the update, -# restarting HA when complete. -############################################################################### ---- -homeassistant: - customize: - ################################################ - ## Node Anchors - ################################################ - - package.node_anchors: - customize: &customize - package: 'ha_system' - - defaults: &defaults - scan_interval: 10 - - command_line_sensor_default: &command_line_sensor_defaults - <<: *defaults - command_timeout: 5 - - ################################################ - ## Sensor - ################################################ - - sensor.rohankapoorcom_homeassistant_config_last_build_state: - <<: *customize - - sensor.current_git_commit_id: - <<: *customize - friendly_name: Current Git Hash - - sensor.current_git_commit_time: - <<: *customize - friendly_name: Current Git Time - - sensor.current_version: - <<: *customize - friendly_name: Running Version - - sensor.desired_version: - <<: *customize - friendly_name: Desired Version - - sensor.upgraded_version: - <<: *customize - friendly_name: Upgraded Version - - sensor.speedtest_ping: - <<: *customize - - sensor.speedtest_download: - <<: *customize - - sensor.speedtest_upload: - <<: *customize - - sensor.fast_com_download: - <<: *customize - - ################################################ - ## Automation - ################################################ - - automation.update_configuration_if_travis_build_is_successful: - <<: *customize - - ################################################ - ## Shell Command - ################################################ - - shell_command.git_pull: - <<: *customize - - shell_command.update_homeassistant: - <<: *customize - - ################################################ - ## Script - ################################################ - - script.pull_and_restart_homeassistant: - <<: *customize - - script.update_homeassistant: - <<: *customize - -################################################ -## Sensor -################################################ - -command_line: - - sensor: - <<: *command_line_sensor_defaults - name: current_git_commit_id - command: '/usr/bin/git -C /etc/homeassistant/ rev-parse HEAD' - unique_id: e4749685-b2df-480f-993e-db3dfde3fa8e - - - sensor: - <<: *command_line_sensor_defaults - name: current_git_commit_time - # yamllint disable-line rule:line-length - command: '/usr/bin/git -C /etc/homeassistant/ log -1 --format="%at" | /usr/bin/xargs -I{} /bin/date -ud @{} +"%Y-%m-%dT%H:%M:%S.000Z"' - unique_id: ad9f43e5-5a8c-4d68-898c-f0f9c68d4758 - - - sensor: - <<: *command_line_sensor_defaults - name: desired_version - command: '/bin/cat /etc/homeassistant/.HA_VERSION' - unique_id: 736ea24f-9c34-4335-9102-d664a582f77b - - - sensor: - <<: *command_line_sensor_defaults - name: upgraded_version - command: '/srv/homeassistant/bin/hass --version' - unique_id: 3c99ddf8-128e-4563-9a61-883457671bc0 - -################################################ -## Monitoring -################################################ -system_health: - -################################################ -## Shell Command -################################################ - -shell_command: - git_pull: "/usr/bin/git -C /etc/homeassistant/ pull" - update_homeassistant: "/bin/bash /etc/homeassistant/bash_scripts/update.sh -u {{ states('sensor.desired_version') }}" - -################################################ -## Script -################################################ - -script: - - pull_and_restart_homeassistant: - sequence: - - service: shell_command.git_pull - # yamllint disable-line rule:line-length - - wait_template: "{{ is_state_attr('sensor.rohankapoorcom_homeassistant_config_last_build_state', 'Commit SHA', states('sensor.current_git_commit_id')) }}" - - delay: - seconds: 30 # Wait for all command line sensors to be updated - - service: script.update_homeassistant - - wait_template: "{{ is_state('sensor.upgraded_version', states('sensor.desired_version')) }}" - - service: homeassistant.restart - - update_homeassistant: - sequence: - - condition: template - value_template: "{{ states('sensor.current_version') < states('sensor.desired_version') }}" - - service: shell_command.update_homeassistant