A sensor to list unavailable devices

If you are talking about my version then it is a YAML file, not JSON. I put it in /config/templates.yaml (create it if you don’t have it already) .

In /config/configuration.yaml include the line

template: !include templates.yaml

You then need to reload the configuration to activate it. Clear the log file first and if it does not work check the log file afterwards.

To use macro 's one needs to import them:

{% for ‘tools.jinja’ import unavailable_devices %}
{{ unavailable_devices()}}

Sorry, I have not used macros in HA and don’t know anything about them. Why do you want to?

This allows to use the same template code on multiple places in you cards and template sensors

1 Like

Thanks for responding! Your solution with the auto-entities card and custom-template-entity-row was exactly what I was trying to achieve: getting only the device (no repeat entities) that was unavailable into a dynamic dashboard card and have the tap action go to that device page. I was able to get everything working.
Firstly, I was getting errors initially because I was accidentally commenting out a necessary line when editing the ignore_list portion of the macro. After figuring that out, I just needed to edit your macro call in the developer tools area to this:

{% from 'tools.jinja' import unavailable_devices %}
{{ unavailable_devices()|from_json }}
{{ unavailable_devices()|from_json|count }}

to make the code give me any results. I’ve now got the template working in an auto-entities card. Thanks again!

2 Likes