Help needed with template error (in markdown card)

Lots of different codes allowed in markdown cards. A lot to learn.
Got most of my warning (thanks to yours and 123’s help).errors cleared up.
Another one I see sometimes:

Logger: homeassistant.helpers.template
Source: helpers/template.py:1612
First occurred: 6:45:03 AM (32 occurrences)
Last logged: 6:45:03 AM

Template variable warning: 'dict object' has no attribute 'installed' when rendering '<ha-icon icon="mdi:home-assistant"></ha-icon>&nbsp;**Add-ons needing update:** &nbsp;&nbsp; {{ states.sensor.supervisor_updates.state }} > {% for addon in states.sensor.supervisor_updates.attributes.addons %} > {{ addon.name }}&nbsp; {{ addon.installed }} -> {{ addon.version }} > {% endfor %} <ha-icon icon="hacs:hacs"></ha-icon>&nbsp;**HACS updates available:** &nbsp;&nbsp; {{ states.sensor.hacs.state }} > {% for repo in states.sensor.hacs.attributes.repositories %} > **{{ repo.display_name }}** _{{ repo["installed_version"] }}_ -> _{{ repo["available_version"] }}_ > {% endfor %} --- | | Current&nbsp;&nbsp;&nbsp; | Latest | |--- |:---: |:---: | | **Supervisor**&nbsp;&nbsp;&nbsp; | {{ states.sensor.supervisor_updates.attributes.current_version }} | {{ states.sensor.supervisor_updates.attributes.newest_version }} |'

From a marked down card.

When I run the same code that you posted, mine shows Add-ons needing update: 16 this is all of the items, then it lists them all. Does this seem like my template is wrong or my markdown is wrong?

It seems like you either didn’t copy the markdown correctly, or your sensor is wrong. Do you have any addons needing an update (and which ones) if you look at the Supervisor dashboard? If you look in Developer Tools → States, what is the value of sensor.supervisor_updates (including attributes)? Mine is currently 0 so there is nothing listed under the attribute addons:

Markdown card:

temp

My sensor is defined as

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

Hope that helps…

I was missing the update_available line. Not sure how I missed it. Thanks.

1 Like

All of the top works great.
Anything after supervisor on the bottom fails.
Must be another template issue. Do you mind sharing yours?

| **Supervisor**&nbsp;&nbsp;&nbsp; | {{ state_attr('sensor.supervisor_updates', 'current_version') }} | | {{ state_attr('sensor.supervisor_updates', 'newest_version') }} |

Anything below cause the card to show just updates available.

        | **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 }} |
        | **Observer** | {{ states.sensor.updater_observer.attributes.current_version }} | | {{ states.sensor.updater_observer.attributes.newest_version }} |

All of those sensors can be found in this post - let me know if you still have an issue after you look at that.

I just spotted my error. The sensor in the opening post was changed. I now found the correct ones. Hopefully I will have it corrected shortly. All working. Thanks for everyone’s help getting me through this.

1 Like