Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###### kaart gedeelte #####
- - type: markdown
- style: |
- ha-card {background: var(--card-background-color);}
- .card-header {color: var(--primary-color);font-weight: bold;
- border-radius: 15px;
- box-shadow: none;
- }
- content: |
- <ha-icon icon="mdi:home-assistant"></ha-icon> **Add-ons needing update:** {{ states.sensor.supervisor_updates.state }}
- > {% for addon in states.sensor.supervisor_updates.attributes.addons %}
- > {{ addon.name }} {{ addon.version }} -> {{ addon.version_latest }}
- > {% endfor %}
- <ha-icon icon="hacs:hacs"></ha-icon> **HACS updates available:** {{ states.sensor.hacs.state }}
- > {% for repo in states.sensor.hacs.attributes.repositories %}
- > **{{ repo.display_name }}** _{{ repo["installed_version"] }}_ -> _{{ repo["available_version"] }}_
- > {% endfor %}
- ---
- | | Current | Latest |
- |--- |:---: |:---: |
- | **Supervisor** | {{ states.sensor.supervisor_updates.attributes.current_version }} | {{ states.sensor.supervisor_updates.attributes.newest_version }} |
- | **Hassio** | {{ states.sensor.current_version.state}} | {{ states.sensor.latest_version.state }} |
- | **HassOS** | {{ states.sensor.hassos_updates.attributes.current_version }} | {{ states.sensor.hassos_updates.attributes.newest_version }} |
- | **Audio** | {{ states.sensor.updater_audio.attributes.current_version }} | {{ states.sensor.updater_audio.attributes.newest_version }} |
- | **CLI** | {{ states.sensor.updater_cli.attributes.current_version }} | {{ states.sensor.updater_cli.attributes.newest_version }} |
- | **DNS** | {{ states.sensor.updater_dns.attributes.current_version }} | {{ states.sensor.updater_dns.attributes.newest_version }} |
- | **Multicast** | {{ states.sensor.updater_multicast.attributes.current_version }} | {{ states.sensor.updater_multicast.attributes.newest_version }} |
- ##########################
- ###### start Package ######
- sensor:
- # Sensor to track available updates for supervisor & addons
- - platform: command_line
- name: Supervisor updates
- command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"update_available":.data.update_available,"addons":[.data.addons[] | select(.update_available)]}'''
- value_template: "{{ value_json.addons | length }}"
- unit_of_measurement: pending update(s)
- json_attributes:
- - update_available
- - newest_version
- - current_version
- - addons
- # Sensors to track updates to other core components (audio, dns, CLI and multicast)
- - platform: command_line
- name: Updater Audio
- command: 'curl http://supervisor/audio/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- - platform: command_line
- name: Updater DNS
- command: 'curl http://supervisor/dns/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- - platform: command_line
- name: Updater CLI
- command: 'curl http://supervisor/cli/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- - platform: command_line
- name: Updater Multicast
- command: 'curl http://supervisor/multicast/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- - platform: command_line
- name: Updater Observer
- command: 'curl http://supervisor/observer/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- # Alternate updater sensor for core since binary_sensor.updater is very slow to recognize updates
- - platform: command_line
- name: Updater Core
- command: 'curl http://supervisor/core/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- # Hass OS version
- - platform: command_line
- name: Hassos updates
- command: >
- curl http://supervisor/os/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq '{"newest_version":.data.version_latest,"current_version":.data.version}'
- value_template: >
- {% if value_json.newest_version != value_json.current_version %}on
- {% else %}off
- {% endif %}
- json_attributes:
- - newest_version
- - current_version
- binary_sensor:
- # True if there's updates available for any HACS components, Addons or the Host
- - platform: threshold
- name: Updater HACS
- entity_id: sensor.hacs
- upper: 0.5
- - platform: threshold
- name: Updater Addons
- entity_id: sensor.supervisor_updates
- upper: 0.5
- - platform: threshold
- name: Updater Host
- entity_id: sensor.host_updates
- upper: 0.5
- - platform: template
- sensors:
- # True if there's an update available for supervisor
- updater_supervisor:
- friendly_name: 'Updater Supervisor'
- device_class: problem
- value_template: "{{ state_attr('sensor.supervisor_updates', 'update_available') }}"
- availability_template: "{{ states('sensor.supervisor_updates') | int(-1) > -1 }}"
- alert:
- # Update is available - un-acknowledgeble, auto-dismiss, me only
- # Wait 5 minutes before first to give core config check time to run
- ha_update_available:
- name: HA has an update
- entity_id: sensor.updater_core
- state: 'on'
- can_acknowledge: false
- repeat:
- - 5
- - 360
- skip_first: true
- title: 'Update for HA available'
- message: "New version is {{ state_attr('sensor.updater_core', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_core', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'ha-update-available'
- url: 'http://hassio.lan:8123/hassio/addon/core_check_config'
- # Supervisor update is available - un-acknowledgeable, auto-dismiss, me only
- supervisor_update_available:
- name: Supervisor has an update
- entity_id: binary_sensor.updater_supervisor
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA Supervisor available'
- message: "New version is {{ state_attr('sensor.supervisor_updates', 'newest_version') }}. Currently on {{ state_attr('sensor.supervisor_updates', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'supervisor-update-available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # Audio update is available - un-acknowledgeable, auto-dismiss, me only
- audio_update_available:
- name: Audio has an update
- entity_id: sensor.updater_audio
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA Audio available'
- message: "New version is {{ state_attr('sensor.updater_audio', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_audio', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'audio_update_available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # DNS update is available - un-acknowledgeable, auto-dismiss, me only
- dns_update_available:
- name: DNS has an update
- entity_id: sensor.updater_dns
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA DNS available'
- message: "New version is {{ state_attr('sensor.updater_dns', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_dns', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'dns_update_available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # CLI update is available - un-acknowledgeable, auto-dismiss, me only
- cli_update_available:
- name: CLI has an update
- entity_id: sensor.updater_cli
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA CLI available'
- message: "New version is {{ state_attr('sensor.updater_cli', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_cli', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'cli_update_available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # Multicast update is available - un-acknowledgeable, auto-dismiss, me only
- multicast_update_available:
- name: Multicast has an update
- entity_id: sensor.updater_multicast
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA Multicast available'
- message: "New version is {{ state_attr('sensor.updater_multicast', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_multicast', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'multicast_update_available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # Observer update is available - un-acknowledgeable, auto-dismiss, mike only
- observer_update_available:
- name: Observer has an update
- entity_id: sensor.updater_observer
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA Observer available'
- message: "New version is {{ state_attr('sensor.updater_observer', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_observer', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'observer_update_available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # HACS repos have updates available - unacknowledgeable, auto-dismiss, me only
- hacs_update_available:
- name: HACS repos have updates
- entity_id: binary_sensor.updater_hacs
- state: 'on'
- can_acknowledge: false
- repeat: 360
- message: "Updates available in {{ states('sensor.hacs') }} HACS repo{% if states('sensor.hacs') | int > 1 %}s{% endif %}"
- title: "HACS"
- notifiers:
- - dageraad
- data:
- tag: 'hacs-update-available'
- url: 'http://hassio.lan:8123/hacs/installed'
- # Addons have updates available - unacknowledgeable, auto-dismiss, me only
- addon_update_available:
- name: Addons have updates
- entity_id: binary_sensor.updater_addons
- state: 'on'
- can_acknowledge: false
- repeat: 360
- message : "Updates available for {{ states('sensor.supervisor_updates') }} HA addon{% if states('sensor.supervisor_updates') | int > 1 %}s{% endif %}"
- title: "Addons"
- notifiers:
- - dageraad
- data:
- tag: 'addon-update-available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- automation:
- - id: '1585256741683'
- alias: Check config with update
- description: Starts the check config addon when an update becomes available
- trigger:
- - entity_id: sensor.updater_core
- platform: state
- to: 'on'
- condition: []
- action:
- - data:
- addon: core_check_config
- service: hassio.addon_start
- sensor:
- # Sensor to track available updates for supervisor & addons
- - platform: command_line
- name: Supervisor updates
- command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"update_available":.data.update_available,"addons":[.data.addons[] | select(.update_available)]}'''
- value_template: "{{ value_json.addons | length }}"
- unit_of_measurement: pending update(s)
- json_attributes:
- - update_available
- - newest_version
- - current_version
- - addons
- # Sensors to track updates to other core components (audio, dns, CLI and multicast)
- - platform: command_line
- name: Updater Audio
- command: 'curl http://supervisor/audio/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- - platform: command_line
- name: Updater DNS
- command: 'curl http://supervisor/dns/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- - platform: command_line
- name: Updater CLI
- command: 'curl http://supervisor/cli/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- - platform: command_line
- name: Updater Multicast
- command: 'curl http://supervisor/multicast/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- - platform: command_line
- name: Updater Observer
- command: 'curl http://supervisor/observer/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- # Alternate updater sensor for core since binary_sensor.updater is very slow to recognize updates
- - platform: command_line
- name: Updater Core
- command: 'curl http://supervisor/core/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
- value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
- json_attributes:
- - update_available
- - newest_version
- - current_version
- # Hass OS version
- - platform: command_line
- name: Hassos updates
- command: >
- curl http://supervisor/os/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq '{"newest_version":.data.version_latest,"current_version":.data.version}'
- value_template: >
- {% if value_json.newest_version != value_json.current_version %}on
- {% else %}off
- {% endif %}
- json_attributes:
- - newest_version
- - current_version
- binary_sensor:
- # True if there's updates available for any HACS components, Addons or the Host
- - platform: threshold
- name: Updater HACS
- entity_id: sensor.hacs
- upper: 0.5
- - platform: threshold
- name: Updater Addons
- entity_id: sensor.supervisor_updates
- upper: 0.5
- - platform: threshold
- name: Updater Host
- entity_id: sensor.host_updates
- upper: 0.5
- - platform: template
- sensors:
- # True if there's an update available for supervisor
- updater_supervisor:
- friendly_name: 'Updater Supervisor'
- device_class: problem
- value_template: "{{ state_attr('sensor.supervisor_updates', 'update_available') }}"
- availability_template: "{{ states('sensor.supervisor_updates') | int(-1) > -1 }}"
- alert:
- # Update is available - un-acknowledgeble, auto-dismiss, me only
- # Wait 5 minutes before first to give core config check time to run
- ha_update_available:
- name: HA has an update
- entity_id: sensor.updater_core
- state: 'on'
- can_acknowledge: false
- repeat:
- - 5
- - 360
- skip_first: true
- title: 'Update for HA available'
- message: "New version is {{ state_attr('sensor.updater_core', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_core', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'ha-update-available'
- url: 'http://hassio.lan:8123/hassio/addon/core_check_config'
- # Supervisor update is available - un-acknowledgeable, auto-dismiss, me only
- supervisor_update_available:
- name: Supervisor has an update
- entity_id: binary_sensor.updater_supervisor
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA Supervisor available'
- message: "New version is {{ state_attr('sensor.supervisor_updates', 'newest_version') }}. Currently on {{ state_attr('sensor.supervisor_updates', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'supervisor-update-available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # Audio update is available - un-acknowledgeable, auto-dismiss, me only
- audio_update_available:
- name: Audio has an update
- entity_id: sensor.updater_audio
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA Audio available'
- message: "New version is {{ state_attr('sensor.updater_audio', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_audio', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'audio_update_available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # DNS update is available - un-acknowledgeable, auto-dismiss, me only
- dns_update_available:
- name: DNS has an update
- entity_id: sensor.updater_dns
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA DNS available'
- message: "New version is {{ state_attr('sensor.updater_dns', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_dns', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'dns_update_available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # CLI update is available - un-acknowledgeable, auto-dismiss, me only
- cli_update_available:
- name: CLI has an update
- entity_id: sensor.updater_cli
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA CLI available'
- message: "New version is {{ state_attr('sensor.updater_cli', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_cli', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'cli_update_available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # Multicast update is available - un-acknowledgeable, auto-dismiss, me only
- multicast_update_available:
- name: Multicast has an update
- entity_id: sensor.updater_multicast
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA Multicast available'
- message: "New version is {{ state_attr('sensor.updater_multicast', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_multicast', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'multicast_update_available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # Observer update is available - un-acknowledgeable, auto-dismiss, mike only
- observer_update_available:
- name: Observer has an update
- entity_id: sensor.updater_observer
- state: 'on'
- can_acknowledge: false
- repeat: 360
- title: 'Update for HA Observer available'
- message: "New version is {{ state_attr('sensor.updater_observer', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_observer', 'current_version') }}"
- notifiers:
- - dageraad
- data:
- tag: 'observer_update_available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- # HACS repos have updates available - unacknowledgeable, auto-dismiss, me only
- hacs_update_available:
- name: HACS repos have updates
- entity_id: binary_sensor.updater_hacs
- state: 'on'
- can_acknowledge: false
- repeat: 360
- message: "Updates available in {{ states('sensor.hacs') }} HACS repo{% if states('sensor.hacs') | int > 1 %}s{% endif %}"
- title: "HACS"
- notifiers:
- - dageraad
- data:
- tag: 'hacs-update-available'
- url: 'http://hassio.lan:8123/hacs/installed'
- # Addons have updates available - unacknowledgeable, auto-dismiss, me only
- addon_update_available:
- name: Addons have updates
- entity_id: binary_sensor.updater_addons
- state: 'on'
- can_acknowledge: false
- repeat: 360
- message : "Updates available for {{ states('sensor.supervisor_updates') }} HA addon{% if states('sensor.supervisor_updates') | int > 1 %}s{% endif %}"
- title: "Addons"
- notifiers:
- - dageraad
- data:
- tag: 'addon-update-available'
- url: 'http://hassio.lan:8123/hassio/dashboard'
- automation:
- - id: '1585256741683'
- alias: Check config with update
- description: Starts the check config addon when an update becomes available
- trigger:
- - entity_id: sensor.updater_core
- platform: state
- to: 'on'
- condition: []
- action:
- - data:
- addon: core_check_config
- service: hassio.addon_start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement