Where can I find a list of domains?

If that’s the case, that’s a poor implementation. It completely defeats the purpose of exposed domains and maintaining small configurations. I doubt it would be different than other components. For example, in emulated hue I only have exposed domains. Any domain not in that list is ignored and not exposed.

I just looked at the code, it uses the same library as emulated hue. You should only need to configure exposed domains and the entity id’s you want to expose.

If my understanding of the documentation is correct (and both could be wrong) there is a precedence that included entities override excluded domains.

Yes. That way you can exclude (say) the entire switch domain, and then include a single switch.

Of course, if you only specify included domains or entities, then it’ll automatically exclude everything else.

2 Likes

Here is a list of domains. It’s going to be different for you because there isn’t a specific list. Here are mine and also a command you can use to generate a list.

# hass-cli state list | grep -o '^[a-z][^.]*' | sort | uniq
alarm_control_panel
alert
alexa
automation
binary_sensor
camera
climate
device_tracker
ENTITY
fan
group
image_processing
input_boolean
input_select
light
media_player
person
remote
script
sensor
sun
switch
timer
weather
zigbee2mqtt_networkmap
zone
8 Likes

Well that’s a list for your instance of HA. It will change depending on what you have integrated.

Using this template in the template editor will get you the list of domains that are being used in your instance:

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

EDIT: Seeing that this gets so much foot traffic. Here 1 line template that does the same thing.

{{ states | groupby('domain') | map(attribute='0') | list | join('\n') }}
58 Likes

Hi, is it possible to get a list of notify services?

I tried this command
hass-cli --no-headers --output json service list 'notify.'
or
hass-cli --no-headers service list 'notify.'
and this
http://hassio:8123/api/services

but I don’t know how to do a rest full command or command line

I would like to get the list of notification services and then populate an input_select
Thank you very much if you can help me.

I don’t believe so. Sorry. I have often been wrong so maybe someone else may know.

Use grep?

On Linux variants:

hass-cli --no-header service list  | grep notify

On Windows

hass-cli --no-header service list   |findstr -i notify

Blockquote
hass-cli --no-header service list | grep notify

Yes thanks. On Linux this works without --no-headers with the end point

hass-cli service list | grep notify.
and it is the same as this one
hass-cli --no-headers service list 'notify.'

But the question is: how can I import this data into hass? in an input_text separated by a comma maybe? But how? Or else I don’t know …

notify

by the path /api/services

thanks anyway :+1:

what is it in you mean when you say you want to import this into hass with an input select ?

didnt see the solution to finding used domains in your setup yet, so here’s what shows all your domains in use:

  - platform: template
    sensors:
      domains_in_use:
        friendly_name: Domains in use
        value_template: >
          {%- for d in states | groupby('domain') %}
          {{ d[0] }}
          {%- endfor %}

or count them also:

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

this will show all components:

  - platform: rest
    name: Hassio Main config
    resource: !secret resource_hassio_main_config
    authentication: basic
    value_template: >
      {{ value_json.version }}
    json_attributes:
      - components
      - unit_system
      - config_dir
    headers:
      Content-Type: application/json
      Authorization: !secret api_bearer_token
      User-Agent: Home Assistant REST sensor

and you need to have/create an api_bearer_token for that

3 Likes

Thank you both!
@Mariusthvdb, I suggest your post here

It was what I wanted, but I didn’t know that config existed
resource: http://hassio:port/api/config

In the link there are many interesting things. Thank you so much for your super shares.

2 Likes

i installed HA in ubuntu venv. when i entered this command at the terminal, i get error of:
hass-cli: command not found

hass-cli --no-header service list  | grep notify

any idea what i did wrong?

You need to install hass-cli:

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

12 Likes

this has to be corrected, even though it is a very old post…

you are counting the number of characters of that domain name…

this works a bit better:

      - unique_id: ha_main_domains
        name: Ha main domains
        icon: mdi:format-list-numbered
        state: >
          {{states|groupby('domain')|map(attribute='0')|list|count}}
        attributes:
          domains: >
            {% set x = ['unavailable','unknown'] %}
            {%- for d in states|groupby('domain') %}
              - {{ d[0]}}: ({{states[d[0]]
                            |rejectattr('state','in',x)
                                  |list|count}})
            {%- endfor -%}

You already have state objects, no reason to access states again. That’s what groupby does.

{% set x = ['unknown', 'unavailable'] %}
{%- for d, es in states | groupby('domain') %}
- {{ d }}: ({{ es | rejectattr('state', 'in', x) | list | count }})
{%- endfor %}
1 Like

o thats nice!

however, there’s always a caveat, I had this

            {% for i in d[1] if i.state not in x -%}
            > {{i.name}}: *{{i.state}}*
            {% endfor %}

as additional in my markdown (which I simply left out for the post above):

          {% set x = ['unavailable','unknown'] %}
          {%- for d in states|groupby('domain') %}
          {% if loop.first %} ### Domains: *{{loop.length}}* - Entities: *{{states|count}}* {% endif %}
            **{{- d[0]}}:** *({{states[d[0]]
                                |rejectattr('state','in',x)
                                |list|count}})*
            {% for i in d[1] if i.state not in x -%}
            > {{i.name}}: *{{i.state}}*
            {% endfor %}
          {%- endfor -%}

and I cant simply jot that in in your shorter template

id love to get those back in there, and return:

1 Like