Template to display loaded components on HA instance?

HI,

please help me find the correct template to display all loaded components on the HA instance.
I remember a post by #balloob while discussing Hue issues, after which was decided the list would be displayed on the dev-info page henceforth.

Of course it is, but nonetheless I would love to get that template…

do think is was rather short and simple, just like

  {%- for d in states | groupby('domain') %}
  {{ d[0] }}
  {%- endfor %}

or

          {%- for d in states | groupby('domain') %}
            {% if loop.first %}{{loop.length}} Domains:
            {% endif %}- {{ d[0] }}
          {%- endfor %}

shows all domains.

thanks!

Do you want something like this?

  {%- for d in states | groupby('domain') %}
    {{d[0]}}
    {%- for i in d[1] %}
      - {{i.name}}, {{i.state}}
    {%- endfor %}
  {%- endfor %}
1 Like

HI!

well, thats nice! but its not what I was looking for…
have a look at dev-info and see

29

click the link and all loaded components are revealed. Im sure #balloob mentioned this here or on the GitHub but I can’t find it anymore.

maybe your template could be used to add the unique filter somewhow so only the unique components are listed?

I can’t get an idea of what you want because that link doesn’t exist in 0.89.

thats odd, its only been there a short time… now you mention that, its indeed gone on my second system which runs 91.1…

anyways, this is what it shows:

Loaded Components
The following components are currently loaded:

alert
api
asuswrt
auth
automation
binary_sensor
binary_sensor.bayesian
binary_sensor.hue
binary_sensor.nest
binary_sensor.ping
binary_sensor.template
binary_sensor.threshold
binary_sensor.trend
binary_sensor.workday
camera
camera.ffmpeg
camera.generic
camera.nest
cast
climate
climate.nest
cloud
config
config.auth
config.auth_provider_homeassistant
config.automation
config.config_entries
config.core
config.customize
config.device_registry
config.entity_registry
config.group
config.script
counter
custom_updater
customizer
device_tracker
ffmpeg
frontend
group
hassio
history
history_graph
http
hue
input_boolean
input_datetime
input_number
input_select
input_text
ios
light
light.group
light.tradfri
logbook
logger
lovelace
map
media_player
media_player.cast
media_player.mpd
media_player.plex
media_player.spotify
mqtt
nest
notify
notify.file
notify.group
notify.ios
notify.pushbullet
onboarding
owntracks
panel_iframe
proximity
python_script
recorder
rest_command
scene
scene.homeassistant
script
sensor
sensor.asuswrt
sensor.buienradar
sensor.command_line
sensor.darksky
sensor.file
sensor.filesize
sensor.filter
sensor.hue
sensor.ios
sensor.mijnafvalwijzer
sensor.min_max
sensor.mold_indicator
sensor.moon
sensor.mqtt
sensor.nederlandse_spoorwegen
sensor.nest
sensor.plex
sensor.postnl
sensor.rest
sensor.season
sensor.statistics
sensor.synologydsm
sensor.systemmonitor
sensor.template
sensor.time_date
sensor.tradfri
sensor.uptime
sensor.version
sensor.waze_travel_time
sensor.xbox_live
shell_command
sun
switch
switch.command_line
switch.template
switch.tradfri
switch.wake_on_lan
system_log
timer
tradfri
tts
updater
variable
weather
weather.buienradar
weather.darksky
webhook
weblink
websocket_api
zeroconf
zone

OK. Well, I see things in the list that aren’t included in the states object. Run this and you’ll see it contains no references to sun, updater, etc.

{{states | list}}

It suggests to me that another source, something other than states, is needed to produce the data you want. Unfortunately, I don’t know that source. :man_shrugging:

Yeah, for some reason it was removed a few versions ago. I’m not sure if it was deliberate or what the reasoning was.

yep, I tried tried that of course, but couldn’t find it either. hence my post :wink:

the components should be somewhere in the system… the HA instance checks against that if you try to load a component. Just try load a newly added component and it isn’t there yet.

hmm, since we’re not supposed to tag the devs here, and aren’t allowed to ask simple questions on the GitHub, this is a bit of a deadlock… where to ask?

Looks like it was removed with this PR back in January:

https://github.com/home-assistant/home-assistant-polymer/pull/2624

yes might be indeed. but where did it go …? how to search for that on the GitHub

Doesn’t look like it was moved elsewhere on the frontend, it was outright deleted. However, it’s still available at the /api/config endpoint on the REST API. I don’t think there’s any way to get at anything other than the states object from Jinja2, so you would probably have to use a RESTful Sensor to get the components from the API, and then a template sensor to parse it out.

Ok feared as much, have never been able to use that Api setup as they are explained in the documentation. https://developers.home-assistant.io/docs/en/external_api_rest.html

update
well what do you know…

https://developers.home-assistant.io/docs/en/external_api_rest.html#get-api-config

this https://mydomain.duckdns.org:8123/api/config gives me the list in the browser:

{"components": ["python_script", "light", "hassio", "mqtt", "weblink", "sensor.solaredge", "notify.file", "sensor.moon", "asuswrt", "sensor.file", "sensor.statistics", "lovelace", "history_graph", "switch.template", "history", "input_number", "system_health", "sensor.synologydsm", "sensor.rest", "media_player", "binary_sensor.ping", "sensor.hue_custom", "zeroconf", "sensor.min_max", "owntracks", "cast", "sensor.uptime", "binary_sensor.workday", "config", "input_select", "auth", "timer", "updater", "sensor.mold_indicator", "light.hue", "alert", "scene", "binary_sensor.hue_custom", "binary_sensor.bayesian", "sensor.filter", "media_player.cast", "zone", "onboarding", "panel_iframe", "sensor.filesize", "variable", "api", "camera.generic", "custom_updater", "notify.group", "automation", "camera", "group", "scene.homeassistant", "script", "switch.command_line", "sensor.buienradar", "tradfri", "logger", "device_tracker", "hue", "input_datetime", "notify", "map", "websocket_api", "logbook", "sensor.asuswrt", "sensor.version", "webhook", "switch", "mqtt_statestream", "sensor.command_line", "sensor.waze_travel_time", "sun", "system_log", "input_text", "sensor.season", "shell_command", "sensor.time_date", "tts", "light.group", "sensor.nederlandse_spoorwegen", "binary_sensor.threshold", "binary_sensor", "sensor.template", "switch.tradfri", "input_boolean", "sensor", "switch.wake_on_lan", "light.tradfri", "sensor.systemmonitor", "proximity", "ios", "frontend", "notify.pushbullet", "sensor.mqtt", "rest_command", "sensor.websocket_api", "counter", "binary_sensor.template", "person", "http", "notify.ios", "sensor.ios", "sensor.tradfri", "customizer", "recorder"]

now how to get that into a sensor:

sensor:
  - platform: rest
    resource: https://mydomain.duckdns.org:8123/api/config
    name: Loaded components
    value_template: >
      {{ value_json.components }}

and even if this would work, the list would be too long (+255 characters) to show in a regular HA card. Can overcome that with the custom-ui text-only and a python script to create that sensor… pff. Wish it would be still in the interface ;-(

In 0.89, attempting to access my Home Assistant server with ... :8123/api/config returns

401: Unauthorized

It would appear access to the API requires authentication (maybe not if one uses the soon-to-be-deprecated trusted_networks authentication).

As for the 255-character limit, I recently learned that it applies to the entity’s state but not to its attributes so many you could store it there.

If you’re open to using AppDaemon I think I can put together a solution to this for you pretty easily. Let me know if you’re interested.

I don’t know if the REST Sensor in the version you are using, 0.84.3, supports JSON Attributes. If it does, you can import the long list of components into an attribute. Afterwards, you can use a template sensor to extract and display whatever you wish.

sensor:
  - platform: rest
    name: My Config
    json_attributes:
      - components
      - unit_system
      - config_dir
    resource: https://mydomain.duckdns.org:8123/api/config
    value_template: "{{ value_json.version }}"

For more information, there’s an example shown in the REST Sensor’s documentation: Fetch multiple JSON values and present them as attributes

O yes, sure. That would be a good reason to add appdeamon to my setup! very interested I would say…
thanks for any help you could lend me.

will check that. Though I am updating soon, so wont rely too much on the current possibilities of 84.3 :wink: should be future proof!

No problem! I think I’ve got the framework put together in my head, should be able to get this coded tonight or tomorrow.

1 Like

yes, was familiar with that, but wouldn’t directly know how to use that in this setting. before, Ive use python scripts to create sensors with long attributes successfully.

Ill see what your suggestion brings, might just be an easy way out here. :+1: