you beat me… Was just testing this:
components = hass.states.get('sensor.hassio_main_config').attributes['components']
cnt = len(components)
components.sort()
# Make a dictionary of all main domains, add each sub domain to the main domain list.
compdict = {}
for component in components:
if component.count('.') == 0 and component not in compdict:
compdict[component] = []
if component.count('.') == 1:
domain, subdomain = component.split('.')
compdict[domain].append(subdomain)
# Make the dictionary into a flat list of strings.
complist = []
for key, value in compdict.items():
if value:
value.sort()
# Adding a domain & series of sub domains
complist.append('!{}: \n #--> {}'.format(key, ', '.join(value)))
else:
complist.append('+{}'.format(key))
# join each component with a carriage return
complist = '\n'.join(complist)
text = '*========== {} Loaded Components ========\n' \
'{}'.format(cnt, complist)
#text = text + complist
hass.states.set('sensor.hassio_main_components_ordered', cnt, {
'custom_ui_state_card': 'state-card-value_only',
'text': text
})
which seems to be perfect!
thank you!