Please @Anwen , can you share your card?
Thanks you.
Sure, here you go! This is the markdown card - not sure if you wanted the button card piece too, if so, let me know. Please note that Iām no Markdown expert, still learning, so maybe this isnāt the best or most efficient way to do things, but it works for me
- type: markdown
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.installed }} -> {{ addon.version }}
> {% 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 }} |
| **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 }} |
edited 2020-05-31: With the change to HACS that came with HA 0.110, the names got an underscore added. So this line
> **{{ repo.display_name }}** _{{ repo["installed version"] }}_ -> _{{ repo["available version"] }}_
becomes
> **{{ repo.display_name }}** _{{ repo["installed_version"] }}_ -> _{{ repo["available_version"] }}_
Thanks !, I really like it, and how do you show the three buttons with the versions you have at the beginning?
The card with the three buttons uses the custom button card (https://github.com/custom-cards/button-card), and is in a vertical stack with the markdown card. I am just using the HA version sensor (https://www.home-assistant.io/integrations/version/) instead of what @CentralCommand did above, because I made those buttons a long time ago. The first two are really just for display purposes; if you click them they just show the more-info dialog.
The button for the Remote UI toggles the Remote UI for HA Cloud on and off, with a lock so I donāt toggle it by mistake. I made a template switch to do this:
platform: template
switches:
cloud_connected:
value_template: "{{ is_state('binary_sensor.remote_ui', 'on') }}"
turn_on:
service: cloud.remote_connect
turn_off:
service: cloud.remote_disconnect
In ui-lovelace.yaml I have the following to set a template for font-size for the button card:
button_card_templates:
smaller_text:
styles:
name:
- font-size: 14px
state:
- font-size: 14px
In my Lovelace view, the code for the horizontal stack of three button cards is:
- type: horizontal-stack
cards:
- type: "custom:button-card"
template: smaller_text
entity: sensor.installed_version
icon: mdi:home-assistant
color: "#42a5f5"
size: 25%
show_state: true
tap_action:
action: more-info
- type: "custom:button-card"
template: smaller_text
icon: mdi:home-assistant
color: "#42a5f5"
size: 25%
show_state: true
entity: sensor.latest_available_version
tap_action:
action: more-info
- type: "custom:button-card"
template: smaller_text
show_state: true
entity: binary_sensor.remote_ui
lock:
enabled: true
size: 25%
tap_action:
action: call-service
service: switch.toggle
service_data:
entity_id: switch.cloud_connected
state:
- value: 'on'
icon: mdi:cloud-check
color: "#42a5f5"
- value: 'off'
icon: mdi:cloud-alert
color: "#b8b8b8"
Hope that helps. Have fun!
Thank you very much for your help.
Hereās my version copied from @Anwenās useful markdown card.
I use HA Core on docker so I needed a docker updates jinja script
I have version monitors setup for the local system dockers and the github releases and named them the same so sensor.github_XXX_version
and sensor.docker_XXX_version
then use the docker variable in my jinja script to pass the names and loop it through.
{% macro version_remove(text) %}
{{- text | regex_replace(find='^[v]', replace='', ignorecase=False) | regex_replace(find='\s', replace='', ignorecase=False) }}
{% endmacro %}
{% macro sentence_case(text) %}
{{- text[0]|upper}}{{text[1:] -}}
{% endmacro %}
{%- set dockers = {"containers": ["adguardhome", "adminer", "alertmanager", "cadvisor", "dozzle", "grafana", "node_exporter", "nodered", "nzbget", "prometheus", "radarr", "sonarr", "tautulli", "unifi_poller", "mosquittomqtt", "airconnect"]} -%}
{%- for container in dockers.containers -%}
{%- set current = 'sensor.docker_'+container+'_version' -%}
{%- set latest = 'sensor.github_'+container+'_version' -%}
{%- if version_remove(states(current)) != version_remove(states(latest)) and states(latest) != "" %}
> **{{sentence_case(container)}}** _{{ states(current)|regex_replace(find='^[v]', replace='', ignorecase=False) }}_ -> _{{states(latest)|regex_replace(find='^[v]', replace='', ignorecase=False)}}_
{%- endif -%}
{% endfor %}
Hope it helps someone out!
Before anyone asks how I get the versions its all here.
Quick question - are HACS notifications broken? Iāve got the code from https://hacs.xyz/docs/basic/automation#updates-pending
but notifications are incomplete:
Ah right, thanks for the reminder, this needs an update.
In 1.0 the fields were changed inside sensor.hacs
. previously for each repo with an update the fields for installed and available version were installed version
and available version
with a space. Now the fields are installed_version
and available_version
with an underscore as of 1.0.
It was in the release notes here. Looks like you found a bug with the hacs docs, that probably needs an update to account for the field name change.
[EDIT] Actually no, I just looked at it and it was updated to account for the new field change, thatās not the issue here. Also I had the field names wrong, fixed them. Not really sure whatās going on for you, I donāt use that guide myself but it all looks correctā¦
Iām having the same exact issue.
I missed it in the release notes - thanks.
And it was too subtle a change in the docs! missed it there too.
Ah I see, you had the code running already and weāre trying to figure out what changed so you knew how to update it. And yea it was pretty subtle.
For the record I updated my Node RED flows in the 2nd post above to account for this change for anyone using those. People who previously imported will probably find it easier to make the changes manually then re-import. If you search for āinstalled versionā then it will highlight the one node that refers to those fields (its the use component node that calls the ānotify meā component off the HACS update flow). That was the only place those fields were referenced.
I got it all working but i canāt get the markdown card working tried all sorts and just get errors
I just updated the my post above for the markdown card to reflect a change in HACS that came with HA 0.110.x, if that helps anyone.
Thanks for the update!, also I have problems with addons section for 0.112.3 version, despite having new uptdates for addons the count is always 0.
I am using @CentralCommandās update package with a couple of small changes relevant to my environment, and everything seems to be working great apart from the alerts.
I have checked and re-checked the code and I canāt see anything wrong with it, but it isnāt working.
Both sensor.hacs and binary_sensor.updater_hacs are active with an update but none of the notifiers sent the message.
# 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: true
repeat: 360
title: "Updates available in {{ states('sensor.hacs') }} HACS repo{% if states('sensor.hacs') | int > 1 %}s{% endif %}"
message: ""
notifiers:
- notify.telegram
- notify.notify
- notify.html5
data:
tag: 'hacs-update-available'
url: 'https://**my url**/hacs/installed
I checked the sensor template and the alert title template and they are both working
Any help would be gratefully received
In alerts the notifiers canāt have the domain in front.
Simply remove the notify.
in front of your notifiers:
notifiers:
- telegram
- notify
- html5
I wanted a notification for core updates:
platform: command_line
name: Core update
command: 'curl http://supervisor/core/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version}'''
value_template: "{{ value_json.data }}"
json_attributes:
- newest_version
- current_version
Yea I got tired of waiting for binary_sensor.updater
to update and made one of those too, itās actually in the original post under the last collapse:
Iām a little confused by yours though. It looks like youāre setting the value of the sensor to value_json.data
but youāre processing the response like this
jq '{"newest_version":.data.version_latest,"current_version":.data.version}'
So it looks like you arenāt actually telling jq
to add a data field. Am I missing something or is your sensor always false right now?
If you look at mine above you can just copy the value_template
and drop it in. I know Iāve been using mine for a while without issue.
I somehow missed that - it wouldāve saved me the time I spent getting it to work
Am I missing something or is your sensor always false right now?
I donāt know why, but it works. I got a notification today when 0.114.0b4 was released
Either way, good work! I love these.